Skip to content

Bring scoped environment variables to core

What does this MR do?

Addresses https://gitlab.com/gitlab-org/gitlab-ce/issues/53593

EE MR: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14729

(EE feature originally introduced in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2112/diffs)

TODO

port over occurrences variable_environment_scope in EE:

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Manual QA

With the following .gitlab-ci.yml:

.base: &base
  script:
    - echo production-only $PRODUCTION_ONLY_VARIABLE
    - echo staging-only $STAGING_ONLY_VARIABLE
    - echo per-environment-value $PER_ENVIRONMENT_VALUE

production:
  <<: *base
  environment:
    name: production

staging:
  <<: *base
  environment:
    name: staging

with environments staging and production, and the following environment specific variables:

Screenshot_2019-07-18_at_14.49.14

we got:

production job

  • PRODUCTION_ONLY_VARIABLE not present
  • STAGING_ONLY_VARIABLE present
  • PER_ENVIRONMENT_VALUE has production-specific value

Screenshot_2019-07-18_at_14.49.48

staging job

  • PRODUCTION_ONLY_VARIABLE not present
  • STAGING_ONLY_VARIABLE present
  • PER_ENVIRONMENT_VALUE has staging-specific value

Screenshot_2019-07-18_at_14.49.40

Edited by 🤖 GitLab Bot 🤖

Merge request reports