@@ -100,23 +100,18 @@ runs:
100
100
echo "Using Git SHA Short: $GIT_SHA_SHORT"
101
101
FQN_GIT_SHA="${{ inputs.imageFQN }}:$GIT_SHA"
102
102
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
115
105
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
116
109
if SKOPEO_OUTPUT=$(skopeo inspect "docker://$FQN_GIT_SHA" 2>&1); then
117
110
echo "Image $FQN_GIT_SHA already exists. Skipping build."
118
111
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
120
115
echo "Image $FQN_GIT_SHA does not exist. Building."
121
116
nix-channel --update
122
117
podman manifest inspect docker.io/library/flocken:latest || true
0 commit comments