Skip to content
Snippets Groups Projects

Generate JWT for authentication and provide it to CI jobs

Merged Krasimir Angelov requested to merge 207125-ci-jwt-auth into master
1 unresolved thread
5 files
+ 4582
1
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 6
1
@@ -546,12 +546,13 @@ def persisted_variables
.concat(pipeline.persisted_variables)
.append(key: 'CI_JOB_ID', value: id.to_s)
.append(key: 'CI_JOB_URL', value: Gitlab::Routing.url_helpers.project_job_url(project, self))
.append(key: 'CI_JOB_TOKEN', value: token.to_s, public: false, masked: true)
.append(key: 'CI_JOB_JWT', value: jwt, public: false)
.append(key: 'CI_BUILD_ID', value: id.to_s)
.append(key: 'CI_BUILD_TOKEN', value: token.to_s, public: false, masked: true)
.append(key: 'CI_REGISTRY_USER', value: CI_REGISTRY_USER)
.append(key: 'CI_REGISTRY_PASSWORD', value: token.to_s, public: false, masked: true)
.append(key: 'CI_REPOSITORY_URL', value: repo_url.to_s, public: false)
.append(key: 'CI_JOB_JWT', value: jwt, public: false)
.concat(deploy_token_variables)
end
end
@@ -983,6 +984,10 @@ def options_retry
def has_expiring_artifacts?
artifacts_expire_at.present? && artifacts_expire_at > Time.now
end
def jwt
Gitlab::Ci::Jwt.for_build(self)
end
end
end
Loading