Fix: Adapt release script for -e mode 68/74068/1
authorEric Ball <eball@linuxfoundation.org>
Wed, 21 Jan 2026 00:39:11 +0000 (16:39 -0800)
committerEric Ball <eball@linuxfoundation.org>
Wed, 21 Jan 2026 00:39:11 +0000 (16:39 -0800)
Testing did not reveal a flaw in the original code due to a lack of
the "-e" bash mode. With that enabled, the script fails if the
command isn't part of a conditional, or otherwise handled. In this
case, we use a bash OR to assign the non-zero exit code if the
command fails.

Change-Id: I474afec6ca711875cd7937088018d7bbf08d37f3
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
shell/release-job.sh

index 1c1e156..a11082b 100644 (file)
@@ -440,17 +440,17 @@ container_release_file(){
             echo "INFO: $VERSION is already released for image $name, checking signature..."
             image_digest=$(docker inspect --format='{{index .RepoDigests 0}}' \
                     "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION")
-            cosign verify --key "$COSIGN_PUBLIC_KEY" "$image_digest"
-            cosign_verified=$?
-            if [ "$cosign_verified" -eq 0 ]; then
+            exit_code=0
+            cosign verify --key "$COSIGN_PUBLIC_KEY" "$image_digest" || exit_code=$?
+            if [ "$exit_code" -eq 0 ]; then
                 echo "INFO: $name:$VERSION is already signed, continuing..."
-            elif [ "$cosign_verified" -eq 10 ] && [[ "$JOB_NAME" =~ "merge" ]]; then
+            elif [ "$exit_code" -eq 10 ] && [[ "$JOB_NAME" =~ "merge" ]]; then
                 # Exit code 10 indicates the package was found without signature
                 echo "INFO: No signature found for $name:$VERSION. Attempting to sign..."
                 export COSIGN_PASSWORD
                 cosign sign -y --key "$COSIGN_PRIVATE_KEY" "$image_digest"
             else
-                echo "INFO: Could not verify signature, cosign exited with code $cosign_verified."
+                echo "INFO: Could not verify signature, cosign exited with code $exit_code."
             fi
         else
             echo "INFO: $VERSION not found in releases, release will be prepared. Continuing..."