Skip to content

Add support for GitLab group variables#3894

Closed
robertohueso wants to merge 4 commits intosigstore:mainfrom
robertohueso:gitlab-group-variables
Closed

Add support for GitLab group variables#3894
robertohueso wants to merge 4 commits intosigstore:mainfrom
robertohueso:gitlab-group-variables

Conversation

@robertohueso
Copy link
Copy Markdown

@robertohueso robertohueso commented Oct 1, 2024

Summary

This PR refactors pkg/cosign/git/gitlab/gitlab.go to make it work with both project variables and group variables. This is mainly used when running

cosign generate-key-pair gitlab://<path>

This solves #2914 for GitLab.

Release Note

  • GitLab go-cloud style URIs now work both projects and groups.

Documentation

This probably does not require any change in docs apart from the ones included in this PR.

getGitlabContext() function returns the GitLab API context (i.e. Project
or Group) for a 'ref' namespaced path.

This helps select which GitLab API context to use for each of the
requests.

See sigstore#2914

Signed-off-by: Roberto Hueso Gomez <roberto@robertohueso.org>
This refactors GitLab's GetSecret() function to make it work both for
projects and group namespaced 'ref' paths.

This function can get the value for any key, so there are no mentions to
particular variable keys.

See sigstore#2914

Signed-off-by: Roberto Hueso Gomez <roberto@robertohueso.org>
This refactors GitLab's PutSecret() function to make it work both for
projects and group namespaced 'ref' paths.

See sigstore#2914

Signed-off-by: Roberto Hueso Gomez <roberto@robertohueso.org>
This updates documentation to match group and project support when
generating key pairs for GitLab.

Signed-off-by: Roberto Hueso Gomez <roberto@robertohueso.org>
@robertohueso
Copy link
Copy Markdown
Author

Hi @cpanato, it's my first time contributing here, I think this should be ready to review, is there any additional change needed on my side? 😄

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 29, 2024

Codecov Report

❌ Patch coverage is 1.80180% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.44%. Comparing base (2ef6022) to head (a1bfc4c).
⚠️ Report is 525 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cosign/git/gitlab/gitlab.go 0.00% 109 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3894      +/-   ##
==========================================
- Coverage   40.10%   36.44%   -3.67%     
==========================================
  Files         155      203      +48     
  Lines       10044    12881    +2837     
==========================================
+ Hits         4028     4694     +666     
- Misses       5530     7604    +2074     
- Partials      486      583      +97     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cpanato
Copy link
Copy Markdown
Member

cpanato commented Oct 29, 2024

sorry for the delay here @robertohueso please check the lint job and fix the lint issues
also will be good to have a rebase and squash your commits

@Hayden-IO
Copy link
Copy Markdown
Contributor

Closing as we push out a v3 release.

@Hayden-IO Hayden-IO closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants