summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-05-21 12:27:18 +0000
committerAlessio Caiazza <acaiazza@gitlab.com>2018-05-22 13:32:09 +0200
commit3ebaa2bdd3948cbe05cb8c4feaae7f39520703b3 (patch)
treeebbcbc2de45b30473c4b4e39c87c0ffe42e5b456
parentdc88ced2659f502c42da157fa184852e86c9f5b3 (diff)
downloadgitlab-ce-3ebaa2bdd3948cbe05cb8c4feaae7f39520703b3.tar.gz
Merge branch '46454-wrong-value-in-ci-deploy-user' into 'master'
Resolve "CI/CD jobs: Wrong value in env. variable CI_DEPLOY_USER using <gitlab-deploy-token> deploy token" Closes #46454 See merge request gitlab-org/gitlab-ce!19047
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--changelogs/unreleased/46454-wrong-value-in-ci-deploy-user.yml5
-rw-r--r--doc/user/project/deploy_tokens/index.md2
-rw-r--r--spec/models/ci/build_spec.rb2
4 files changed, 8 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 61c10c427dd..e76b8d0bf50 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -661,7 +661,7 @@ module Ci
Gitlab::Ci::Variables::Collection.new.tap do |variables|
break variables unless gitlab_deploy_token
- variables.append(key: 'CI_DEPLOY_USER', value: gitlab_deploy_token.name)
+ variables.append(key: 'CI_DEPLOY_USER', value: gitlab_deploy_token.username)
variables.append(key: 'CI_DEPLOY_PASSWORD', value: gitlab_deploy_token.token, public: false)
end
end
diff --git a/changelogs/unreleased/46454-wrong-value-in-ci-deploy-user.yml b/changelogs/unreleased/46454-wrong-value-in-ci-deploy-user.yml
new file mode 100644
index 00000000000..e610e53f71c
--- /dev/null
+++ b/changelogs/unreleased/46454-wrong-value-in-ci-deploy-user.yml
@@ -0,0 +1,5 @@
+---
+title: Fixes deploy token variables on Ci::Build
+merge_request: 19047
+author:
+type: fixed
diff --git a/doc/user/project/deploy_tokens/index.md b/doc/user/project/deploy_tokens/index.md
index 7a8b3c75690..c09d5aeba8e 100644
--- a/doc/user/project/deploy_tokens/index.md
+++ b/doc/user/project/deploy_tokens/index.md
@@ -76,7 +76,7 @@ pull images from your Container Registry.
> [Introduced][ce-18414] in GitLab 10.8.
There's a special case when it comes to Deploy Tokens, if a user creates one
-named `gitlab-deploy-token`, the name and token of the Deploy Token will be
+named `gitlab-deploy-token`, the username and token of the Deploy Token will be
automatically exposed to the CI/CD jobs as environment variables: `CI_DEPLOY_USER` and
`CI_DEPLOY_PASSWORD`, respectively.
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index dc810489011..5eb4fffbaaf 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2044,7 +2044,7 @@ describe Ci::Build do
let(:deploy_token_variables) do
[
- { key: 'CI_DEPLOY_USER', value: deploy_token.name, public: true },
+ { key: 'CI_DEPLOY_USER', value: deploy_token.username, public: true },
{ key: 'CI_DEPLOY_PASSWORD', value: deploy_token.token, public: false }
]
end