-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support gitlab #123
Support gitlab #123
Conversation
This brings ambient.py coverage to 100%.
I could be convinced otherwise, but IMO we should make this My reasoning: each of the detectors is semi-intentionally bound to a single service, even though some services might copy each others' APIs (e.g. FooCI could use the same technique as GitHub Actions). Having an explicit (One idea: maybe we could have
I'd be okay with adding this check, both here and elsewhere 🙂 |
I like this idea! |
That makes sense |
Based on feedback: * Instead of generic env var handling, make the detector only work on gitlab (based on GITLAB_CI variable) * Handle audience args that begin with a digit (replace with "_" in the env var name) * Raise if we are in GitLab environment but token is not found * Tweak README based on these changes This does seem much better as a misconfigured pipeline (e.g. a missing id_tokens section) now results in the following with sigstore: $ python -m sigstore sign README.md An issue occurred with ambient credential detection. Additional context: GitLab: Environment variable SIGSTORE_ID_TOKEN not found which seems pretty good to me.
Changed detect_env_var() to detect_gitlab(), see updated PR description |
/gcbrun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I will let @woodruffw review as well before merging.
Can you also update the first line of the README to include Gitlab? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well, thanks @jku!
I was looking at GitLab pipelines last night so decided to implement this since it was pretty trivial.
Fixes #121
Test pipeline with sigstore: https://gitlab.com/jku/test-oidc/-/blob/main/.gitlab-ci.yml,
Log from running that: https://gitlab.com/jku/test-oidc/-/pipelines/1044594956
Notes:
detect_env_var()
but based on feedback this was changed todetect_gitlab()
detect_gitlab()
is indeed better as it enables error handling (see the example pipeline run)