Skip to content

Commit d074fee

Browse files
ci: fix Docker GHA caching and add merge_group trigger (#1101)
## Summary Docker GHA caching (`type=gha`) was already in both CI workflows, but three issues made it less effective than it should be. ## Changes ### `PR-Build-And-Test.yml` **Add `merge_group` trigger** Docker validation and tests were not running in the GitHub merge queue, meaning a merge could pass without a final Docker build check. Adding `merge_group:` ensures the same validation that runs on PRs also runs before merge. **Replace tar export with `push: false`** The Docker step was exporting the image to a `.tar` file (`outputs: type=docker,dest=...`) but that file was never uploaded as an artifact and never used by any downstream job. Exporting to a tar forces BuildKit to fully extract all image layers to disk — adding unnecessary time and disk I/O. Replacing it with `push: false` skips the extraction while still writing all layers to the GHA cache. ### `Build-Test-And-Deploy.yml` **Remove dead "Docker build (no push)" step** The step had this condition: ```yaml if: github.event_name == 'pull_request' || github.event_name == 'merge_group' ``` But this workflow only triggers on `push: branches: [main]` and `workflow_dispatch` — so that condition can never be true. The step was dead code. PR and merge_group Docker validation is now correctly owned by `PR-Build-And-Test.yml` (via the `merge_group` trigger added above). ## Before / After | Workflow | Before | After | |---|---|---| | PR Docker build | Exports unused tar, no merge queue coverage | `push: false`, runs on merge queue too | | Main Docker build | Has unreachable dead step | Dead step removed; caching unchanged | Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c23d291 commit d074fee

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

.github/workflows/Build-Test-And-Deploy.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ jobs:
6363
- name: Set up Docker Buildx
6464
uses: docker/setup-buildx-action@v4
6565

66-
# Build but no push with a PR
67-
- name: Docker build (no push)
68-
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
69-
uses: docker/build-push-action@v7
70-
with:
71-
push: false
72-
tags: temp-pr-validation
73-
file: ./EssentialCSharp.Web/Dockerfile
74-
context: .
75-
build-args: ACCESS_TO_NUGET_FEED=false
76-
7766
# Only build for dev registry — prod gets the image via az acr import in deploy-production
7867
- name: Build Container Image
7968
if: github.event_name != 'pull_request_target' && github.event_name != 'pull_request'

.github/workflows/PR-Build-And-Test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: PR Build and Test EssentialCSharp.Web
33
on:
44
pull_request:
55
branches: ["main"]
6+
merge_group:
67
workflow_dispatch:
78

89
jobs:
@@ -67,7 +68,7 @@ jobs:
6768
with:
6869
file: ./EssentialCSharp.Web/Dockerfile
6970
context: .
70-
outputs: type=docker,dest=${{ github.workspace }}/essentialcsharpwebimage.tar
71+
push: false
7172
cache-from: type=gha
7273
cache-to: type=gha,mode=max
7374
build-args: ACCESS_TO_NUGET_FEED=false

0 commit comments

Comments
 (0)