Skip to content

Commit 1316fe3

Browse files
authored
Merge pull request #684 from sigstore/staging-conformance
add staging to conformance
2 parents 02ca8e7 + 7a1bd4a commit 1316fe3

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

.github/workflows/conformance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ on:
55
branches:
66
- '**'
77
pull_request:
8+
# TODO: add cron
89

910
jobs:
1011
conformance:
1112
strategy:
13+
max-parallel: 1
1214
matrix:
1315
java-version: [11, 17]
16+
sigstore-env: [production, staging]
1417
fail-fast: false
1518

1619
runs-on: ubuntu-latest
@@ -35,4 +38,5 @@ jobs:
3538
- uses: sigstore/sigstore-conformance@ee4de0e602873beed74cf9e49d5332529fe69bf6 # v0.0.11
3639
with:
3740
entrypoint: ${{ github.workspace }}/bin/sigstore-cli
41+
environment: ${{ matrix.sigstore-env }}
3842
xfail: "test_verify_dsse_bundle_with_trust_root"

sigstore-cli/src/main/java/dev/sigstore/cli/Sign.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public class Sign implements Callable<Integer> {
4141
@ArgGroup(multiplicity = "1", exclusive = true)
4242
SignatureFiles signatureFiles;
4343

44+
@Option(
45+
names = {"--staging"},
46+
description = "test against staging",
47+
required = false,
48+
defaultValue = "false")
49+
Boolean staging;
50+
4451
@Option(
4552
names = {"--identity-token"},
4653
description = "the OIDC identity token to use",
@@ -49,7 +56,10 @@ public class Sign implements Callable<Integer> {
4956

5057
@Override
5158
public Integer call() throws Exception {
52-
var signerBuilder = KeylessSigner.builder().sigstorePublicDefaults();
59+
var signerBuilder =
60+
staging
61+
? KeylessSigner.builder().sigstoreStagingDefaults()
62+
: KeylessSigner.builder().sigstorePublicDefaults();
5363
if (identityToken != null) {
5464
// If we've explicitly provided an identity token, customize the signer to only use the token
5565
// string OIDC client.

sigstore-cli/src/main/java/dev/sigstore/cli/Verify.java

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,27 @@ public class Verify implements Callable<Integer> {
5151
@ArgGroup(multiplicity = "0..1", exclusive = false)
5252
Policy policy;
5353

54-
@Option(
55-
names = {"--trusted-root"},
56-
description = "an alternative to the TUF managed sigstore public good trusted root",
57-
required = false)
58-
Path trustedRoot;
54+
@ArgGroup(multiplicity = "0..1", exclusive = true)
55+
Target target;
56+
57+
/**
58+
* Chose one trusted root provider target, (staging or prod or custom trusted_root), default is
59+
* prod.
60+
*/
61+
static class Target {
62+
@Option(
63+
names = {"--staging"},
64+
description = "test against staging",
65+
required = false,
66+
defaultValue = "false")
67+
Boolean staging;
68+
69+
@Option(
70+
names = {"--trusted-root"},
71+
description = "an alternative to the TUF managed sigstore public good trusted root",
72+
required = false)
73+
Path trustedRoot;
74+
}
5975

6076
static class Policy {
6177
@Option(
@@ -101,9 +117,11 @@ public Integer call() throws Exception {
101117
var verificationOptions = verificationOptionsBuilder.alwaysUseRemoteRekorEntry(false).build();
102118

103119
var verifier =
104-
(trustedRoot == null)
120+
target == null
105121
? new KeylessVerifier.Builder().sigstorePublicDefaults().build()
106-
: new KeylessVerifier.Builder().fromTrustedRoot(trustedRoot).build();
122+
: target.staging
123+
? new KeylessVerifier.Builder().sigstoreStagingDefaults().build()
124+
: new KeylessVerifier.Builder().fromTrustedRoot(target.trustedRoot).build();
107125
verifier.verify(
108126
artifact,
109127
KeylessVerificationRequest.builder()

0 commit comments

Comments
 (0)