Environment section on build stage

According the documentation: “Environments describe where code is deployed.” So it is relevant to deploy stage.
But what if I need to pass CI/CD variables to build stage? Is it ok to setup environment section for build stage?

Hi @webchi

Yes, it’s fine. If your job has an environment section in it’s YAML config, then it has an environment.

For build jobs, you may want to specify environment:action so that the runner knows there won’t be a deployment:

build:
    stage: build
    ...
    environment:
        name: ...
        action: prepare
1 Like