Skip to content

Conversation

@apesternikov
Copy link
Contributor

@apesternikov apesternikov commented Aug 31, 2024

Mirror always verify for remote image availability in a generated test to make sure we catch errors in image location or digest earlier.
However, the goal of the mirror was to increase external images availability if they suddenly disappear. The test should not fail in this case.
This PR modifies test to check local image if remote does not exist.
Also, it add more integration testing for mirroring

Comment on lines +5 to +7
${REGISTRY_BIN}&
registry_pid=$!
trap "kill -9 $registry_pid" EXIT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script starts a background process for ${REGISTRY_BIN} and sets a trap to kill it on exit. However, using kill -9 is generally discouraged because it does not allow the process to clean up. A gentler signal like TERM should be used first.

Recommendation: Replace kill -9 $registry_pid with kill $registry_pid to allow the process to terminate gracefully. If the process does not terminate, then consider using kill -9 as a fallback.

REMOTE="{src_image}"
LOCAL="{dst_image}@{digest}"
echo "Validating images $REMOTE and $LOCAL"
{crane_tool} validate -v --fast --remote $REMOTE || {crane_tool} validate -v --fast --remote $LOCAL || exit 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current validation logic does not provide specific error messages for each validation failure. This can make debugging difficult as it is unclear which image validation failed.

Recommended Solution:
Update the script to provide specific error messages for each validation failure. For example:

{crane_tool} validate -v --fast --remote $REMOTE || { echo "Validation failed for remote image: $REMOTE"; exit 1; }
{crane_tool} validate -v --fast --remote $LOCAL || { echo "Validation failed for local image: $LOCAL"; exit 1; }

@apesternikov apesternikov merged commit d358aba into main Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants