Skip to content

Commit 35fff1e

Browse files
authored
Add rekor-version argument (#228)
1 parent be60bbe commit 35fff1e

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.github/workflows/selftest.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ jobs:
150150
inputs: ./test/artifact.txt
151151
staging: true
152152
internal-be-careful-debug: true
153+
- name: Sign artifact with non-default rekor-version and publish signature
154+
uses: ./
155+
with:
156+
inputs: ./test/artifact2.txt
157+
staging: true
158+
rekor-version: 1
159+
internal-be-careful-debug: true
153160
- name: Check outputs
154161
run: |
155162
[[ -f ./test/artifact.txt.sigstore.json ]] || exit 1

action.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ def _fatal_help(msg):
151151

152152
if os.getenv("GHA_SIGSTORE_PYTHON_STAGING", "false") != "false":
153153
sigstore_global_args.append("--staging")
154+
rekor_version_default = "2"
155+
else:
156+
rekor_version_default = "1"
157+
158+
rekor_version_env = os.getenv("GHA_SIGSTORE_PYTHON_REKOR_VERSION")
159+
if rekor_version_env == "":
160+
rekor_version = rekor_version_default
161+
elif rekor_version_env in ["1", "2"]:
162+
rekor_version = rekor_version_env
163+
else:
164+
_fatal_help(f"'{rekor_version_env}' is not a valid rekor-version")
165+
166+
sigstore_sign_args.extend(["--rekor-version", rekor_version])
154167

155168
verify_cert_identity = os.getenv("GHA_SIGSTORE_PYTHON_VERIFY_CERT_IDENTITY")
156169
if enable_verify and not verify_cert_identity:

action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ inputs:
3232
description: "the custom OpenID Connect client secret to use during OAuth2"
3333
required: false
3434
default: ""
35+
rekor-version:
36+
description: |
37+
The Rekor transparency log instance version used during signing. Valid values are [1, 2].
38+
Verifying clients must be compatible with the used Rekor version.
39+
40+
Default rekor-version is 1, except when `staging` is enabled: then default rekor-version is 2.
41+
required: false
42+
default: ""
3543
staging:
3644
description: "use sigstore's staging instances, instead of the default production instances"
3745
required: false
@@ -92,6 +100,7 @@ runs:
92100
GHA_SIGSTORE_PYTHON_IDENTITY_TOKEN: "${{ inputs.identity-token }}"
93101
GHA_SIGSTORE_PYTHON_OIDC_CLIENT_ID: "${{ inputs.oidc-client-id }}"
94102
GHA_SIGSTORE_PYTHON_OIDC_CLIENT_SECRET: "${{ inputs.oidc-client-secret }}"
103+
GHA_SIGSTORE_PYTHON_REKOR_VERSION: "${{ inputs.rekor-version }}"
95104
GHA_SIGSTORE_PYTHON_STAGING: "${{ inputs.staging }}"
96105
GHA_SIGSTORE_PYTHON_VERIFY: "${{ inputs.verify }}"
97106
GHA_SIGSTORE_PYTHON_VERIFY_CERT_IDENTITY: "${{ inputs.verify-cert-identity }}"

0 commit comments

Comments
 (0)