Skip to content

fix(build): skip remote URL contexts from bake fs.read allowlist#13816

Open
ndeloof wants to merge 1 commit into
mainfrom
fix-bake-remote-context-fs-read
Open

fix(build): skip remote URL contexts from bake fs.read allowlist#13816
ndeloof wants to merge 1 commit into
mainfrom
fix-bake-remote-context-fs-read

Conversation

@ndeloof
Copy link
Copy Markdown
Contributor

@ndeloof ndeloof commented Jun 1, 2026

Summary

  • Fix docker compose build failing on Windows when a service's build: context is a remote git/HTTP URL
  • Apply the same gitutil.ParseGitRef + :// filter to the main Context that was already applied to additional_contexts, so remote URLs are not passed to bake as --allow fs.read=<url>

Why

On Windows, bake interprets fs.read entries as local filesystem paths. When the value is a URL like https://github.com/.../repo.git#main, evaluation fails with:

failed to evaluate path "https://...": CreateFile C:\...\https:: The filename, directory name, or volume label syntax is incorrect.

because https: is invalid Windows path syntax (colon is reserved for drive letters). The fs.read entitlement is only meaningful for local paths anyway.

Fixes #13815

Test plan

🤖 Generated with Claude Code

@ndeloof ndeloof requested a review from a team as a code owner June 1, 2026 06:40
@ndeloof ndeloof requested review from Copilot and glours June 1, 2026 06:40
When a service's build context is a remote git/HTTP URL, the path was
unconditionally added to bake's --allow fs.read= entitlements. On Windows,
bake then tries to evaluate the URL as a local filesystem path and fails
because `https:` is invalid path syntax (colon is reserved for drive
letters).

Apply the same gitutil.ParseGitRef + "://" check already used for
additional_contexts so that remote contexts are skipped from the fs.read
allowlist.

Fixes #13815

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Nicolas De loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof force-pushed the fix-bake-remote-context-fs-read branch from aeec62e to 165676e Compare June 1, 2026 06:42
Copy link
Copy Markdown

@docker-agent docker-agent Bot left a comment

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

The fix correctly applies the same gitutil.ParseGitRef + "://" URL filter that was already guarding AdditionalContexts to the main buildConfig.Context field, preventing remote URLs from being passed as --allow fs.read=<url> to bake. The new guard is logically sound and mirrors the existing pattern exactly.

No high or medium severity issues were found.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes docker compose build failing on Windows when a service’s build.context is a remote git/HTTP URL by ensuring such remote contexts are not passed to buildx bake as --allow fs.read=<url> (which bake interprets as a local filesystem path on Windows).

Changes:

  • Skip adding build.context to the bake fs.read allowlist when it looks like a remote URL (://) or a git ref (per gitutil.ParseGitRef), matching the existing filtering already used for additional_contexts.

@vaguul
Copy link
Copy Markdown

vaguul commented Jun 4, 2026

This lines up with the split from #13815: local build contexts worked on the same Windows setup, while the remote Git URL context failed when bake treated the URL like an fs.read path.

The guard here matches the existing additional_contexts filtering and should avoid passing https://... / Git refs into the filesystem allowlist. The one regression case I would want covered is a service with scalar remote build: context, for example:

services:
  api:
    build: https://github.com/example/repo.git#main

and asserting the bake path does not include that URL in --allow fs.read=.... That is the exact shape from the issue report, separate from additional_contexts.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] docker compose build does not build from remote files.

3 participants