Skip to content

Commit f106999

Browse files
authored
Run smoketest as part of CI (#147)
It failing only on release is too difficult to debug Signed-off-by: Samuel Giddins <[email protected]>
1 parent 048e1bd commit f106999

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,44 @@ jobs:
146146
token: ${{ secrets.CODECOV_TOKEN }}
147147
slug: sigstore/sigstore-ruby
148148

149+
smoketest:
150+
needs: ruby-versions
151+
runs-on: ubuntu-latest
152+
name: Smoketest
153+
permissions:
154+
id-token: write
155+
strategy:
156+
fail-fast: false
157+
matrix:
158+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
159+
os: [ubuntu-latest]
160+
steps:
161+
- name: Harden Runner
162+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
163+
with:
164+
egress-policy: audit
165+
166+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
167+
with:
168+
persist-credentials: false
169+
- name: Set up Ruby
170+
uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0 # v1.197.0
171+
with:
172+
ruby-version: ${{ fromJson(needs.ruby-versions.outputs.latest) }}
173+
bundler-cache: true
174+
- name: Build the gem
175+
run: bin/rake build
176+
- name: Run the smoketest
177+
run: |
178+
# we smoke-test sigstore by installing each of the distributions
179+
# we've built in a fresh environment and using each to sign and
180+
# verify for itself, using the ambient OIDC identity
181+
for dist in pkg/*; do
182+
./bin/smoketest "${dist}"
183+
done
184+
env:
185+
WORKFLOW_NAME: ci
186+
149187
all-tests-pass:
150188
if: always()
151189

bin/sigstore-ruby

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ module Sigstore
178178

179179
def collect_verification_state(files)
180180
if (options[:certificate] || options[:signature] || options[:bundle]) && files.size > 1
181-
raise Thor::InvocationError, "Too many arguments"
181+
raise Thor::InvocationError, "Too many files specified: #{files.inspect}"
182182
end
183183

184184
if options[:bundle] && (options[:certificate] || options[:signature])

bin/smoketest

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,20 @@ sh(env, File.expand_path("sigstore-ruby", __dir__),
4242
exception: true)
4343

4444
cert_identity = "#{ENV.fetch("GITHUB_SERVER_URL")}/#{ENV.fetch("GITHUB_REPOSITORY")}" \
45-
"/.github/workflows/release-with-provenance.yml@#{ENV.fetch("GITHUB_REF")}"
45+
"/.github/workflows/#{ENV.fetch("WORKFLOW_NAME", "release")}.yml@#{ENV.fetch("GITHUB_REF")}"
4646

4747
sh(env, File.expand_path("sigstore-ruby", __dir__),
48-
"verify", dist,
48+
"verify",
4949
"--signature=smoketest-artifacts/#{File.basename(dist)}.sig",
5050
"--certificate=smoketest-artifacts/#{File.basename(dist)}.crt",
51-
"--cert-oidc-issuer=https://token.actions.githubusercontent.com",
52-
"--cert-identity=#{cert_identity}",
51+
"--certificate-oidc-issuer=https://token.actions.githubusercontent.com",
52+
"--certificate-identity=#{cert_identity}",
53+
dist,
5354
exception: true)
5455
sh(env, File.expand_path("sigstore-ruby", __dir__),
55-
"verify", dist,
56+
"verify",
5657
"--bundle=smoketest-artifacts/#{File.basename(dist)}.sigstore.json",
57-
"--cert-oidc-issuer=https://token.actions.githubusercontent.com",
58-
"--cert-identity=#{cert_identity}",
58+
"--certificate-oidc-issuer=https://token.actions.githubusercontent.com",
59+
"--certificate-identity=#{cert_identity}",
60+
dist,
5961
exception: true)

0 commit comments

Comments
 (0)