Skip to content

Commit 7fb0132

Browse files
authored
Fix Docker meta not tagging images with latest (#7984)
## Summary - The `{{is_default_branch}}` template in `docker/metadata-action` was not resolving correctly when running inside a container directive (`GITHUB_EVENT_PATH does not exist`), causing the `-latest` tag to never be applied. - This meant images pushed on merge to main or workflow_dispatch only got the SHA tag (e.g., `cpu-x86_64-5c716ab`) but not the `latest` tag (e.g., `cpu-x86_64-latest`). - Remove the `enable={{is_default_branch}}` condition since the caller already gates `push: true` to non-PR events only. ## Failure - Here: https://github.com/pytorch/test-infra/actions/runs/24529169932/job/71707513243 the build and push is successful but the ``latest`` tag is not set hence Docker is not being picked up ## Test plan - [ ] Trigger workflow_dispatch and verify both `cpu-x86_64-<sha>` and `cpu-x86_64-latest` tags appear in the Docker meta output - [ ] Verify PR builds still don't push any tags
1 parent 5c716ab commit 7fb0132

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/workflows/_docker-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
latest=false
8080
tags: |
8181
type=sha,prefix=${{ matrix.variant_tag }}-,format=short
82-
type=raw,value=${{ matrix.variant_tag }}-latest,enable={{is_default_branch}}
82+
type=raw,value=${{ matrix.variant_tag }}-latest,enable=${{ github.ref == 'refs/heads/main' }}
8383
8484
- name: Build and push
8585
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2

0 commit comments

Comments
 (0)