From 6ae0b02f9ad1b93d85ba87e5ca48e193f702951d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Sun, 9 Jun 2024 13:34:19 +0200 Subject: [PATCH] chore: define jdks to build at a single place in docker bake --- docker-bake.hcl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 87b3e24d..81fa9191 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -32,6 +32,14 @@ group "linux-ppc64le" { ] } +variable "jdks_to_build" { + default = [11, 17, 21] +} + +variable "default_jdk" { + default = 17 +} + variable "REGISTRY" { default = "docker.io" } @@ -76,10 +84,7 @@ variable "DEBIAN_RELEASE" { default = "bookworm-20240513" } -variable "default_jdk" { - default = 17 -} - +## Common functions # Return "true" if the jdk passed as parameter is the same as the default jdk, "false" otherwise function "is_default_jdk" { params = [jdk] @@ -96,6 +101,7 @@ function "javaversion" { : "${JAVA21_VERSION}")) } +# Specific functions # Return an array of Alpine platforms to use depending on the jdk passed as parameter function "alpine_platforms" { params = [jdk] @@ -114,7 +120,7 @@ function "debian_platforms" { target "alpine" { matrix = { - jdk = [11, 17, 21] + jdk = jdks_to_build } name = "alpine_${jdk}" dockerfile = "alpine/Dockerfile" @@ -141,7 +147,7 @@ target "alpine" { target "debian" { matrix = { - jdk = [11, 17, 21] + jdk = jdks_to_build } name = "debian_${jdk}" dockerfile = "debian/Dockerfile"