Skip to content

Commit

Permalink
Add rhel ubi images to docker-bake
Browse files Browse the repository at this point in the history
  • Loading branch information
adambkaplan committed Sep 11, 2024
1 parent 5023a0c commit 7392035
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ function "debian_platforms" {
: ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]))
}

# Return an array of RHEL UBI 8 platforms to use depending on the jdk passed as parameter
# Note: Jenkins Docker controller only supports jdk-11 for ubi8
function "rhel_ubi8_platforms" {
params = [jdk]
result = ["linux/amd64", "linux/arm64"]
}

# Return an array of RHEL UBI 8 platforms to use depending on the jdk passed as parameter
# Note: Jenkins Docker controller only supports jdk-17 and jdk-21 for ubi9
function "rhel_ubi9_platforms" {
params = [jdk]
result = ["linux/amd64", "linux/arm64", "linux/ppc64le"]
}

target "alpine" {
matrix = {
type = ["agent", "inbound-agent"]
Expand Down Expand Up @@ -233,3 +247,57 @@ target "agent_archlinux_jdk11" {
]
platforms = ["linux/amd64"]
}

target "rhel_ubi8" {
matrix = {
type = ["agent", "inbound-agent"]
jdk = [11]
}
name = "${type}_rhel_ubi8_jdk${jdk}"
target = type
dockerfile = "rhel/ubi8/Dockerfile"
context = "."
args = {
VERSION = REMOTING_VERSION
JAVA_VERSION = "${javaversion(jdk)}"
}
tags = [
# If there is a tag, add versioned tag suffixed by the jdk
equal(ON_TAG, "true") ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi8-jdk${jdk}" : "",
# If there is a tag and if the jdk is the default one, add versioned short tag
equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi8" : "") : "",
# If the jdk is the default one, add rhel and latest short tags
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:rhel-ubi8" : "",
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi8" : "",
"${REGISTRY}/${orgrepo(type)}:rhel-ubi8-jdk${jdk}",
"${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi8-jdk${jdk}",
]
platforms = rhel_ubi8_platforms(jdk)
}

target "rhel_ubi9" {
matrix = {
type = ["agent", "inbound-agent"]
jdk = [17, 21]
}
name = "${type}_rhel_ubi9_jdk${jdk}"
target = type
dockerfile = "rhel/ubi9/Dockerfile"
context = "."
args = {
VERSION = REMOTING_VERSION
JAVA_VERSION = "${javaversion(jdk)}"
}
tags = [
# If there is a tag, add versioned tag suffixed by the jdk
equal(ON_TAG, "true") ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi9-jdk${jdk}" : "",
# If there is a tag and if the jdk is the default one, add versioned short tag
equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi9" : "") : "",
# If the jdk is the default one, add rhel and latest short tags
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:rhel-ubi9" : "",
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi9" : "",
"${REGISTRY}/${orgrepo(type)}:rhel-ubi9-jdk${jdk}",
"${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi9-jdk${jdk}",
]
platforms = rhel_ubi9_platforms(jdk)
}
File renamed without changes.
File renamed without changes.

0 comments on commit 7392035

Please sign in to comment.