summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2017-08-25 11:01:55 +0700
committerMark Fletcher <mark@gitlab.com>2017-08-30 11:25:30 +0800
commit22d5cca8a7afe69000faac6e9011f6662f610123 (patch)
tree4c4d20bdc5030da9638d0d710f3d74117f26d2f3
parent91cca6e4943dd64d3bfe029e3da275ed1113bf47 (diff)
downloadgitlab-ce-22d5cca8a7afe69000faac6e9011f6662f610123.tar.gz
Add a Build Variable to represent the triggering GitLab user's login username
* Predefined variable represents the username of the GitLab user that started a build
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--changelogs/unreleased/26692-predefined-variable-gitlab-user-name.yml5
-rw-r--r--doc/ci/variables/README.md6
-rw-r--r--spec/models/ci/build_spec.rb1
4 files changed, 8 insertions, 5 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index ace86e5e517..b7dcae0f9b3 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -385,6 +385,7 @@ module Ci
[
{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
{ key: 'GITLAB_USER_EMAIL', value: user.email, public: true },
+ { key: 'GITLAB_USER_LOGIN', value: user.username, public: true },
{ key: 'GITLAB_USER_NAME', value: user.name, public: true }
]
end
diff --git a/changelogs/unreleased/26692-predefined-variable-gitlab-user-name.yml b/changelogs/unreleased/26692-predefined-variable-gitlab-user-name.yml
new file mode 100644
index 00000000000..fa1ca3d25b2
--- /dev/null
+++ b/changelogs/unreleased/26692-predefined-variable-gitlab-user-name.yml
@@ -0,0 +1,5 @@
+---
+title: Add CI/CD job predefined variables with user name and login
+merge_request: 13824
+author:
+type: added
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index 4b48a1f1c51..2b189c80066 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -77,12 +77,8 @@ future GitLab releases.**
| **GITLAB_CI** | all | all | Mark that job is executed in GitLab CI environment |
| **GITLAB_USER_ID** | 8.12 | all | The id of the user who started the job |
| **GITLAB_USER_EMAIL** | 8.12 | all | The email of the user who started the job |
-<<<<<<< HEAD
-| **GITLAB_USER_NAME** | 10.0 | all | The name of the user who started the job |
-=======
-| **GITLAB_USER_USERNAME** | 10.0 | all | The username of the user who started the job |
+| **GITLAB_USER_LOGIN** | 10.0 | all | The login username of the user who started the job |
| **GITLAB_USER_NAME** | 10.0 | all | The real name of the user who started the job |
->>>>>>> 940c584882... fixup name
| **RESTORE_CACHE_ATTEMPTS** | 8.15 | 1.9 | Number of attempts to restore the cache running a job |
## 9.0 Renaming
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 97fce7ded74..1a6c373ab45 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -1250,6 +1250,7 @@ describe Ci::Build do
[
{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
{ key: 'GITLAB_USER_EMAIL', value: user.email, public: true },
+ { key: 'GITLAB_USER_LOGIN', value: user.username, public: true },
{ key: 'GITLAB_USER_NAME', value: user.name, public: true }
]
end