-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RELEASE-1245): make publish index image task idempotent
Signed-off-by: Happy Bhati <[email protected]>
- Loading branch information
1 parent
d6c5232
commit e7f5a58
Showing
3 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
|
||
# mocks to be injected into task step scripts | ||
|
||
function skopeo() { | ||
echo Mock skopeo called with: $* >&2 | ||
echo Mock skopeo called with: "$*" >&2 | ||
|
||
# Handle "skopeo inspect" for a failing case | ||
if [[ "$*" == *"inspect --tls-verify=false docker://registry-proxy.engineering.redhat.com/fail --format '{{.Digest}}'"* ]]; then | ||
echo "Mock failure: Image does not exist" >&2 | ||
return 1 | ||
|
||
if [[ "$*" == *"--src-tls-verify=false --src-creds source docker://quay.io/source"* ]] | ||
then | ||
# Handle "skopeo inspect" for a successful case | ||
elif [[ "$*" == *"inspect --tls-verify=false docker://registry-proxy.engineering.redhat.com/foo --format '{{.Digest}}'"* ]]; then | ||
echo "sha256:abcd1234" | ||
return 0 | ||
elif [[ "$*" == *"--src-tls-verify=false docker://registry-proxy.engineering.redhat.com/foo"* ]] | ||
then | ||
|
||
# Handle "skopeo inspect" for target image check | ||
elif [[ "$*" == *"inspect --tls-verify=false docker://quay.io/target --format '{{.Digest}}'"* ]]; then | ||
echo "sha256:xyz9876" | ||
return 0 | ||
elif [[ "$*" == *"--src-tls-verify=false docker://registry-proxy.engineering.redhat.com/fail"* ]] | ||
then | ||
return 1 | ||
|
||
# Handle "skopeo copy" | ||
elif [[ "$*" == *"skopeo copy"* ]]; then | ||
echo "Mock skopeo copy called with: $*" | ||
return 0 | ||
|
||
else | ||
echo Error: Unexpected call | ||
echo "Error: Unexpected call" | ||
exit 1 | ||
fi | ||
} |