@@ -16,24 +16,6 @@ function full-image-ref() {
1616 echo " $url @$digest "
1717}
1818
19- # For example quay.io
20- function image-registry() {
21- local url=$( cat $BASE_RESULTS /buildah-rhtap/IMAGE_URL)
22- echo " ${url/ \/ */ } "
23- }
24-
25- # Cosign can use the same credentials as buildah
26- function cosign-login() {
27- local image_registry=" $( image-registry) "
28- prepare-registry-user-pass $image_registry
29- cosign login --username=" $IMAGE_REGISTRY_USER " --password=" $IMAGE_REGISTRY_PASSWORD " " $image_registry "
30- ERR=$?
31- if [ $ERR != 0 ]; then
32- echo " Failed cosign login $image_registry for user $IMAGE_REGISTRY_USER "
33- exit $ERR
34- fi
35- }
36-
3719# A wrapper for running cosign used for both sign and attest.
3820# Handles the password, the key, the rekor options, etc.
3921function cosign-cmd() {
@@ -75,12 +57,18 @@ function create-att-predicate() {
7557 source " $SCRIPTDIR /att-predicate-$CI_TYPE .sh"
7658}
7759
60+ # Login to registry using cosign.
61+ function login() {
62+ echo " Running $TASK_NAME :login"
63+ local url=$( cat $BASE_RESULTS /buildah-rhtap/IMAGE_URL)
64+ registry-login " ${url} "
65+ }
66+
7867# Sign the image using cosign.
7968# Signing secret key and password should be base64 encoded in environment
8069# vars COSIGN_SECRET_PASSWORD and COSIGN_SECRET_KEY.
8170function sign() {
8271 echo " Running $TASK_NAME :sign"
83- cosign-login
8472 cosign-cmd sign
8573}
8674
@@ -108,6 +96,7 @@ function show-public-key() {
10896}
10997
11098# Task Steps
99+ login
111100sign
112101attest
113102show-rekor-url
0 commit comments