Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GitLab group variables #3894

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

robertohueso
Copy link

@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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
This updates documentation to match group and project support when
generating key pairs for GitLab.

Signed-off-by: Roberto Hueso Gomez <[email protected]>
@robertohueso
Copy link
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? 😄

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: 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 230 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.

@cpanato
Copy link
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

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.

2 participants