Skip to content

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Oct 8, 2025

needs #3459

Atm remote Git URL get lost as we are creating a state input when a subdir is used. In such case we can set Path with the resolved context URL for the target and pass it as a input:context frontend attribute.

This also fixes the canonical output of remote bake definition to set context accordingly. Before it was not displaying the right context if there was a subdir.

Before:

$ docker buildx bake https://github.com/dockersamples/labspace-infra.git interface --print
{
  "group": {
    "default": {
      "targets": [
        "interface"
      ]
    }
  },
  "target": {
    "interface": {
      "attest": [
        {
          "mode": "max",
          "type": "provenance"
        },
        {
          "type": "sbom"
        }
      ],
      "context": "components/interface",
      "dockerfile": "Dockerfile",
      "tags": [
        "dockersamples/labspace-interface:latest"
      ],
      "platforms": [
        "linux/amd64",
        "linux/arm64"
      ]
    }
  }
}

Now:

$ docker buildx bake https://github.com/dockersamples/labspace-infra.git interface --print
#0 building with "default" instance using docker driver

#1 [internal] load git source https://github.com/dockersamples/labspace-infra.git
#1 0.515 ref: refs/heads/main   HEAD
#1 0.515 a0e670182ef24ae03d0c50b81dfee14b8c5f6295       HEAD
#1 0.887 a0e670182ef24ae03d0c50b81dfee14b8c5f6295       refs/heads/main
#1 CACHED
{
  "group": {
    "default": {
      "targets": [
        "interface"
      ]
    }
  },
  "target": {
    "interface": {
      "attest": [
        {
          "mode": "max",
          "type": "provenance"
        },
        {
          "type": "sbom"
        }
      ],
      "context": "https://github.com/dockersamples/labspace-infra.git#:components/interface",
      "dockerfile": "Dockerfile",
      "tags": [
        "dockersamples/labspace-interface:latest"
      ],
      "platforms": [
        "linux/amd64",
        "linux/arm64"
      ]
    }
  }
}

@crazy-max crazy-max force-pushed the bake-input-context branch 2 times, most recently from 28372a5 to 17bfb35 Compare October 9, 2025 09:48
@crazy-max crazy-max added this to the v0.30.0 milestone Oct 9, 2025
@crazy-max crazy-max force-pushed the bake-input-context branch 2 times, most recently from fde87d7 to 2a37085 Compare October 9, 2025 14:18
@crazy-max crazy-max requested a review from tonistiigi October 9, 2025 14:18
@crazy-max crazy-max force-pushed the bake-input-context branch 8 times, most recently from 3c22e03 to 71b2265 Compare October 9, 2025 15:52
@crazy-max crazy-max removed this from the v0.30.0 milestone Oct 10, 2025
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.

1 participant