Skip to content

Commit c883e78

Browse files
committed
Always pull latest image and serialize publishes per image tag
pull_or_build_image() only pulled/built when the image was entirely absent locally, so any node with a cached tag kept running stale code indefinitely even after CI published a newer image. It now always pulls first, falling back to the local image or a build only if the registry is unreachable. publish.yml had no concurrency guard, so near-simultaneous pushes to master (e.g. two PRs merged in quick succession) could race to push the same :latest tag, and whichever job finished last won regardless of commit order - this is what caused #169's header-dedup fix to be silently overwritten by #168's slower-finishing publish job. Adding a per-image concurrency group serializes those pushes so the newest commit always publishes last.
1 parent 7973cd9 commit c883e78

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
permissions:
1515
contents: "read"
1616
packages: "write"
17+
concurrency:
18+
group: "publish-${{ matrix.image }}"
19+
cancel-in-progress: false
1720
strategy:
1821
fail-fast: false
1922
matrix:

src/container.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ def __init__(self, container: str | None) -> None:
103103
@staticmethod
104104
def pull_or_build_image(client: docker.client.DockerClient, image: str, build_context: str) -> None:
105105
try:
106-
client.images.get(image)
107-
except docker.errors.ImageNotFound:
106+
client.images.pull(image)
107+
except (docker.errors.DockerException, requests.exceptions.RequestException):
108108
try:
109-
client.images.pull(image)
110-
except (docker.errors.DockerException, requests.exceptions.RequestException):
109+
client.images.get(image)
110+
except docker.errors.ImageNotFound:
111111
client.images.build(path=build_context, tag=image)
112112

113113
def run_command_on_the_container(

0 commit comments

Comments
 (0)