Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
572ad185
Commit
572ad185
authored
Jun 02, 2021
by
Thomas Watts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pipeline source to custom CI_JOB_JWT claims
Changelog: added
parent
c6a85564
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
0 deletions
+3
-0
doc/ci/examples/authenticating-with-hashicorp-vault/index.md
doc/ci/examples/authenticating-with-hashicorp-vault/index.md
+1
-0
lib/gitlab/ci/jwt.rb
lib/gitlab/ci/jwt.rb
+1
-0
spec/lib/gitlab/ci/jwt_spec.rb
spec/lib/gitlab/ci/jwt_spec.rb
+1
-0
No files found.
doc/ci/examples/authenticating-with-hashicorp-vault/index.md
View file @
572ad185
...
...
@@ -50,6 +50,7 @@ The JWT's payload looks like this:
"user_login"
:
"myuser"
#
GitLab
@username
"user_email"
:
"myuser@example.com"
,
#
Email
of
the
user
executing
the
job
"pipeline_id"
:
"1212"
,
#
"pipeline_source"
:
"web"
,
#
Pipeline
source
,
see:
https://docs.gitlab.com/ee/ci/yaml/#common-if-clauses-for-rules
"job_id"
:
"1212"
,
#
"ref"
:
"auto-deploy-2020-04-01"
,
#
Git
ref
for
this
job
"ref_type"
:
"branch"
,
#
Git
ref
type
,
branch
or
tag
...
...
lib/gitlab/ci/jwt.rb
View file @
572ad185
...
...
@@ -54,6 +54,7 @@ module Gitlab
user_login:
user
&
.
username
,
user_email:
user
&
.
email
,
pipeline_id:
build
.
pipeline
.
id
.
to_s
,
pipeline_source:
build
.
pipeline
.
source
.
to_s
,
job_id:
build
.
id
.
to_s
,
ref:
source_ref
,
ref_type:
ref_type
,
...
...
spec/lib/gitlab/ci/jwt_spec.rb
View file @
572ad185
...
...
@@ -42,6 +42,7 @@ RSpec.describe Gitlab::Ci::Jwt do
expect
(
payload
[
:user_email
]).
to
eq
(
user
.
email
)
expect
(
payload
[
:user_login
]).
to
eq
(
user
.
username
)
expect
(
payload
[
:pipeline_id
]).
to
eq
(
pipeline
.
id
.
to_s
)
expect
(
payload
[
:pipeline_source
]).
to
eq
(
pipeline
.
source
.
to_s
)
expect
(
payload
[
:job_id
]).
to
eq
(
build
.
id
.
to_s
)
expect
(
payload
[
:ref
]).
to
eq
(
pipeline
.
source_ref
)
expect
(
payload
[
:ref_protected
]).
to
eq
(
build
.
protected
.
to_s
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment