Commit 5af45311 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'add-pipeline-source-ci-job-jwt' into 'master'

add pipeline source to the CI_JOB_JWT

See merge request gitlab-org/gitlab!62754
parents 52bf1812 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
......
......@@ -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,
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment