@@ -42,8 +42,8 @@ variable "DISTROS" {
4242 ]
4343}
4444
45- variable "PKGS " {
46- description = " List of packages to build from ./pkg directory. Don't forget to update _pkg-* target if you add/remove a package ."
45+ variable "PKGS_BASE " {
46+ description = " Base list of packages built from this repo. Use PKGS_EXTRA in an override file to add downstream packages ."
4747 default = [
4848 " buildx" ,
4949 " compose" ,
@@ -56,6 +56,49 @@ variable "PKGS" {
5656 ]
5757}
5858
59+ variable "PKGS_EXTRA" {
60+ description = " Additional packages to append from an override bake definition."
61+ default = []
62+ }
63+
64+ variable "PKGS" {
65+ description = " Full list of packages to build from ./pkg directory or an override-provided package context."
66+ default = concat (PKGS_BASE, PKGS_EXTRA)
67+ }
68+
69+ variable "PKG_PLATFORMS_BASE" {
70+ description = " Base package platform mapping. Use PKG_PLATFORMS_EXTRA in an override bake definition to add downstream packages."
71+ default = {
72+ # https://github.com/docker/buildx/blob/0c747263ef1426f5fa217fcdb616eddf33da6c2d/docker-bake.hcl#L156-L174
73+ buildx = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
74+ # https://github.com/docker/compose/blob/c626befee1596abcc74578cb10dd96ae1667f76f/docker-bake.hcl#L112-L124
75+ compose = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
76+ # https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L145-L165
77+ # https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L135-L137
78+ containerd = [" linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" , " windows/arm64" , " windows/arm/v7" ]
79+ # https://github.com/docker/docker-credential-helpers/blob/f9d3010165b642df37215b1be945552f2c6f0e3b/docker-bake.hcl#L56-L66
80+ credential-helpers = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" ]
81+ # https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/docker-bake.hcl#L30-L42
82+ docker-cli = [" darwin/amd64" , " darwin/arm64" , " linux/386" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
83+ # https://github.com/moby/moby/blob/83264918d3e1c61341511e360a7277150b914b3f/docker-bake.hcl#L82-L91
84+ docker-engine = [" linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
85+ # https://github.com/docker/model-runner/blob/039f7a31c0365f9161c9b9b6bb3888161d16e388/cmd/cli/Makefile#L39-L43
86+ model = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm64" , " linux/arm/v7" , " windows/amd64" , " windows/arm64" ]
87+ # https://github.com/docker/docker-agent/blob/5b9feaabe743a5ad577f2247ed55d5dcb2678e8b/Taskfile.yml#L79
88+ agent = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm64" , " windows/amd64" , " windows/arm64" ]
89+ }
90+ }
91+
92+ variable "PKG_PLATFORMS_EXTRA" {
93+ description = " Additional package platform mapping to merge from an override bake definition."
94+ default = {}
95+ }
96+
97+ variable "PKG_CONTEXTS_EXTRA" {
98+ description = " Additional package context mapping to merge from an override bake definition."
99+ default = {}
100+ }
101+
59102variable "DISTRO_NAME" {
60103 description = " Name of the distro."
61104 default = null
@@ -589,25 +632,12 @@ target "_pkg-agent" {
589632# Returns the list of supported platforms for a given package.
590633function "pkgPlatforms" {
591634 params = [pkg ]
592- result = lookup ({
593- # https://github.com/docker/buildx/blob/0c747263ef1426f5fa217fcdb616eddf33da6c2d/docker-bake.hcl#L156-L174
594- buildx = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
595- # https://github.com/docker/compose/blob/c626befee1596abcc74578cb10dd96ae1667f76f/docker-bake.hcl#L112-L124
596- compose = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
597- # https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L145-L165
598- # https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L135-L137
599- containerd = [" linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" , " windows/arm64" , " windows/arm/v7" ]
600- # https://github.com/docker/docker-credential-helpers/blob/f9d3010165b642df37215b1be945552f2c6f0e3b/docker-bake.hcl#L56-L66
601- credential-helpers = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" ]
602- # https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/docker-bake.hcl#L30-L42
603- docker-cli = [" darwin/amd64" , " darwin/arm64" , " linux/386" , " linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/riscv64" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
604- # https://github.com/moby/moby/blob/83264918d3e1c61341511e360a7277150b914b3f/docker-bake.hcl#L82-L91
605- docker-engine = [" linux/amd64" , " linux/arm/v6" , " linux/arm/v7" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" , " windows/amd64" , " windows/arm64" ]
606- # https://github.com/docker/model-runner/blob/039f7a31c0365f9161c9b9b6bb3888161d16e388/cmd/cli/Makefile#L39-L43
607- model = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm64" , " linux/arm/v7" , " windows/amd64" , " windows/arm64" ]
608- # https://github.com/docker/docker-agent/blob/5b9feaabe743a5ad577f2247ed55d5dcb2678e8b/Taskfile.yml#L79
609- agent = [" darwin/amd64" , " darwin/arm64" , " linux/amd64" , " linux/arm64" , " windows/amd64" , " windows/arm64" ]
610- }, pkg, [])
635+ result = lookup (merge (PKG_PLATFORMS_BASE, PKG_PLATFORMS_EXTRA), pkg, [])
636+ }
637+
638+ function "pkgContext" {
639+ params = [pkg ]
640+ result = lookup (PKG_CONTEXTS_EXTRA, pkg, " ./pkg/${ pkg } " )
611641}
612642
613643#
@@ -652,7 +682,7 @@ target "pkg" {
652682 pkg = PKGS
653683 distro = DISTROS
654684 }
655- context = " ./ pkg/ ${ pkg } "
685+ context = pkgContext ( pkg)
656686 contexts = {
657687 scripts = " ./hack/scripts"
658688 }
@@ -675,7 +705,7 @@ target "verify" {
675705 pkg = PKGS
676706 distro = DISTROS
677707 }
678- context = " ./ pkg/ ${ pkg } "
708+ context = pkgContext ( pkg)
679709 dockerfile = " verify.Dockerfile"
680710 contexts = {
681711 scripts = " ./hack/scripts"
@@ -708,7 +738,7 @@ target "metadata" {
708738 matrix = {
709739 pkg = PKGS
710740 }
711- context = " ./ pkg/ ${ pkg } "
741+ context = pkgContext ( pkg)
712742 contexts = {
713743 scripts = " ./hack/scripts"
714744 }
0 commit comments