Skip to content

Upload attestation of gem provenance at release#16

Merged
dentarg merged 1 commit intomainfrom
release-attestations
Mar 20, 2025
Merged

Upload attestation of gem provenance at release#16
dentarg merged 1 commit intomainfrom
release-attestations

Conversation

@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

I'm intentionally not using the rubygems/release-gem action, because I don't like the way it is doing things; it assumes you use the Bundler rake release task. I like to be more in control and not depend on that task (and know what that task is doing). There's a few issues open about this and other things: https://github.com/rubygems/release-gem/issues

@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

it assumes you use the Bundler rake release task. I like to be more in control and not depend on that task (and know what that task is doing)

For example, it tries to push the tag (in a specific format) to your git repo.

@dentarg dentarg requested a review from walro March 20, 2025 11:03
@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

@dentarg dentarg requested a review from baelter March 20, 2025 11:06
@dentarg dentarg merged commit e550a1c into main Mar 20, 2025
1 check passed
@dentarg dentarg deleted the release-attestations branch March 20, 2025 13:05
@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

I'm intentionally not using the rubygems/release-gem action, because I don't like the way it is doing things; it assumes you use the Bundler rake release task. I like to be more in control and not depend on that task (and know what that task is doing). There's a few issues open about this and other things: https://github.com/rubygems/release-gem/issues

I missed that this gem do use bundle exec rake release 🙈 It is in the README. I'll make the new release what we have now, just to get it out the door.

@walro
Copy link
Contributor

walro commented Mar 20, 2025

I missed that this gem do use bundle exec rake release 🙈 It is in the README. I'll make the new release what we have now, just to get it out the door.

Lazy reviewer just bought your reasoning too 😁

@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

I do like that we record who pushed the tag in git

$ git sorted-tags-with-body
2025-03-20 8e6123d v0.0.4 (Patrik Ragnarsson) []
Version 0.0.4

2024-10-23 6008016 v0.0.3 (Anders Bälter) []
Version 0.0.3

Instead of it being pushed by "GitHub Actions" (maybe it is possible to configure that, dunno)

@dentarg
Copy link
Contributor Author

dentarg commented Mar 20, 2025

I'm thinking we stick to the way it is now: #18

jeffwidman added a commit to dependabot/dependabot-core that referenced this pull request Apr 10, 2025
This adds sigstore attestations for our published gems.

We do not need to provide an OIDC token to the sigstore client because
by default it will request the token from the GitHub Actions environment:
https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68

The code inspiration for this change came from:
* 84codes/rubocop-eightyfourcodes#16
* rubygems/release-gem#11

You can see an example of how this attestation will look on RubyGems here:
https://rubygems.org/gems/sigstore/versions/0.2.1
- run: gem install *.gem
- run: gem push *.gem
- run: |
ruby -S gem exec sigstore-cli:0.2.1 sign *.gem --bundle attestation.sigstore.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious... why did you do ruby -S here, versus all the other calls you do gem exec by itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied that from the rubygems/release-gem action: https://github.com/rubygems/release-gem/pull/11/files#diff-bbc4dcfa3b9d8c948a1e28efe575fb30910f0f05057fb22735e2245e90a0cbd8R40-R43

I'm not sure it is needed, I didn't think much of it. Actually, I never looked up what -S does, as I trusted @segiddins to know his shit :)

     -S             Makes Ruby use the PATH environment variable to search for
                    script, unless its name begins with a slash.  This is used
                    to emulate #! on machines that don't support it, in the
                    following manner:

                          #! /usr/local/bin/ruby
                          # This line makes the next one a comment in Ruby \
                            exec /usr/local/bin/ruby -S $0 $*

                    On some systems $0 does not always contain the full
                    pathname, so you need the -S switch to tell Ruby to search
                    for the script if necessary (to handle embedded spaces and
                    such).  A better construct than $* would be ${1+"$@"}, but
                    it does not work if the script is being interpreted by
                    csh(1).

Sounds like it doesn't really make sense on the command line, like here, but when using Open3.capture2e it makes more sense?

How did you find this PR @jeffwidman? :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stumbled across it while researching dependabot/dependabot-core#12025 😄

jeffwidman added a commit to dependabot/dependabot-core that referenced this pull request Apr 10, 2025
This adds sigstore attestations for our published gems.

We do not need to provide an OIDC token to the sigstore client because
by default it will request the token from the GitHub Actions environment:
https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68

The code inspiration for this change came from:
* 84codes/rubocop-eightyfourcodes#16
* rubygems/release-gem#11

You can see an example of how this attestation will look on RubyGems here:
https://rubygems.org/gems/sigstore/versions/0.2.1
jeffwidman added a commit to dependabot/dependabot-core that referenced this pull request Apr 10, 2025
This adds sigstore attestations for our published gems.

We do not need to provide an OIDC token to the sigstore client because
by default it will request the token from the GitHub Actions environment:
https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68

The code inspiration for this change came from:
* 84codes/rubocop-eightyfourcodes#16
* rubygems/release-gem#11

You can see an example of how this attestation will look on RubyGems here:
https://rubygems.org/gems/sigstore/versions/0.2.1

Co-authored-by: Nish Sinha <nishnha@github.com>
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