diff options
author | Gilbert Roulot <groulot@gitlab.com> | 2018-09-20 18:10:41 +0200 |
---|---|---|
committer | Gilbert Roulot <groulot@gitlab.com> | 2018-10-05 14:40:46 +0200 |
commit | e3fedd637816084244ddbbff2e8465527aa0a65e (patch) | |
tree | 1e36881794260604b955efdea97b9fcbfc4143e6 /app/models/ci | |
parent | 14ed916cf2ffe82ca11b8d25a88cb20f88823734 (diff) | |
download | gitlab-ce-e3fedd637816084244ddbbff2e8465527aa0a65e.tar.gz |
Add variables to CI jobs for GitLab version components
Adds CI_SERVER_VERSION_MAJOR, CI_SERVER_VERSION_MINOR,
CI_SERVER_VERSION_PATCH to the list of environment variables
passed to CI jobs.
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/build.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index c9091c19705..a59ff731954 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -750,6 +750,9 @@ module Ci variables.append(key: 'GITLAB_FEATURES', value: project.licensed_features.join(',')) variables.append(key: 'CI_SERVER_NAME', value: 'GitLab') variables.append(key: 'CI_SERVER_VERSION', value: Gitlab::VERSION) + variables.append(key: 'CI_SERVER_VERSION_MAJOR', value: gitlab_version_info.major.to_s) + variables.append(key: 'CI_SERVER_VERSION_MINOR', value: gitlab_version_info.minor.to_s) + variables.append(key: 'CI_SERVER_VERSION_PATCH', value: gitlab_version_info.patch.to_s) variables.append(key: 'CI_SERVER_REVISION', value: Gitlab.revision) variables.append(key: 'CI_JOB_NAME', value: name) variables.append(key: 'CI_JOB_STAGE', value: stage) @@ -764,6 +767,10 @@ module Ci end end + def gitlab_version_info + @gitlab_version_info ||= Gitlab::VersionInfo.parse(Gitlab::VERSION) + end + def legacy_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'CI_BUILD_REF', value: sha) |