Skip to content

Commit 2fd2640

Browse files
committed
Support non-regex build identity in params task
See related slack discussion: https://redhat-internal.slack.com/archives/C0A2WFPBR29/p1771940901598689 It's not 100% clear if the plan is to use the regex, or the string value for the certificate identity. I'm making an assumption about the configmap key value. (This might need tweaking in future, but I think that's okay. My goal is to get something that might work, with good test coverage, and then iterate as needed.) Ref: https://issues.redhat.com/browse/EC-1695
1 parent e2ccf37 commit 2fd2640

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/modules/ROOT/pages/collect-keyless-signing-params.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ allowing the pipeline to continue without signing parameters.
3333

3434
*tufExternalUrl*:: The external URL of the TUF repository.
3535

36+
*buildIdentity*:: The build identity from the OIDC token claims, if applicable.
37+
3638
*buildIdentityRegexp*:: A regular expression to extract build identity from the OIDC token claims, if applicable.
3739

3840
*keylessSigningEnabled*:: A flag indicating whether keyless signing is enabled based on the presence of signing parameters.

features/__snapshots__/task_validate_image.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ results.defaultOIDCIssuer: https://kubernetes.default.svc.cluster.local
604604
results.rekorExternalUrl: https://rekor.example.com
605605
results.fulcioExternalUrl: https://fulcio.example.com
606606
results.tufExternalUrl: https://tuf.example.com
607+
results.buildIdentity: https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller
607608
results.buildIdentityRegexp: ^https://konflux-ci.dev/.*$
608609

609610
---
@@ -616,6 +617,7 @@ results.defaultOIDCIssuer:
616617
results.rekorExternalUrl:
617618
results.fulcioExternalUrl:
618619
results.tufExternalUrl:
620+
results.buildIdentity:
619621
results.buildIdentityRegexp:
620622

621623
---
@@ -629,6 +631,7 @@ results.defaultOIDCIssuer:
629631
results.rekorExternalUrl:
630632
results.fulcioExternalUrl:
631633
results.tufExternalUrl:
634+
results.buildIdentity:
632635
results.buildIdentityRegexp:
633636

634637
---
@@ -642,6 +645,7 @@ results.defaultOIDCIssuer:
642645
results.rekorExternalUrl:
643646
results.fulcioExternalUrl:
644647
results.tufExternalUrl:
648+
results.buildIdentity:
645649
results.buildIdentityRegexp:
646650

647651
---

features/task_validate_image.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ Feature: Verify Enterprise Contract Tekton Tasks
468468
"rekorExternalUrl": "https://rekor.example.com",
469469
"fulcioExternalUrl": "https://fulcio.example.com",
470470
"tufExternalUrl": "https://tuf.example.com",
471+
"buildIdentity": "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller",
471472
"buildIdentityRegexp": "^https://konflux-ci.dev/.*$",
472473
"enableKeylessSigning": "true"
473474
}
@@ -480,6 +481,7 @@ Feature: Verify Enterprise Contract Tekton Tasks
480481
And the task result "rekorExternalUrl" should equal "https://rekor.example.com"
481482
And the task result "fulcioExternalUrl" should equal "https://fulcio.example.com"
482483
And the task result "tufExternalUrl" should equal "https://tuf.example.com"
484+
And the task result "buildIdentity" should equal "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller"
483485
And the task result "buildIdentityRegexp" should equal "^https://konflux-ci.dev/.*$"
484486
And the task result "keylessSigningEnabled" should equal "true"
485487

@@ -495,6 +497,7 @@ Feature: Verify Enterprise Contract Tekton Tasks
495497
"rekorExternalUrl": "https://rekor.example.com",
496498
"fulcioExternalUrl": "https://fulcio.example.com",
497499
"tufExternalUrl": "https://tuf.example.com",
500+
"buildIdentity": "https://kubernetes.io/namespaces/openshift-pipelines/serviceaccounts/tekton-chains-controller",
498501
"buildIdentityRegexp": "^https://konflux-ci.dev/.*$",
499502
"enableKeylessSigning": "false"
500503
}

tasks/collect-keyless-signing-params/0.1/collect-keyless-signing-params.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ spec:
6767
description: |
6868
The external URL of the TUF repository.
6969
70+
- name: buildIdentity
71+
type: string
72+
description: |
73+
The build identity from the OIDC token claims, if applicable.
74+
7075
- name: buildIdentityRegexp
7176
type: string
7277
description: |
@@ -103,6 +108,7 @@ spec:
103108
rekorExternalUrl=""
104109
fulcioExternalUrl=""
105110
tufExternalUrl=""
111+
buildIdentity=""
106112
buildIdentityRegexp=""
107113
108114
# Read from the ConfigMap
@@ -120,6 +126,7 @@ spec:
120126
rekorExternalUrl=$(jq -r '.data.rekorExternalUrl // ""' "$KFLX_CONFIG_PATH")
121127
fulcioExternalUrl=$(jq -r '.data.fulcioExternalUrl // ""' "$KFLX_CONFIG_PATH")
122128
tufExternalUrl=$(jq -r '.data.tufExternalUrl // ""' "$KFLX_CONFIG_PATH")
129+
buildIdentity=$(jq -r '.data.buildIdentity // ""' "$KFLX_CONFIG_PATH")
123130
buildIdentityRegexp=$(jq -r '.data.buildIdentityRegexp // ""' "$KFLX_CONFIG_PATH")
124131
else
125132
# Otherwise we ignore the reast of the ConfigMap
@@ -135,6 +142,7 @@ spec:
135142
echo -n "$rekorExternalUrl" > "$(results.rekorExternalUrl.path)"
136143
echo -n "$fulcioExternalUrl" > "$(results.fulcioExternalUrl.path)"
137144
echo -n "$tufExternalUrl" > "$(results.tufExternalUrl.path)"
145+
echo -n "$buildIdentity" > "$(results.buildIdentity.path)"
138146
echo -n "$buildIdentityRegexp" > "$(results.buildIdentityRegexp.path)"
139147
140148
# Output for troubleshooting/debugging
@@ -143,6 +151,7 @@ spec:
143151
echo "results.rekorExternalUrl: $rekorExternalUrl"
144152
echo "results.fulcioExternalUrl: $fulcioExternalUrl"
145153
echo "results.tufExternalUrl: $tufExternalUrl"
154+
echo "results.buildIdentity: $buildIdentity"
146155
echo "results.buildIdentityRegexp: $buildIdentityRegexp"
147156
env:
148157
- name: configMapNamespace

0 commit comments

Comments
 (0)