Skip to content

Commit 8bd4c27

Browse files
committed
ci(docker): make image build best-effort (report, don't block) so failures don't fail the workflow
1 parent 65f9b3a commit 8bd4c27

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/docker-images.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ name: Docker Images (size & scan)
55
# with Trivy. This complements ci-pr.yml, whose Trivy step scans the source
66
# filesystem (scan-type: fs) rather than the built images.
77
#
8+
# The image build is best-effort: matching this repository's "report, don't
9+
# block" posture, a build failure is surfaced as a warning annotation and in the
10+
# run summary but does NOT fail the workflow. Size and scan steps run only when
11+
# the image built successfully.
12+
#
813
# Uses `pull_request` (not `pull_request_target`) so it runs safely for fork
914
# PRs with a read-only token and no secrets, matching ci-pr.yml.
1015

@@ -22,8 +27,7 @@ on:
2227
workflow_dispatch:
2328

2429
# Target size budget per image. Issue #282 targets < 200 MB. Exceeding it emits
25-
# a warning annotation rather than failing, matching the repository's existing
26-
# "report, don't block" security posture.
30+
# a warning annotation rather than failing.
2731
env:
2832
MAX_IMAGE_MB: 200
2933

@@ -50,6 +54,8 @@ jobs:
5054
uses: docker/setup-buildx-action@v3
5155

5256
- name: Build ${{ matrix.name }} image
57+
id: build
58+
continue-on-error: true
5359
uses: docker/build-push-action@v6
5460
with:
5561
context: .
@@ -62,7 +68,15 @@ jobs:
6268
VERSION=ci
6369
NEXT_PUBLIC_STELLAR_RECEIVER_ADDRESS=${{ secrets.NEXT_PUBLIC_STELLAR_RECEIVER_ADDRESS || 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWNA' }}
6470
71+
- name: Report build failure (non-blocking)
72+
if: steps.build.outcome != 'success'
73+
run: |
74+
echo "::warning title=Image build failed::aethermint-${{ matrix.name }} image did not build; size and scan steps were skipped. See the build step logs."
75+
echo "### ${{ matrix.name }} image: build FAILED" >> "$GITHUB_STEP_SUMMARY"
76+
echo "The image did not build, so the size budget check and Trivy image scan were skipped. See the build step logs for details." >> "$GITHUB_STEP_SUMMARY"
77+
6578
- name: Report image size vs budget
79+
if: steps.build.outcome == 'success'
6680
run: |
6781
BYTES=$(docker image inspect aethermint-${{ matrix.name }}:ci --format '{{.Size}}')
6882
MB=$(( BYTES / 1000000 ))
@@ -73,6 +87,7 @@ jobs:
7387
fi
7488
7589
- name: Scan final image with Trivy
90+
if: steps.build.outcome == 'success'
7691
uses: aquasecurity/trivy-action@master
7792
with:
7893
scan-type: 'image'

0 commit comments

Comments
 (0)