Draft
Conversation
msugakov
reviewed
Jan 27, 2026
Comment on lines
+34
to
+38
| raw_info="$(skopeo inspect \ | ||
| --retry-times 10 \ | ||
| --format '{{.Digest}} {{ index .Labels "vcs-ref" }} {{ index .Labels "source-location" }}' \ | ||
| --no-tags \ | ||
| "docker://$(params.IMAGE)")" |
Contributor
There was a problem hiding this comment.
If skopeo inspect here exits with no-zero, it will interrupt the script due to set -euo pipefail.
Demo:
$ foo="$(/bin/false)"
$ echo $?
1
$ foo="$(/bin/true)"
$ echo $?
0It's possible to assign in if:
#!/usr/bin/env bash
set -euo pipefail
if blah="pre-$(/bin/false)-post"; then
echo "success"
else
echo "failure"
fi
echo "blah:|$blah|"$ ./a.sh
failure
blah:|pre--post|Not the most elegant but can't offer anything better.
We need a sleep instruction here in case skopeo inspect exited with no-zero.
Comment on lines
+11
to
+14
| - name: DESIRED_GIT_REF | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.labels['pipelinesascode.tekton.dev/sha'] |
Contributor
There was a problem hiding this comment.
- Note that scanner v2, collector and fact images will have a different commit than the one in the executing stackrox/stackrox pipeline. Therefore, we need an ability to turn off this check for those containers.
- I suggest adding a short
description:here to say what the default thing does and how to turn it off.
| if [[ "${infos[1]}" == "$(params.DESIRED_GIT_REF)" ]]; then | ||
| break | ||
| else | ||
| >&2 echo "ERROR: The Git reference of the image $(params.IMAGE) does not match the desired Git reference $(params.DESIRED_GIT_REF)." |
Contributor
There was a problem hiding this comment.
[Subjective] Well, if it's an expected situation, calling it an error could be a bit of a stretch. Error is more for a situation we foresee but don't know how to handle. In this case, we do know how to handle: try wait more.
I suggest also reword to inform user why the script continues waiting.
Suggested change
| >&2 echo "ERROR: The Git reference of the image $(params.IMAGE) does not match the desired Git reference $(params.DESIRED_GIT_REF)." | |
| >&2 echo "WARNING: The found image $(params.IMAGE)${infos[0]} seems to be built for a different commit (${infos[1]}) than the one expected ($(params.DESIRED_GIT_REF)). This could happen for a tagged build when a git tag was moved and newly-triggered pipelines haven't finished yet. This task will keep waiting for the image with the matching tag to appear." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: https://redhat-internal.slack.com/archives/C05TS9N0S7L/p1765875791688849