diff options
-rw-r--r-- | app/models/ci/build.rb | 1 | ||||
-rw-r--r-- | app/models/namespace.rb | 4 | ||||
-rw-r--r-- | changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml | 5 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 1 |
4 files changed, 11 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 20534b8eed0..ee987949080 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -543,6 +543,7 @@ module Ci variables = [ { key: 'CI', value: 'true', public: true }, { key: 'GITLAB_CI', value: 'true', public: true }, + { key: 'GITLAB_FEATURES', value: project.namespace.features.join(','), public: true }, { key: 'CI_SERVER_NAME', value: 'GitLab', public: true }, { key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, diff --git a/app/models/namespace.rb b/app/models/namespace.rb index d95489ee9f2..db274ea8172 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -243,6 +243,10 @@ class Namespace < ActiveRecord::Base all_projects.with_storage_feature(:repository).find_each(&:remove_exports) end + def features + [] + end + private def path_or_parent_changed? diff --git a/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml b/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml new file mode 100644 index 00000000000..1e377094791 --- /dev/null +++ b/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml @@ -0,0 +1,5 @@ +--- +title: 'Expose GITLAB_FEATURES as CI/CD variable (fixes #40994)' +merge_request: +author: +type: added diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 0b3d5c6a0bd..9e159c3f1fe 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1413,6 +1413,7 @@ describe Ci::Build do [ { key: 'CI', value: 'true', public: true }, { key: 'GITLAB_CI', value: 'true', public: true }, + { key: 'GITLAB_FEATURES', value: '', public: true }, { key: 'CI_SERVER_NAME', value: 'GitLab', public: true }, { key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, |