@@ -29,8 +29,13 @@ def get_cli_params(
29
29
bundle_path : Optional [Path ] = None ,
30
30
signature_path : Optional [Path ] = None ,
31
31
certificate_path : Optional [Path ] = None ,
32
+ trust_config_path : Optional [Path ] = None ,
32
33
) -> list [str ]:
33
- cli_params = ["--staging" , "sign" ]
34
+ if trust_config_path is not None :
35
+ cli_params = ["--trust-config" , str (trust_config_path ), "sign" ]
36
+ else :
37
+ cli_params = ["--staging" , "sign" ]
38
+
34
39
if output_directory is not None :
35
40
cli_params .extend (["--output-directory" , str (output_directory )])
36
41
if bundle_path is not None :
@@ -116,6 +121,47 @@ def test_sign_success_multiple_artifacts(capsys, sigstore, asset_integration):
116
121
)
117
122
118
123
124
+ @pytest .mark .staging
125
+ @pytest .mark .ambient_oidc
126
+ def test_sign_success_multiple_artifacts_rekor_v2 (capsys , sigstore , asset_integration , asset ):
127
+ """This is a copy of test_sign_success_multiple_artifacts that exists to ensure the
128
+ multi-threaded signing works with rekor v2 as well: this test can be removed when v2
129
+ is the default
130
+ """
131
+
132
+ artifacts = [
133
+ asset_integration ("a.txt" ),
134
+ asset_integration ("b.txt" ),
135
+ asset_integration ("c.txt" ),
136
+ ]
137
+
138
+ sigstore (
139
+ * get_cli_params (
140
+ artifact_paths = artifacts ,
141
+ trust_config_path = asset ("trust_config/staging-but-sign-with-rekor-v2.json" )
142
+ )
143
+ )
144
+
145
+ captures = capsys .readouterr ()
146
+
147
+ for artifact in artifacts :
148
+ expected_output_bundle = Path (f"{ artifact } .sigstore.json" )
149
+
150
+ assert f"Sigstore bundle written to { expected_output_bundle } \n " in captures .out
151
+
152
+ assert expected_output_bundle .exists ()
153
+ verifier = Verifier .staging ()
154
+ with (
155
+ open (expected_output_bundle , "r" ) as bundle_file ,
156
+ open (artifact , "rb" ) as input_file ,
157
+ ):
158
+ bundle = Bundle .from_json (bundle_file .read ())
159
+ expected_output_bundle .unlink ()
160
+ verifier .verify_artifact (
161
+ input_ = input_file .read (), bundle = bundle , policy = UnsafeNoOp ()
162
+ )
163
+
164
+
119
165
@pytest .mark .staging
120
166
@pytest .mark .ambient_oidc
121
167
def test_sign_success_custom_outputs (capsys , sigstore , asset_integration , tmp_path ):
0 commit comments