bake: fix group resolution by crazy-max · Pull Request #884 · docker/buildx (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation2 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

crazy-max

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"
    }
  }
}

@crazy-max

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@crazy-max crazy-max changed the titleFix bake resolution group bake: fix group resolution

Dec 14, 2021

errordeveloper

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

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

@errordeveloper

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