Skip to content

Commit 5f8f719

Browse files
committed
feat: leverage retry-action to increase reliability of builds.
1 parent 58dc41a commit 5f8f719

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

.github/workflows/build.yml

+25-18
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,18 @@ jobs:
147147
148148
- name: Get current version
149149
id: labels
150-
shell: bash
151-
run: |
152-
set -eo pipefail
153-
ver=$(skopeo inspect docker://quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
154-
if [ -z "$ver" ] || [ "null" = "$ver" ]; then
155-
echo "inspected image version must not be empty or null"
156-
exit 1
157-
fi
158-
echo "VERSION=$ver" >> $GITHUB_OUTPUT
150+
uses: Wandalen/[email protected]
151+
with:
152+
attempt_limit: 3
153+
attempt_delay: 15000
154+
command: |
155+
set -eo pipefail
156+
ver=$(skopeo inspect docker://quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
157+
if [ -z "$ver" ] || [ "null" = "$ver" ]; then
158+
echo "inspected image version must not be empty or null"
159+
exit 1
160+
fi
161+
echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV
159162
160163
# Generate image metadata
161164
- name: Image Metadata
@@ -166,7 +169,7 @@ jobs:
166169
${{ env.IMAGE_NAME }}
167170
labels: |
168171
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
169-
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
172+
org.opencontainers.image.version=${{ env.SOURCE_IMAGE_VERSION }}
170173
org.opencontainers.image.description=A base Universal Blue ${{ matrix.image_name }} image with batteries included
171174
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
172175
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4
@@ -201,20 +204,24 @@ jobs:
201204
string: ${{ env.IMAGE_REGISTRY }}
202205

203206
- name: Push To GHCR
204-
uses: redhat-actions/push-to-registry@v2
207+
uses: Wandalen/[email protected]
205208
id: push
206209
if: github.event_name != 'pull_request'
207210
env:
208211
REGISTRY_USER: ${{ github.actor }}
209212
REGISTRY_PASSWORD: ${{ github.token }}
210213
with:
211-
image: ${{ steps.build_image.outputs.image }}
212-
tags: ${{ steps.build_image.outputs.tags }}
213-
registry: ${{ steps.registry_case.outputs.lowercase }}
214-
username: ${{ env.REGISTRY_USER }}
215-
password: ${{ env.REGISTRY_PASSWORD }}
216-
extra-args: |
217-
--disable-content-trust
214+
action: redhat-actions/push-to-registry@v2
215+
attempt_limit: 3
216+
attempt_delay: 15000
217+
with: |
218+
image: ${{ steps.build_image.outputs.image }}
219+
tags: ${{ steps.build_image.outputs.tags }}
220+
registry: ${{ steps.registry_case.outputs.lowercase }}
221+
username: ${{ env.REGISTRY_USER }}
222+
password: ${{ env.REGISTRY_PASSWORD }}
223+
extra-args: |
224+
--disable-content-trust
218225
219226
- name: Login to GitHub Container Registry
220227
uses: docker/login-action@v3

0 commit comments

Comments
 (0)