Skip to content

Conversation

@crazy-max
Copy link
Member

follow-up #2330

The --load case is not properly handled in v0.13 and previous v0.12 as it doesn't append but overrides the outputs:

target "foo" {
  output = [ "type=local,dest=out" ]
}

target "bar" {
}
$ docker buildx bake --load --print foo bar
{
  "group": {
    "default": {
      "targets": [
        "foo",
        "bar"
      ]
    }
  },
  "target": {
    "bar": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=docker"
      ]
    },
    "foo": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=docker"
      ]
    }
  }
}

With this change it will append only if there is a compatible output already (image, registry) or empty:

{
  "group": {
    "default": {
      "targets": [
        "foo",
        "bar"
      ]
    }
  },
  "target": {
    "bar": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=docker"
      ]
    },
    "foo": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=local,dest=out"
      ]
    }
  }
}

For example with:

target "foo" {
  output = [ "type=image" ]
}

target "bar" {
}

It would result in:

{
  "group": {
    "default": {
      "targets": [
        "foo",
        "bar"
      ]
    }
  },
  "target": {
    "bar": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=docker"
      ]
    },
    "foo": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        "type=image"
        "type=docker"
      ]
    }
  }
}

Same has been done for push override so we are consistent. See new tests suite for more info.

@crazy-max crazy-max added this to the v0.14.0 milestone Mar 13, 2024
@crazy-max crazy-max requested a review from tonistiigi March 13, 2024 12:00
@crazy-max crazy-max marked this pull request as ready for review March 13, 2024 12:01
@crazy-max crazy-max marked this pull request as draft March 27, 2024 17:41
@crazy-max crazy-max force-pushed the bake-load-override branch from 5bba069 to 8d11b33 Compare April 5, 2024 10:44
@crazy-max crazy-max requested a review from tonistiigi April 5, 2024 10:44
@crazy-max crazy-max marked this pull request as ready for review April 5, 2024 10:45
@crazy-max crazy-max force-pushed the bake-load-override branch 2 times, most recently from 5d5bcb2 to 1dd5b9e Compare April 5, 2024 11:01
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max force-pushed the bake-load-override branch from 1dd5b9e to dc4b4c3 Compare April 5, 2024 11:03
@tonistiigi tonistiigi merged commit 0d6b3a9 into docker:master Apr 8, 2024
@crazy-max crazy-max deleted the bake-load-override branch April 9, 2024 06:41
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.

2 participants