Skip to content

bake --print show wrong docker-bake.json when we target a group which targets groups #1058

@eitsupi

Description

@eitsupi

When printing a group whose target is a group, it appears that the json is printed with a target name that does not exist in the json file for the target.

For example, a hcl file like that:

group "default" {
    targets = ["other-group"]
}

group "other-group" {
    targets = ["app"]
}

target "app" {
    dockerfile = "Dockerfile"
    tags = ["docker.io/username/app"]
}
$ docker buildx bake --print -f docker-bake.hcl
[+] Building 0.0s (0/0)                                                                          
{
  "group": {
    "default": {
      "targets": [
        "other-group"
      ]
    }
  },
  "target": {
    "app": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "tags": [
        "docker.io/username/app"
      ]
    }
  }
}

The groups included in the default group must be included in the json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions