From 0375948db852f2a1703ac3637d33f288001d48b2 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 12 Jul 2018 15:41:08 +0200 Subject: [PATCH 1/2] Add missing `CI_COMMIT_BEFORE_SHA` predefined variable --- app/models/ci/build.rb | 1 + doc/ci/variables/README.md | 2 ++ spec/models/ci/build_spec.rb | 1 + 3 files changed, 4 insertions(+) diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index d8ddb4bc667..db86400128c 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -653,6 +653,7 @@ module Ci variables.append(key: 'CI_JOB_NAME', value: name) variables.append(key: 'CI_JOB_STAGE', value: stage) variables.append(key: 'CI_COMMIT_SHA', value: sha) + variables.append(key: 'CI_COMMIT_BEFORE_SHA', value: before_sha) variables.append(key: 'CI_COMMIT_REF_NAME', value: ref) variables.append(key: 'CI_COMMIT_REF_SLUG', value: ref_slug) variables.append(key: "CI_COMMIT_TAG", value: ref) if tag? diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index 9f6476edc34..84bd64d50cd 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -47,6 +47,7 @@ future GitLab releases.** | **CI_COMMIT_REF_NAME** | 9.0 | all | The branch or tag name for which project is built | | **CI_COMMIT_REF_SLUG** | 9.0 | all | `$CI_COMMIT_REF_NAME` lowercased, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-`. No leading / trailing `-`. Use in URLs, host names and domain names. | | **CI_COMMIT_SHA** | 9.0 | all | The commit revision for which project is built | +| **CI_COMMIT_BEFORE_SHA** | 11.2 | all | The previous latest commit present on a branch before a push request. | | **CI_COMMIT_TAG** | 9.0 | 0.5 | The commit tag name. Present only when building tags. | | **CI_COMMIT_MESSAGE** | 10.8 | all | The full commit message. | | **CI_COMMIT_TITLE** | 10.8 | all | The title of the commit - the full first line of the message | @@ -118,6 +119,7 @@ future GitLab releases.** | `CI_BUILD_ID` | `CI_JOB_ID` | | `CI_BUILD_REF` | `CI_COMMIT_SHA` | | `CI_BUILD_TAG` | `CI_COMMIT_TAG` | +| `CI_BUILD_BEFORE_SHA` | `CI_COMMIT_BEFORE_SHA` | | `CI_BUILD_REF_NAME` | `CI_COMMIT_REF_NAME` | | `CI_BUILD_REF_SLUG` | `CI_COMMIT_REF_SLUG` | | `CI_BUILD_NAME` | `CI_JOB_NAME` | diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 3c96fe76829..ee923374480 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1613,6 +1613,7 @@ describe Ci::Build do { key: 'CI_JOB_NAME', value: 'test', public: true }, { key: 'CI_JOB_STAGE', value: 'test', public: true }, { key: 'CI_COMMIT_SHA', value: build.sha, public: true }, + { key: 'CI_COMMIT_BEFORE_SHA', value: build.before_sha, public: true }, { key: 'CI_COMMIT_REF_NAME', value: build.ref, public: true }, { key: 'CI_COMMIT_REF_SLUG', value: build.ref_slug, public: true }, { key: 'CI_BUILD_REF', value: build.sha, public: true }, From 852ab8ae85d2204adb0ae5d17d40b68a5f78e887 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 12 Jul 2018 15:47:13 +0200 Subject: [PATCH 2/2] Add changelog for predefined variable fix --- .../fix-gb-add-missing-before-sha-predefined-variable.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/fix-gb-add-missing-before-sha-predefined-variable.yml diff --git a/changelogs/unreleased/fix-gb-add-missing-before-sha-predefined-variable.yml b/changelogs/unreleased/fix-gb-add-missing-before-sha-predefined-variable.yml new file mode 100644 index 00000000000..7e9e8c33a71 --- /dev/null +++ b/changelogs/unreleased/fix-gb-add-missing-before-sha-predefined-variable.yml @@ -0,0 +1,5 @@ +--- +title: Add missing predefined variable and fix docs +merge_request: +author: +type: fixed