Skip to content

bake: derive git auth host from remote URL#3648

Open
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:bake-auth-token-domain
Open

bake: derive git auth host from remote URL#3648
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:bake-auth-token-domain

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Feb 10, 2026

This PR updates Bake so Git authentication hosts are derived automatically from remote context URLs. It introduces a new gitauth helper that centralizes how Git auth secrets are built from environment variables and reuses that logic in both build option creation and remote file reads.

Instead of only attaching the base BuildKit secret IDs, the code now also adds host-scoped secret IDs when remote URLs are present. It collects and deduplicates remote URLs from the main context, named contexts, and input URL, parses their hosts, and emits secrets like GIT_AUTH_TOKEN.<host> and GIT_AUTH_HEADER.<host> in addition to the base keys. This keeps existing behavior intact while enabling per-host auth routing automatically.

@crazy-max crazy-max force-pushed the bake-auth-token-domain branch from ac8f506 to 8573243 Compare February 10, 2026 15:12
@crazy-max crazy-max added this to the v0.32.0 milestone Feb 10, 2026
@crazy-max crazy-max force-pushed the bake-auth-token-domain branch from 8573243 to 22217e5 Compare February 10, 2026 15:26
@crazy-max crazy-max requested a review from tonistiigi February 10, 2026 15:38
@crazy-max crazy-max marked this pull request as ready for review February 10, 2026 15:38
@crazy-max
Copy link
Member Author

crazy-max commented Feb 10, 2026

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

I don't think users should need to set the host in the env variable. We can just get the host from the remote URL and connect these automatically.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max force-pushed the bake-auth-token-domain branch from 22217e5 to eebe1e5 Compare February 17, 2026 15:28
@crazy-max crazy-max changed the title bake: support host-suffixed git auth env vars bake: derive git auth host from remote URL Feb 17, 2026
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.

2 participants