Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bake: load override #2336

Merged
merged 1 commit into from Apr 8, 2024
Merged

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 marked this pull request as ready for review March 13, 2024 12:01
bake/bake.go Outdated Show resolved Hide resolved
bake/bake.go Outdated Show resolved Hide resolved
bake/bake.go Outdated Show resolved Hide resolved
@crazy-max crazy-max marked this pull request as draft March 27, 2024 17:41
@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>
@tonistiigi tonistiigi merged commit 0d6b3a9 into docker:master Apr 8, 2024
69 checks passed
@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.

None yet

2 participants