Skip to content

[0.13] bake: changed behavior in output configuration #2325

@davhdavh

Description

@davhdavh

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

It seems some logic changed in merging bake files.

Expected behaviour

upgrade from 0.12.1 to 0.13 didn't break build

Actual behaviour

upgrade from 0.12.1 to 0.13 didn't break build.

v0.12.1:

  {
    "group": {
      "default": {
        "targets": [
          "a",
          "b",
          "c",
          "d",
          "test"
        ]
      }
    },
    "target": {
      "build-base": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "dockerfile": "Dockerfile.build-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "p": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": "Z/Z",
        "dockerfile": "Dockerfile",
        "pull": true
      },
      "b": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "builder": "target:b-builder",
          "p": "target:p",
          "e": "target:e",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "B/Dockerfile.deploy.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "b-1176",
          "PROJ": "B"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:10:43.389Z",
          "org.opencontainers.image.description": "X B",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X B",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "b-1176"
        },
        "tags": [
          "***/***:b-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=image,push=true,push=true,push=true"
        ],
        "pull": true
      },
      "b-builder": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "B"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "d": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "builder": "target:d-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "d-1176",
          "PROJ": "X.D"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:10:44.747Z",
          "org.opencontainers.image.description": "X D",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X D",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "d-1176"
        },
        "tags": [
          "***/***:d-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=image,push=true,push=true,push=true"
        ],
        "pull": true
      },
      "d-builder": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.D"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "e": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": "Y/source",
        "dockerfile": "Dockerfile",
        "pull": true
      },
      "c": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "builder": "target:c-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "c-1176",
          "PROJ": "X.C"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:10:47.377Z",
          "org.opencontainers.image.description": "X c",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X c",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "c-1176"
        },
        "tags": [
          "***/***:c-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=image,push=true,push=true,push=true"
        ],
        "pull": true
      },
      "c-builder": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.C"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "runtime-base": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "dockerfile": "Dockerfile.runtime-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "a": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "builder": "target:a-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "a-1176",
          "PROJ": "X.A"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:10:46.039Z",
          "org.opencontainers.image.description": "X a",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X a",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "a-1176"
        },
        "tags": [
          "***/***:a-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=image,push=true,push=true,push=true"
        ],
        "pull": true
      },
      "a-builder": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.A"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "test": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "builder": "target:test-builder",
          "test-base": "target:test-base"
        },
        "dockerfile": "Dockerfile.all-test.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=local,dest=./test-results-output"
        ],
        "pull": true
      },
      "test-base": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "dockerfile": "Dockerfile.test-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "test-builder": {
        "attest": [
          "type=provenance,mode=min,inline-only=true,builder-id=https://github.com/X/X/actions/runs/8198168165"
        ],
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.Test"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      }
    }
  }

Final merged bake file:

0.13.0:

   {
    "group": {
      "default": {
        "targets": [
          "a",
          "b",
          "c",
          "d",
          "test"
        ]
      }
    },
    "target": {
      "build-base": {
        "context": ".",
        "dockerfile": "Dockerfile.build-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "p": {
        "context": "Z/Z",
        "dockerfile": "Dockerfile",
        "pull": true
      },
      "b": {
        "context": ".",
        "contexts": {
          "builder": "target:b-builder",
          "p": "target:p",
          "e": "target:e",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "B/Dockerfile.deploy.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "b-1176",
          "PROJ": "B"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:32:51.778Z",
          "org.opencontainers.image.description": "X B",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X B",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "b-1176"
        },
        "tags": [
          "***/***:b-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=registry"
        ],
        "pull": true
      },
      "b-builder": {
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "B"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "d": {
        "context": ".",
        "contexts": {
          "builder": "target:d-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "d-1176",
          "PROJ": "X.D"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:32:53.051Z",
          "org.opencontainers.image.description": "X D",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X D",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "d-1176"
        },
        "tags": [
          "***/***:d-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=registry"
        ],
        "pull": true
      },
      "d-builder": {
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.D"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "e": {
        "context": "Y/source",
        "dockerfile": "Dockerfile",
        "pull": true
      },
      "c": {
        "context": ".",
        "contexts": {
          "builder": "target:c-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "c-1176",
          "PROJ": "X.C"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:32:55.763Z",
          "org.opencontainers.image.description": "X c",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X c",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "c-1176"
        },
        "tags": [
          "***/***:c-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=registry"
        ],
        "pull": true
      },
      "c-builder": {
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.C"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "runtime-base": {
        "context": ".",
        "dockerfile": "Dockerfile.runtime-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "a": {
        "context": ".",
        "contexts": {
          "builder": "target:a-builder",
          "runtime-base": "target:runtime-base"
        },
        "dockerfile": "Dockerfile.all.Dockerfile",
        "args": {
          "DOCKER_META_IMAGES": "***/***",
          "DOCKER_META_VERSION": "a-1176",
          "PROJ": "X.A"
        },
        "labels": {
          "org.opencontainers.image.created": "2024-03-08T03:32:54.300Z",
          "org.opencontainers.image.description": "X a",
          "org.opencontainers.image.licenses": "",
          "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
          "org.opencontainers.image.source": "https://github.com/X/X",
          "org.opencontainers.image.title": "X a",
          "org.opencontainers.image.url": "https://github.com/X/X",
          "org.opencontainers.image.vendor": "X - Q A/S",
          "org.opencontainers.image.version": "a-1176"
        },
        "tags": [
          "***/***:a-1176"
        ],
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=registry"
        ],
        "pull": true
      },
      "a-builder": {
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.A"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "test": {
        "context": ".",
        "contexts": {
          "builder": "target:test-builder",
          "test-base": "target:test-base"
        },
        "dockerfile": "Dockerfile.all-test.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "output": [
          "type=registry"
        ],
        "pull": true
      },
      "test-base": {
        "context": ".",
        "dockerfile": "Dockerfile.test-base.Dockerfile",
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      },
      "test-builder": {
        "context": ".",
        "contexts": {
          "build-base": "target:build-base"
        },
        "dockerfile": "Dockerfile.builder.Dockerfile",
        "args": {
          "PROJ": "X.Test"
        },
        "platforms": [
          "linux/amd64"
        ],
        "pull": true
      }
    }
  }

Summary

0.12.1 preserved the original files test.output: "type=local,dest=./test-results-output", 0.13 overwrites it to "type=registry".
0.12.1 adds attest, 0.13 doesn't.

I assume the error message comes from the test.output being update from local to registry.

Buildx version

0.13.0

Docker info

No response

Builders list

not relevant

Configuration

github

    - name: Build
      uses: docker/bake-action@511fde2517761e303af548ec9e0ea74a8a100112 # v4
      with:
        files: |
          ./docker-bake.json
          ${{ steps.meta-a.outputs.bake-file }}
          ${{ steps.meta-b.outputs.bake-file }}
          ${{ steps.meta-c.outputs.bake-file }}
          ${{ steps.meta-d.outputs.bake-file }}
        targets: default
        push: true
        pull: true

docker-bake.json:

{
  "group": {
    "default": {
      "targets": [
        "a",
        "b",
        "c",
        "d",
        "test"
      ]
    }
  },
  "target": {
    "c-tags": {},
    "c": {
      "inherits": [ "c-tags", "defaults" ],
      "contexts": {
        "builder": "target:c-builder"
      },
      "args": {
        "PROJ": "X.C"
      }
    },
    "c-builder": {
      "inherits": [ "builder" ],
      "args": {
        "PROJ": "X.C"
      }
    },
    "d-tags": {},
    "d": {
      "inherits": [ "d-tags", "defaults" ],
      "contexts": {
        "builder": "target:d-builder"
      },
      "args": {
        "PROJ": "X.D"
      }
    },
    "d-builder": {
      "inherits": [ "builder" ],
      "args": {
        "PROJ": "X.D"
      }
    },
    "a-tags": {},
    "a": {
      "inherits": [ "a-tags", "defaults" ],
      "contexts": {
        "builder": "target:a-builder"
      },
      "args": {
        "PROJ": "X.A"
      }
    },
    "a-builder": {
      "inherits": [ "builder" ],
      "args": {
        "PROJ": "X.A"
      }
    },
    "b-tags": {},
    "b": {
      "inherits": [ "b-tags", "defaults" ],
      "args": {
        "PROJ": "B"
      },
      "dockerfile": "B/Dockerfile.deploy.Dockerfile",
      "contexts": {
        "e": "target:e",
        "p": "target:p",
        "builder": "target:b-builder"
      }
    },
    "b-builder": {
      "inherits": [ "builder" ],
      "args": {
        "PROJ": "B"
      }
    },
    "e": {
      "context": "Y/source",
      "dockerfile": "Dockerfile"
    },
    "p": {
      "context": "Z/Z",
      "dockerfile": "Dockerfile"
    },

    "test": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.all-test.Dockerfile",
      "contexts": {
        "test-base": "target:test-base",
        "builder": "target:test-builder"
      },
      "output": [ "type=local,dest=./test-results-output" ]
    },
    "test-builder": {
      "inherits": [ "builder" ],
      "args": {
        "PROJ": "X.Test"
      }
    },
    "all_defaults": {
      "platforms": [ "linux/amd64" ],
      "context": "."
    },
    "defaults": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.all.Dockerfile",
      "contexts": {
        "runtime-base": "target:runtime-base"
      }
    },
    "builder": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.builder.Dockerfile",
      "contexts": {
        "build-base": "target:build-base"
      }
    },
    "runtime-base": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.runtime-base.Dockerfile"
    },
    "build-base": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.build-base.Dockerfile"
    },
    "test-base": {
      "inherits": [ "all_defaults" ],
      "dockerfile": "Dockerfile.test-base.Dockerfile"
    }
  }
}

steps.meta-a.outputs.bake-file :

  {
    "tags": [
      "***/***:a-1176"
    ],
    "labels": {
      "org.opencontainers.image.created": "2024-03-08T03:32:55.763Z",
      "org.opencontainers.image.description": "X a",
      "org.opencontainers.image.licenses": "",
      "org.opencontainers.image.revision": "8ec5766dba6025b8fd13d585e80abbb217c1862c",
      "org.opencontainers.image.source": "https://github.com/X/X",
      "org.opencontainers.image.title": "X a",
      "org.opencontainers.image.url": "https://github.com/X/X",
      "org.opencontainers.image.vendor": "X - Q A/S",
      "org.opencontainers.image.version": "a-1176"
    },
    "annotations": [
      "manifest:org.opencontainers.image.created=2024-03-08T03:32:55.763Z",
      "manifest:org.opencontainers.image.description=",
      "manifest:org.opencontainers.image.licenses=",
      "manifest:org.opencontainers.image.revision=8ec5766dba6025b8fd13d585e80abbb217c1862c",
      "manifest:org.opencontainers.image.source=https://github.com/X/X",
      "manifest:org.opencontainers.image.title=X",
      "manifest:org.opencontainers.image.url=https://github.com/X/X",
      "manifest:org.opencontainers.image.version=a-1176"
    ]
  }

Build logs

No response

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions