@@ -100,23 +100,18 @@ runs:
100100 echo "Using Git SHA Short: $GIT_SHA_SHORT"
101101 FQN_GIT_SHA="${{ inputs.imageFQN }}:$GIT_SHA"
102102
103- # # This section currently doesn't account for the case where
104- # # a new image is being pushed to a repository for the first time.
105- # # As a workaround, when creating new images from this action,
106- # # the follwing four commented lines can be toggled with those below
107- # # them.
108- # echo "Image FQN with Git SHA: $FQN_GIT_SHA"
109- # df -h
110- # echo "Image $FQN_GIT_SHA does not exist. Building."
111- # nix-channel --update
112- # podman manifest inspect docker.io/library/flocken:latest || true
113- # podman manifest inspect quay.io/flocken:latest || true
114- # ${{ inputs.nixCommand }}
103+ echo "Image FQN with Git SHA: $FQN_GIT_SHA"
104+ df -h
115105
106+ # Check if image exists,
107+ # handle both 404 (manifest unknown) and 403 (forbidden) errors
108+ # which can occur when the image or repository doesn't exist yet
116109 if SKOPEO_OUTPUT=$(skopeo inspect "docker://$FQN_GIT_SHA" 2>&1); then
117110 echo "Image $FQN_GIT_SHA already exists. Skipping build."
118111 else
119- if echo "$SKOPEO_OUTPUT" | grep -q 'manifest unknown'; then
112+ if echo "$SKOPEO_OUTPUT" | grep -q 'manifest unknown' || \
113+ echo "$SKOPEO_OUTPUT" | grep -q 'invalid status code from registry 403' || \
114+ echo "$SKOPEO_OUTPUT" | grep -q 'invalid status code from registry 404'; then
120115 echo "Image $FQN_GIT_SHA does not exist. Building."
121116 nix-channel --update
122117 podman manifest inspect docker.io/library/flocken:latest || true
0 commit comments