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: fix group resolution #884

Merged
merged 1 commit into from
Jan 4, 2022
Merged

Conversation

crazy-max
Copy link
Member

follow-up #881

If a target has the same name as a group, it's resolution is skipped.

group "foo" {
  targets = ["foo"]
}
target "foo" {
  dockerfile = "bar"
}
$ docker buildx bake foo --print
{
  "group": {
    "default": {
      "targets": [
        "foo"
      ]
    }
  },
  "target": {}
}

Now:

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

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max changed the title Fix bake resolution group bake: fix group resolution Dec 14, 2021

f := File{
Name: "docker-bake.hcl",
Data: []byte(`
Copy link
Contributor

Choose a reason for hiding this comment

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

I find JSON a bit nicer for these kind of tests, as you can indent each line as much as needed ;)

However, this test suite in particular has lots of strings with YAML, JSON & HCL... maybe a cleanup is due to move these assets to separate files.

@errordeveloper
Copy link
Contributor

I think the group and target functions seem a bit hard to read, maybe less ambiguous names could help, or perhaps these could be rewritten a little. Just an observation...

@tonistiigi tonistiigi merged commit fe9f9bb into docker:master Jan 4, 2022
@crazy-max crazy-max deleted the fix-bake-resgroup branch January 4, 2022 20:25
@crazy-max crazy-max added this to the v0.8.0 milestone Jan 26, 2022
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.

3 participants