summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-07-13 13:09:04 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-07-13 13:09:04 +0000
commitbac2c47c8d2b3d609e369a5fbad12438f4efe09e (patch)
tree14a3054ed78536564deadd813e6425bce1855d2f
parenta3c8525dc9a69d0e1048c114fd27317dcffc4221 (diff)
parent852ab8ae85d2204adb0ae5d17d40b68a5f78e887 (diff)
downloadgitlab-ce-bac2c47c8d2b3d609e369a5fbad12438f4efe09e.tar.gz
Merge branch 'fix/gb/add-missing-before-sha-predefined-variable' into 'master'
Add missing `CI_COMMIT_BEFORE_SHA` predefined variable Closes #43365 See merge request gitlab-org/gitlab-ce!20594
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--changelogs/unreleased/fix-gb-add-missing-before-sha-predefined-variable.yml5
-rw-r--r--doc/ci/variables/README.md2
-rw-r--r--spec/models/ci/build_spec.rb1
4 files changed, 9 insertions, 0 deletions
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/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
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 },