Skip to content

warn on duplicate cache-to targets#3833

Open
areebahmeddd wants to merge 1 commit into
docker:masterfrom
areebahmeddd:fix/same-cache-warning
Open

warn on duplicate cache-to targets#3833
areebahmeddd wants to merge 1 commit into
docker:masterfrom
areebahmeddd:fix/same-cache-warning

Conversation

@areebahmeddd

Copy link
Copy Markdown
Contributor

summary

closes #3819

  • adds a warning when multiple build targets try to use the same cache destination

ai model disclosure

used vscode copilot (claude sonnet 4.6) to understand the issue context and help generate a fix. changes were self-reviewed and verified via:

make validate-all
go build ./...

@areebahmeddd

Copy link
Copy Markdown
Contributor Author

weird. the dco is failing although the commits are signed 🤔 let me try something.

@areebahmeddd areebahmeddd force-pushed the fix/same-cache-warning branch from d6b052c to 0f098db Compare May 6, 2026 19:14
@areebahmeddd areebahmeddd marked this pull request as ready for review May 8, 2026 21:23
@areebahmeddd

Copy link
Copy Markdown
Contributor Author

ping! @crazy-max

@thompson-shaun thompson-shaun requested a review from crazy-max May 20, 2026 14:11

@tonistiigi tonistiigi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If added, this should be based on some primary values, eg. type=local,dest=, type=registry,ref=. Eg. if same ref is used with different mode then it is still a collision. And we shouldn't use the potentially secret values for comparison or log them anyway.

Does this work with target inheritance?

@areebahmeddd

Copy link
Copy Markdown
Contributor Author

we shouldn't use the potentially secret values for comparison or log them anyway.

yea sure, i think using a helper func here is enough for comparing the destination key. creds/mode are ignored

Does this work with target inheritance?

yes, this runs after inheritance gets resolved so shared inherited cache-to values still trigger the warning

Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
@areebahmeddd areebahmeddd force-pushed the fix/same-cache-warning branch from 0f098db to 6bb0e59 Compare May 29, 2026 05:56
@areebahmeddd

areebahmeddd commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

gentle ping! @tonistiigi

the ci failure is not related to our changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bake should not allow multiple cache outputs of the same name

3 participants