@@ -119,15 +119,6 @@ runs:
119
119
echo "tag=${{ steps.branch-name.outputs.branch }}" >> $GITHUB_OUTPUT
120
120
fi
121
121
122
- - name : Check cache for base image
123
- uses : actions/cache@v4
124
- id : cache
125
- with :
126
- key : ${{ inputs.first-step-cache-key }}
127
- lookup-only : true
128
- path :
129
- ${{ inputs.container-file-1 }}
130
-
131
122
- name : Login to the Container Registry
132
123
if : inputs.registry != ''
133
124
uses : docker/login-action@v3
@@ -136,13 +127,25 @@ runs:
136
127
username : ${{ inputs.username }}
137
128
password : ${{ inputs.password }}
138
129
139
- - name : Pulling the image
140
- if : steps.cache.outputs.cache-hit == 'true'
130
+ - name : Checking if the image exists
141
131
id : pull-image
142
132
shell : bash
143
133
run : |
144
134
# Ensuring we can pull the image, if cache exists
145
- docker pull ${{ inputs.registry }}${{ inputs.image }}:dependencies-${{ steps.image-tag.outputs.tag }}
135
+ docker pull ${{ inputs.registry }}${{ inputs.image }}:dependencies-${{ steps.image-tag.outputs.tag }} || \
136
+ export IMAGE_NOT_FOUND=tue
137
+
138
+ if [ -n "$IMAGE_NOT_FOUND" ]; then
139
+ echo "image-found=false" >> $GITHUB_OUTPUT
140
+ else
141
+ echo "image-found=true" >> $GITHUB_OUTPUT
142
+ fi
143
+
144
+ - name : Checking if matches cache
145
+ if : steps.pull-image.image-found == 'true'
146
+ id : cache
147
+ shell : bash
148
+ run : |
146
149
147
150
# Inspecting the image
148
151
docker inspect \
@@ -156,10 +159,10 @@ runs:
156
159
echo "https://github.com/CDCgov/cfa-actions/issues/10."
157
160
158
161
echo "Rebuilding the image..."
159
- echo "image-found =false" >> $GITHUB_OUTPUT
162
+ echo "cache-hit =false" >> $GITHUB_OUTPUT
160
163
else
161
164
echo "Cache hash matches (all good!)."
162
- echo "image-found =true" >> $GITHUB_OUTPUT
165
+ echo "cache-hit =true" >> $GITHUB_OUTPUT
163
166
fi
164
167
165
168
- name : Build and push
0 commit comments