I have a job that builds a matrix of PHP versions, base distros (and some other stuff IRL). I want to combine it into one bake, but still source the versions from env vars. I'm not sure if there's a way to do this in bake, or if I need to generate HCL/JSON separately?
I could generate the default group pretty easily if I set an env var like PHP_VERSIONS=7,8 DISTROS =alpine,ubuntu:
variable PHP_VERSIONS {}
variable DISTROS {}
group "default" {
targets = flatten(
[for d in split(",", "${DISTROS}"):
[for v in split(",", "${PHP_VERSIONS}"):
"${d}-php-${v}"
]
]
)
}
However I can't see how to avoid explicitly enumerating all the targets:
target "alpine-php-8" {}
[...etc...]
Ideally I'd have some way to template the targets, is there anything possible in bake's HCL?
I have a job that builds a matrix of PHP versions, base distros (and some other stuff IRL). I want to combine it into one bake, but still source the versions from env vars. I'm not sure if there's a way to do this in bake, or if I need to generate HCL/JSON separately?
I could generate the default group pretty easily if I set an env var like
PHP_VERSIONS=7,8 DISTROS =alpine,ubuntu:However I can't see how to avoid explicitly enumerating all the targets:
Ideally I'd have some way to template the targets, is there anything possible in bake's HCL?