Skip to content

Commit e79e938

Browse files
committed
Tossing out actions/cache
1 parent b494576 commit e79e938

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

twostep-container-build/action.yml

+17-14
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,6 @@ runs:
119119
echo "tag=${{ steps.branch-name.outputs.branch }}" >> $GITHUB_OUTPUT
120120
fi
121121
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-
131122
- name: Login to the Container Registry
132123
if: inputs.registry != ''
133124
uses: docker/login-action@v3
@@ -136,13 +127,25 @@ runs:
136127
username: ${{ inputs.username }}
137128
password: ${{ inputs.password }}
138129

139-
- name: Pulling the image
140-
if: steps.cache.outputs.cache-hit == 'true'
130+
- name: Checking if the image exists
141131
id: pull-image
142132
shell: bash
143133
run: |
144134
# 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: |
146149
147150
# Inspecting the image
148151
docker inspect \
@@ -156,10 +159,10 @@ runs:
156159
echo "https://github.com/CDCgov/cfa-actions/issues/10."
157160
158161
echo "Rebuilding the image..."
159-
echo "image-found=false" >> $GITHUB_OUTPUT
162+
echo "cache-hit=false" >> $GITHUB_OUTPUT
160163
else
161164
echo "Cache hash matches (all good!)."
162-
echo "image-found=true" >> $GITHUB_OUTPUT
165+
echo "cache-hit=true" >> $GITHUB_OUTPUT
163166
fi
164167
165168
- name: Build and push

0 commit comments

Comments
 (0)