@@ -28,7 +28,9 @@ variable "DISTROS" {
2828 " fedora38" ,
2929 " fedora39" ,
3030 " oraclelinux8" ,
31- " oraclelinux9"
31+ " oraclelinux9" ,
32+ " rhel8" ,
33+ " rhel9"
3234 ]
3335}
3436
@@ -310,6 +312,28 @@ target "_distro-oraclelinux9" {
310312 }
311313}
312314
315+ target "_distro-rhel8" {
316+ args = {
317+ DISTRO_NAME = " rhel8"
318+ DISTRO_TYPE = " rpm"
319+ DISTRO_RELEASE = " rhel"
320+ DISTRO_ID = " 8"
321+ DISTRO_SUITE = " 8"
322+ DISTRO_IMAGE = DISTRO_IMAGE != null ? DISTRO_IMAGE : " registry.access.redhat.com/ubi8/ubi"
323+ }
324+ }
325+
326+ target "_distro-rhel9" {
327+ args = {
328+ DISTRO_NAME = " rhel9"
329+ DISTRO_TYPE = " rpm"
330+ DISTRO_RELEASE = " rhel"
331+ DISTRO_ID = " 9"
332+ DISTRO_SUITE = " 9"
333+ DISTRO_IMAGE = DISTRO_IMAGE != null ? DISTRO_IMAGE : " registry.access.redhat.com/ubi9/ubi"
334+ }
335+ }
336+
313337# Returns the list of supported platforms for a given distro and package.
314338# The result is the intersection of the platforms supported by the distro
315339# and the platforms supported by the package. Except for static distro,
@@ -334,6 +358,8 @@ function "distroPlatforms" {
334358 fedora39 = [" linux/amd64" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" ]
335359 oraclelinux8 = [" linux/amd64" , " linux/arm64" ]
336360 oraclelinux9 = [" linux/amd64" , " linux/arm64" ]
361+ rhel8 = [" linux/amd64" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" ]
362+ rhel9 = [" linux/amd64" , " linux/arm64" , " linux/ppc64le" , " linux/s390x" ]
337363 }, distro, []),
338364 pkgPlatforms (pkg)
339365 ),
@@ -344,6 +370,12 @@ function "distroPlatforms" {
344370 )
345371}
346372
373+ # Returns the list of secrets to use for a given distro.
374+ function "distroSecrets" {
375+ params = [distro ]
376+ result = length (regexall (" ^rhel" , distro)) > 0 ? [" type=env,id=RH_USER,env=RH_USER" , " type=env,id=RH_PASS,env=RH_PASS" ] : []
377+ }
378+
347379#
348380# pkgs configurations
349381#
@@ -508,6 +540,7 @@ target "pkg" {
508540 # BAKE_LOCAL_PLATFORM is a built-in var returning the current platform's
509541 # default platform specification: https://docs.docker.com/build/customize/bake/file-definition/#built-in-variables
510542 platforms = LOCAL_PLATFORM != null ? [BAKE_LOCAL_PLATFORM ] : distroPlatforms (distro, pkg)
543+ secret = distroSecrets (distro)
511544 attest = [
512545 " type=sbom" ,
513546 " type=provenance,mode=max"
0 commit comments