Skip to content

Commit a39cabe

Browse files
authored
Run deploy after build-images to fix image pull race (#781)
1 parent 17686ab commit a39cabe

3 files changed

Lines changed: 16 additions & 39 deletions

File tree

.github/workflows/build-images.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ name: Build images (chartpress)
88
# registry before a deploy references them.
99

1010
on:
11+
# Runs on every push, no path filter. This is the single entry point for a
12+
# deploy: deploy-eks and deploy-k3s only fire via workflow_run once this
13+
# finishes, so the images are always in the registry before a deploy uses
14+
# them. chartpress skips the rebuild when nothing under images/** changed
15+
# (tags come from git history), so config-only pushes stay cheap.
1116
push:
1217
branches:
1318
- 'main'
1419
- 'staging'
1520
- 'deploy-*'
1621
- 'build-*'
17-
- 'k3s'
18-
paths:
19-
# chartpress.yaml and Chart.yaml are shared deps: changing them rebumps
20-
# every image tag, so the build must run to push images at the new tag.
21-
- 'images/**'
22-
- 'chartpress.yaml'
23-
- 'ohm/Chart.yaml'
2422
workflow_dispatch:
2523

2624
jobs:

.github/workflows/deploy-eks.yaml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: Deploy EKS
33
# Deploys the ohm/ chart to AWS EKS.
44
#
55
# Triggers:
6-
# - workflow_run: after "Build images (chartpress)" finishes, so the
7-
# images are already in ghcr.io before we reference them.
8-
# - push (paths-ignore images/**): config-only changes, no build needed.
9-
# - workflow_dispatch: manual deploy of a branch. NOTE: for a commit
10-
# that changed images/**, build-images must have run first so the
11-
# image exists in the registry.
6+
# - workflow_run: the only automatic trigger. A push runs build-images
7+
# first, which triggers this on success, so the images are always in
8+
# ghcr.io before we use them — even when a commit changes both config
9+
# and images.
10+
# - workflow_dispatch: manual deploy of a branch. For a commit that changed
11+
# images/**, build-images must have run first so the image exists.
1212
#
1313
# The deploy runs `chartpress --skip-build` itself to rewrite the
1414
# image tags in ohm/values.yaml. The tags are derived from git history,
@@ -19,20 +19,10 @@ on:
1919
workflow_run:
2020
workflows: ['Build images (chartpress)']
2121
types: [completed]
22-
branches:
23-
- main
24-
- staging
25-
push:
2622
branches:
2723
- main
2824
- staging
2925
- deploy-*
30-
# images/**, chartpress.yaml and Chart.yaml rebump image tags, so they
31-
# must go through "Build images" first and reach deploy via workflow_run.
32-
paths-ignore:
33-
- 'images/**'
34-
- 'chartpress.yaml'
35-
- 'ohm/Chart.yaml'
3626
workflow_dispatch:
3727
inputs:
3828
ref:

.github/workflows/deploy-k3s.yaml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Deploy k3s
22

33
on:
4-
# Images changed: wait for "Build images (chartpress)" to finish, then
5-
# deploy. The deploy re-runs `chartpress --skip-build` to recompute the
6-
# same tags build pushed (no artifact is passed between workflows).
4+
# Deploy only after "Build images (chartpress)" finishes, never on push
5+
# directly. A push runs build-images, which triggers this on success. That
6+
# way the images always exist in the registry before the deploy uses them,
7+
# even when a commit touches both config and images. The deploy re-runs
8+
# `chartpress --skip-build` to recompute the same tags build pushed.
79
workflow_run:
810
workflows: ['Build images (chartpress)']
911
types: [completed]
@@ -12,19 +14,6 @@ on:
1214
- pre-production
1315
- staging
1416
- k3s
15-
# Config-only changes that do NOT rebump image tags: deploy directly.
16-
# images/**, chartpress.yaml and Chart.yaml change tags, so they must go
17-
# through "Build images" first and reach deploy via workflow_run.
18-
push:
19-
branches:
20-
- main
21-
- pre-production
22-
- staging
23-
- k3s
24-
paths-ignore:
25-
- 'images/**'
26-
- 'chartpress.yaml'
27-
- 'ohm/Chart.yaml'
2817
workflow_dispatch:
2918
inputs:
3019
ref:

0 commit comments

Comments
 (0)