[FLINK-39796] Fix snapshot bake by pinning bake-action to local source#261
Merged
RocMarshal merged 1 commit intoMay 31, 2026
Merged
Conversation
bake-action v7 changed the default of an unset `source` input: it now
falls back to the workflow's git context and bakes it as a remote ref,
so buildx fetches docker-bake.hcl and the build context from the
triggering commit on master.
That breaks the snapshot workflow for two reasons:
1. master's docker-bake.hcl lacks the `target "docker-metadata-action" {}`
stub that every dev-* branch defines, so `inherits` fails with
`failed to find target docker-metadata-action`.
2. the snapshot Dockerfile is generated at runtime by add-custom.sh into
the local working tree and is not committed, so a remote bake context
could not find it anyway.
Setting `source: .` restores the pre-v7 behavior of baking the local
working tree (the checked-out dev-* branch), which has both the generated
Dockerfile and the docker-metadata-action stub.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Publish SNAPSHOTsworkflow has been failing on every run. Each matrix job dies at the Build and push Docker images step with:Root cause
docker-bake.hcl'sbake-platformtarget doesinherits = ["docker-metadata-action"]. That target is defined as an empty stub (target "docker-metadata-action" {}) on everydev-*branch, but not onmaster.The regression was triggered by [FLINK-39796] bumping
docker/bake-actionfrom v4 to v7. v7 changed the default of an unsetsourceinput: instead of baking the local working tree, it now falls back to the workflow's own git context and bakes it as a remote ref, so buildx fetchesdocker-bake.hcl(and the build context) from the triggering commit onmaster:Since the job checks out a
dev-*branch but v7 readsmaster, two things break:master'sdocker-bake.hcllacks thedocker-metadata-actionstub →inheritsfails.add-custom.shinto the local working tree and is never committed, so a remote bake context could not find$DOCKER_FILEanyway.This is why the workflow was green on v4 (which baked the local
dev-*checkout that has both the stub and the generated Dockerfile) and red on v7.Fix
Set
source: .on the bake step to restore the pre-v7 behavior of baking the local working tree. This resolves both issues at once: the checked-outdev-*tree contains both the generated Dockerfile and thedocker-metadata-actionstub.Notes
target "docker-metadata-action" {}tomaster'sdocker-bake.hclto match thedev-*branches. That alone is not sufficient under v7's remote bake, because the runtime-generated Dockerfile still wouldn't exist in the remote context — hence pinningsource: .is the actual fix.