Add GitLab OIDC provider support - #5978
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #5978 +/- ##
==========================================
- Coverage 97.24% 94.02% -3.22%
==========================================
Files 476 480 +4
Lines 9787 10062 +275
==========================================
- Hits 9517 9461 -56
- Misses 270 601 +331 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8e0f612 to
a08c235
Compare
|
@colby-swandale Hey, I am trying to add trusted publishing support with GitLab CI. I've tested the functionality with ngrok, and it is working fine. Before adding proper tests and cleaning up the code, could you please check if I am on the right path ? I tried to mimic the GitHub actions implementation as much as possible. |
|
Hey @tachyons apologies, I dropped the ball on following up with you on this one. I'm looking at this now. |
colby-swandale
left a comment
There was a problem hiding this comment.
Reviewing the draft, I noticed it would be great to include API-level GitLab exchange coverage in the tests, as well as a graceful shutdown for the Attestation path.
|
Ah shoot, sorry to complicate your PR but the redesign has left a bunch of conflicts. Are you okay with updating to match the new layout/styles? |
|
Let me try, hopefully it wouldn't be hard |
The changes add GitLab as a new OIDC trusted publisher, allowing gem publishing from GitLab CI/CD pipelines.
cc84eff to
3debdea
Compare
| def set_selected_trusted_publisher_type | ||
| @selected_trusted_publisher_type = OIDC::TrustedPublisher.find_by_url_identifier(params[:trusted_publisher_type]) || OIDC::TrustedPublisher::GitHubAction |
There was a problem hiding this comment.
self review: Falling back to Github action by default to reduce path changes
| when OIDC::TrustedPublisher::GitHubAction then prefill_github_action(instance.trusted_publisher) | ||
| when OIDC::TrustedPublisher::GitLab then prefill_gitlab(instance.trusted_publisher) |
There was a problem hiding this comment.
self review: Pre-fill some information from the repo path
| # path is e.g. /group/project or /group/subgroup/project — drop leading "/" | ||
| { project_path: link.path.delete_prefix("/") } |
There was a problem hiding this comment.
self review: unlike GitHub, GitLab repo path can be deeply nested
| @gitlab_jwt = ->(claims = @gitlab_claims, key: @gitlab_pkey) { JSON::JWT.new(claims).sign(key.to_jwk) } | ||
|
|
||
| # Based on the sample GitLab OIDC payload | ||
| @gitlab_claims = { |
There was a problem hiding this comment.
self review: Taken from https://docs.gitlab.com/ci/secrets/id_token_authentication/
The changes add GitLab as a new OIDC trusted publisher, allowing gem publishing from GitLab CI/CD pipelines.
Goals:
Non Goals for this iteration
Screenshots
Prior art