Skip to content

Commit 32f1669

Browse files
Store the built Ruby commit sha in the github env
Previously we expected "docker run image" to return the ruby sha but it does not. When we build the tags for the manifest we try and fetch the commit hash from the environment, falling back to getting the latest commit from master if it's empty (which it will be in this case). So this means there is a window between when the image builds happen and when the deploy_multiarch job happens where if HEAD advances then a tagged image will be built containing the incorrect Ruby version. This is made more likely if there's a build failure (eg. for ephemeral apt reasons), because the time delta between the images are built and when deploy_multiarch gets the sha and creates the manifest gets larger. The effect of this bug can be seen by examining the output of the 20251202 image builds where: - The dated image is built with a particular sha - The commit tagged image doesn't exist - A tagged image from a later commit exists, and contains the actually built sha. ``` ❯ docker run -it rubylang/ruby:master-20251202 ruby -e 'puts RUBY_REVISION' 0e22108d60fbd0e338fb6e110ddd81a93b45b592 ~/git/docker-images master* ❯ docker run --rm rubylang/ruby:master-0e22108d60fbd0e338fb6e110ddd81a93b45b592 ruby -e 'puts RUBY_REVISION' Unable to find image 'rubylang/ruby:master-0e22108d60fbd0e338fb6e110ddd81a93b45b592' locally ~/git/docker-images master* ❯ docker run --rm rubylang/ruby:master-456ba321a84d34e76c8837ac96f47a11457480cb ruby -e 'puts RUBY_REVISION' 0e22108d60fbd0e338fb6e110ddd81a93b45b592 ```
1 parent 7212e3c commit 32f1669

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153

154154
# Make sure the sha of "master-{sha}" tags agrees with the RUBY_REVISION in the image
155155
- name: Extract ruby_sha
156-
run: echo "ruby_sha=$(docker run "$docker_image")" >> "$GITHUB_ENV"
156+
run: echo "ruby_sha=$(docker run "$docker_image" ruby -e 'puts RUBY_REVISION')" >> "$GITHUB_ENV"
157157
env:
158158
# In docker:manifest:create:
159159
# tags = ["master#{version_suffix}", ...] #=> "master${{ matrix.image_version_suffix }}"

0 commit comments

Comments
 (0)