diff --git a/Makefile b/Makefile index 7efbdc13..61424580 100644 --- a/Makefile +++ b/Makefile @@ -95,14 +95,19 @@ docker-push: $(OCI_BIN) push ${TLS_SETTING} ${REGISTRY}/${IMG}:${IMAGE_TAG} @if skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} >/dev/null 2>&1; then \ echo "Tag '${IMAGE_GIT_TAG}' already exists. Skipping tagging and push."; \ + elif skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1 | grep -q "manifest unknown"; then \ + $(OCI_BIN) tag ${REGISTRY}/${IMG}:${IMAGE_TAG} ${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}; \ + $(OCI_BIN) push ${TLS_SETTING} ${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}; \ else \ - if skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1 | grep -q "manifest unknown"; then \ - $(OCI_BIN) tag ${REGISTRY}/${IMG}:${IMAGE_TAG} ${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}; \ - $(OCI_BIN) push ${TLS_SETTING} ${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}; \ - else \ - echo "Error checking for tag '${IMAGE_GIT_TAG}'. Aborting to avoid potential overwrite."; \ - exit 1; \ - fi; \ + echo "DEBUG: Unexpected error occurred while checking for tag '${IMAGE_GIT_TAG}'. Aborting."; \ + echo "DEBUG: skopeo version:"; \ + skopeo --version; \ + echo "DEBUG1: Running command: skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}"; \ + skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG}; \ + echo "DEBUG2: Running command: skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1"; \ + skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1; \ + echo "DEBUG3: Running command: skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1 | grep manifest"; \ + skopeo inspect docker://${REGISTRY}/${IMG}:${IMAGE_GIT_TAG} 2>&1 | grep "manifest"; \ fi cluster-up: