Skip to content

Commit

Permalink
Add --retry-times to a skopeo commands
Browse files Browse the repository at this point in the history
Sometimes a registry returns an invalid code that causes a whole
pipeline to fail. Adding this flag should fix majority of these
temporary failures.

JIRA: ISV-4789

Signed-off-by: Ales Raszka <[email protected]>
  • Loading branch information
Allda committed Oct 7, 2024
1 parent a04a207 commit b1c32cb
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
for image in $(cat image-tags.txt); do
dest=$(echo -n $image | base64)
echo "Inspecting $image"
skopeo inspect --raw docker://$image > $dest.json
skopeo inspect --retry-times 5 --raw docker://$image > $dest.json
done
- name: get-digest-pull-specs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,21 @@ spec:
CONNECT_REPO_PATH="$(params.connect_registry)/$(params.vendor_label)/$(params.repo_name)"
skopeo copy \
--retry-times 5 \
--src-authfile $SRC_AUTHFILE \
--dest-authfile $DEST_AUTHFILE \
docker://$(params.src_image) \
docker://"$(params.dest_image_registry_namespace_certproject):$(params.dest_image_tag)"
skopeo copy \
--retry-times 5 \
--src-authfile $SRC_AUTHFILE \
--dest-authfile $DEST_AUTHFILE \
docker://$(params.src_image) \
docker://"$(params.dest_image_registry_namespace_certproject):latest"
DIGEST=$(skopeo inspect --authfile $DEST_AUTHFILE docker://$(params.dest_image_registry_namespace_certproject):$(params.dest_image_tag) | jq -r .Digest)
DIGEST=$(skopeo inspect --retry-times 5 --authfile $DEST_AUTHFILE docker://$(params.dest_image_registry_namespace_certproject):$(params.dest_image_tag) | jq -r .Digest)
echo -n $DIGEST | tee $(results.container_digest.path)
echo "- $CONNECT_REPO_PATH:$(params.dest_image_tag)" | tee "$RELEASE_INFO_DIR_PATH/released_bundle.txt"
echo -n "$CONNECT_REPO_PATH@${DIGEST}" > $(results.image_pullspec.path)
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
DIGEST=$(echo $i | awk -F '+' '{print $2}')
MANIFEST_LIST=$(skopeo inspect --raw docker://$DIGEST)
MANIFEST_LIST=$(skopeo inspect --retry-times 5 --raw docker://$DIGEST)
MANIFEST_LIST=$(echo $MANIFEST_LIST | jq -r '.manifests[].digest')
# create comma separated index images that match each digest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
IMAGE_PULL_SPEC="$(params.internal_registry)/$(params.internal_repository)@$(params.container_digest)"
skopeo inspect \
--retry-times 5 \
--no-tags \
--authfile $(workspaces.registry-credentials.path)/.dockerconfigjson \
docker://$IMAGE_PULL_SPEC > $(workspaces.image-data.path)/skopeo-inspect.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ spec:
# Add version tag to an index
skopeo \
--command-timeout 300s copy \
--retry-times 5 \
--format v2s2 --all \
--src-no-creds \
--dest-creds $QUAY_USER:$QUAY_TOKEN \
Expand All @@ -131,6 +132,7 @@ spec:
# Add permanent tag to an index
skopeo \
--command-timeout 300s copy \
--retry-times 5 \
--format v2s2 --all \
--src-no-creds \
--dest-creds $QUAY_USER:$QUAY_TOKEN \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
for tag in "${TAGS[@]}" ; do
skopeo copy \
--retry-times 5 \
--authfile "${AUTHFILE}" \
"docker://${REF}" \
"docker://${UNTAGGED_REF}:${tag}"
Expand Down
2 changes: 2 additions & 0 deletions operator-pipeline-images/operatorcert/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def copy_images_to_destination(
cmd = [
"skopeo",
"copy",
"--retry-times",
"5",
f"docker://{response.get('index_image_resolved')}",
f"docker://{destination}:{version}{tag_suffix}",
]
Expand Down
2 changes: 2 additions & 0 deletions operator-pipeline-images/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def test_copy_images_to_destination(mock_subprocess: MagicMock) -> None:
[
"skopeo",
"copy",
"--retry-times",
"5",
"docker://quay.io/qwe/asd@sha256:1234",
"docker://quay.io/foo/bar:v4.12-foo",
"--authfile",
Expand Down
2 changes: 2 additions & 0 deletions scripts/community-quay-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ def copy_tag(
cmd = [
"skopeo",
"copy",
"--retry-times",
"5",
f"docker://{QUAY_HOST}/{src_namespace}/{src_repo}:{src_tag}",
f"docker://{QUAY_HOST}/{dest_namespace}/{dest_repo}:{dest_tag}",
"--all",
Expand Down

0 comments on commit b1c32cb

Please sign in to comment.