diff --git a/.github/generate-strategy.sh b/.github/generate-strategy.sh index a3223b9b..1e9a8aa9 100755 --- a/.github/generate-strategy.sh +++ b/.github/generate-strategy.sh @@ -49,6 +49,8 @@ for version in "${ubi_versions[@]}"; do versionFile="${version}/.versions.json" fullVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") releaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") + ubi8Version=$(jq -r '.UBI8_VERSION' "${versionFile}") + ubi9Version=$(jq -r '.UBI9_VERSION' "${versionFile}") # Initial aliases are "major version", "optional alias", "full version with release" # i.e. "13", "latest", "13.2-1" @@ -100,11 +102,14 @@ for version in "${ubi_versions[@]}"; do platformsMultiArch="${platforms}, linux/ppc64le,linux/s390x" # Build the json entry - entries+=( - "{\"name\": \"UBI ${fullVersion}\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliases[@]}")\"]}" - "{\"name\": \"UBI ${fullVersion} MultiLang\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multilang\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiLang[@]}")\"]}" - "{\"name\": \"UBI ${fullVersion} MultiArch\", \"platforms\": \"$platformsMultiArch\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multiarch\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiArch[@]}")\"]}" - ) + for ubiVersion in "$ubi8Version" "$ubi9Version"; do + majorVersion="${ubiVersion%%.*}" + entries+=( + "{\"name\": \"${fullVersion} UBI${majorVersion}\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.ubi$majorVersion\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliases[@]}")\"]}" + "{\"name\": \"${fullVersion} UBI${majorVersion} MultiLang\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multilang.ubi$majorVersion\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiLang[@]}")\"]}" + "{\"name\": \"${fullVersion} UBI${majorVersion} MultiArch\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platformsMultiArch\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multiarch.ubi$majorVersion\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiArch[@]}")\"]}" + ) + done done # UBI PostGIS diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3290589d..136f461b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,6 +114,7 @@ jobs: tags: ${{ env.TAGS }} labels: ${{ github.ref != 'refs/heads/main' && 'quay.expires-after=7d' || '' }} build-args: | + UBI_VERSION=${{ matrix.ubi_version }} SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }} # Send a notification on release failure diff --git a/UBI/Dockerfile-multiarch.template b/UBI/Dockerfile-multiarch.template index 15e87160..070c84fe 100644 --- a/UBI/Dockerfile-multiarch.template +++ b/UBI/Dockerfile-multiarch.template @@ -8,7 +8,7 @@ LABEL name="PostgreSQL Container Images" \ version="%%POSTGRES_VERSION%%" \ release="%%IMAGE_RELEASE_VERSION%%" \ summary="PostgreSQL Container images." \ - description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) 8." + description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) %%UBI_MAJOR_VERSION%%." COPY root/ / @@ -21,11 +21,11 @@ RUN --mount=type=secret,id=cs_token \ pg_audit_pkg="pgaudit%%PGAUDIT_VERSION%%_%%PG_MAJOR%%" ; \ case $ARCH in \ amd64) \ - yum -y install "${base_url}/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ curl -u token:$(cat /run/secrets/cs_token) -1sLf https://downloads.enterprisedb.com/basic/enterprise/setup.rpm.sh | bash ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ arm64) \ - yum -y install "${base_url}/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ curl -u token:$(cat /run/secrets/cs_token) -1sLf https://downloads.enterprisedb.com/basic/enterprise/setup.rpm.sh | bash ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ ppc64le) \ diff --git a/UBI/Dockerfile-multilang.template b/UBI/Dockerfile-multilang.template index 6b3e21ab..87e2c163 100644 --- a/UBI/Dockerfile-multilang.template +++ b/UBI/Dockerfile-multilang.template @@ -8,7 +8,7 @@ LABEL name="PostgreSQL Container Images" \ version="%%POSTGRES_VERSION%%" \ release="%%IMAGE_RELEASE_VERSION%%" \ summary="PostgreSQL Container images." \ - description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) 8." + description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) %%UBI_MAJOR_VERSION%%." COPY root/ / @@ -19,10 +19,10 @@ RUN set -xe ; \ pg_audit_pkg="pgaudit%%PGAUDIT_VERSION%%_%%PG_MAJOR%%" ; \ case $ARCH in \ amd64) \ - yum -y install "${base_url}/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ arm64) \ - yum -y install "${base_url}/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ *) \ exit 1 ;; \ diff --git a/UBI/Dockerfile-postgis-multilang.template b/UBI/Dockerfile-postgis-multilang.template index 88650a59..a300801e 100644 --- a/UBI/Dockerfile-postgis-multilang.template +++ b/UBI/Dockerfile-postgis-multilang.template @@ -9,7 +9,7 @@ LABEL name="PostgreSQL + PostGIS Container Images" \ version="%%POSTGRES_VERSION%%" \ release="%%IMAGE_RELEASE_VERSION%%" \ summary="PostgreSQL + PostGIS Container images." \ - description="This Docker image contains PostgreSQL, PostGIS and Barman Cloud based on RedHat Universal Base Images (UBI) 8." + description="This Docker image contains PostgreSQL, PostGIS and Barman Cloud based on RedHat Universal Base Images (UBI) %%UBI_MAJOR_VERSION%%." COPY root/ / @@ -20,10 +20,10 @@ RUN set -xe ; \ pg_audit_pkg="pgaudit%%PGAUDIT_VERSION%%_%%PG_MAJOR%%" ; \ case $ARCH in \ amd64) \ - yum -y install "${base_url}/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ arm64) \ - yum -y install "${base_url}/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ *) \ exit 1 ;; \ @@ -79,7 +79,7 @@ RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ set -xe ; \ rm -f /etc/rhsm-host ; \ SUBSCRIPTION_NAME="${SUBSCRIPTION_NAME}" bash /run/secrets/subscription.sh ; \ - yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm ; \ + yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-%%UBI_MAJOR_VERSION%%.noarch.rpm ; \ ARCH="${TARGETARCH}" ; \ case $ARCH in \ amd64) \ @@ -89,7 +89,7 @@ RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ *) \ exit 1 ;; \ esac ; \ - yum -y install --enablerepo=ubi-8-codeready-builder,codeready-builder-for-rhel-8-${BUILDARCH}-rpms \ + yum -y install --enablerepo=ubi-%%UBI_MAJOR_VERSION%%-codeready-builder,codeready-builder-for-rhel-%%UBI_MAJOR_VERSION%%-${BUILDARCH}-rpms \ postgis%%POSTGIS_MAJOR%%_%%PG_MAJOR%%-%%POSTGIS_VERSION%% \ pgrouting_%%PG_MAJOR%% \ ; \ diff --git a/UBI/Dockerfile-postgis.template b/UBI/Dockerfile-postgis.template index e372b11a..137c3adb 100644 --- a/UBI/Dockerfile-postgis.template +++ b/UBI/Dockerfile-postgis.template @@ -9,7 +9,7 @@ LABEL name="PostgreSQL + PostGIS Container Images" \ version="%%POSTGRES_VERSION%%" \ release="%%IMAGE_RELEASE_VERSION%%" \ summary="PostgreSQL + PostGIS Container images." \ - description="This Docker image contains PostgreSQL, PostGIS and Barman Cloud based on RedHat Universal Base Images (UBI) 8." + description="This Docker image contains PostgreSQL, PostGIS and Barman Cloud based on RedHat Universal Base Images (UBI) %%UBI_MAJOR_VERSION%%." COPY root/ / @@ -20,10 +20,10 @@ RUN set -xe ; \ pg_audit_pkg="pgaudit%%PGAUDIT_VERSION%%_%%PG_MAJOR%%" ; \ case $ARCH in \ amd64) \ - yum -y install "${base_url}/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ arm64) \ - yum -y install "${base_url}/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ *) \ exit 1 ;; \ @@ -78,7 +78,7 @@ RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ set -xe ; \ rm -f /etc/rhsm-host ; \ SUBSCRIPTION_NAME="${SUBSCRIPTION_NAME}" bash /run/secrets/subscription.sh ; \ - yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm ; \ + yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-%%UBI_MAJOR_VERSION%%.noarch.rpm ; \ ARCH="${TARGETARCH}" ; \ case $ARCH in \ amd64) \ @@ -88,7 +88,7 @@ RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ *) \ exit 1 ;; \ esac ; \ - yum -y install --enablerepo=ubi-8-codeready-builder,codeready-builder-for-rhel-8-${BUILDARCH}-rpms \ + yum -y install --enablerepo=ubi-%%UBI_MAJOR_VERSION%%-codeready-builder,codeready-builder-for-rhel-%%UBI_MAJOR_VERSION%%-${BUILDARCH}-rpms \ postgis%%POSTGIS_MAJOR%%_%%PG_MAJOR%%-%%POSTGIS_VERSION%% \ pgrouting_%%PG_MAJOR%% \ ; \ diff --git a/UBI/Dockerfile.template b/UBI/Dockerfile.template index da3c8dd4..9f41ec7b 100644 --- a/UBI/Dockerfile.template +++ b/UBI/Dockerfile.template @@ -8,7 +8,7 @@ LABEL name="PostgreSQL Container Images" \ version="%%POSTGRES_VERSION%%" \ release="%%IMAGE_RELEASE_VERSION%%" \ summary="PostgreSQL Container images." \ - description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) 8." + description="This Docker image contains PostgreSQL and Barman Cloud based on RedHat Universal Base Images (UBI) %%UBI_MAJOR_VERSION%%." COPY root/ / @@ -19,10 +19,10 @@ RUN set -xe ; \ pg_audit_pkg="pgaudit%%PGAUDIT_VERSION%%_%%PG_MAJOR%%" ; \ case $ARCH in \ amd64) \ - yum -y install "${base_url}/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-x86_64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ arm64) \ - yum -y install "${base_url}/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ + yum -y install "${base_url}/EL-%%UBI_MAJOR_VERSION%%-aarch64/pgdg-redhat-repo-latest.noarch.rpm" ; \ if [ "%%PG_MAJOR%%" -gt "15" ]; then pg_audit_pkg="pgaudit_%%PG_MAJOR%%"; fi ;; \ *) \ exit 1 ;; \ diff --git a/UBI/update.sh b/UBI/update.sh index 2a332756..9c0af4ef 100755 --- a/UBI/update.sh +++ b/UBI/update.sh @@ -25,8 +25,8 @@ _raw_ubi_tags() { local version="$1"; shift local data data=$(curl -sL "https://registry.access.redhat.com/v2/ubi${version}/ubi/tags/list") - jq -r '.tags[] | select(startswith("'"$version"'"))' <<<"$data" | - grep -v -- "-source" | sort -rV | head -n 1 + jq -r --arg v "$version" '.tags[] | select(startswith($v))' <<<"$data" | + grep -v -- "-source" | sort -rV | head -n 1 } # Get the latest UBI tag @@ -177,32 +177,45 @@ record_version() { generate_redhat() { local version="$1"; shift - ubiRelease="8" + ubi8Release="8" + ubi9Release="9" local versionFile="${version}/.versions.json" imageReleaseVersion=1 # cache the result - get_latest_ubi_base "${ubiRelease}" >/dev/null - get_latest_barman_version >/dev/null - - ubiVersion=$(get_latest_ubi_base "${ubiRelease}") - if [ -z "$ubiVersion" ]; then - echo "Unable to retrieve latest UBI${ubiRelease} version" + echo "Getting latest UBI versions" +# get_latest_ubi_base $ubi8Release >/dev/null +# get_latest_ubi_base $ubi9Release >/dev/null +# get_latest_barman_version >/dev/null + + ubi8Version=$(get_latest_ubi_base $ubi8Release) + ubi9Version=$(get_latest_ubi_base $ubi9Release) + echo "Latest UBI8 version: $ubi8Version" + echo "Latest UBI9 version: $ubi9Version" + if [ -z "$ubi8Version" ]; then + echo "Unable to retrieve latest UBI${ubi8Release} version" + exit 1 + fi + if [ -z "$ubi9Version" ]; then + echo "Unable to retrieve latest UBI${ubi9Release} version" exit 1 fi - pg_x86_64=$(get_postgresql_version "${ubiRelease}" 'x86_64' "$version") - pg_ppc64le=$(get_postgresql_version "${ubiRelease}" 'ppc64le' "$version") - pg_s390x=$(get_postgresql_version "${ubiRelease}" 's390x' "$version") - pg_arm64=$(get_postgresql_version "${ubiRelease}" 'aarch64' "$version") - if ! compare_architecture_pkgs "$pg_x86_64" "$pg_arm64" "$pg_ppc64le" "$pg_s390x"; then + ubi8_pg_x86_64=$(get_postgresql_version "${ubi8Release}" 'x86_64' "$version") + ubi8_pg_ppc64le=$(get_postgresql_version "${ubi8Release}" 'ppc64le' "$version") + ubi8_pg_s390x=$(get_postgresql_version "${ubi8Release}" 's390x' "$version") + ubi8_pg_arm64=$(get_postgresql_version "${ubi8Release}" 'aarch64' "$version") + if ! compare_architecture_pkgs "$ubi8_pg_x86_64" "$ubi8_pg_arm64" "$ubi8_pg_ppc64le" "$ubi8_pg_s390x"; then return fi - postgresqlVersion="${pg_x86_64}" - if [ -z "$postgresqlVersion" ]; then - echo "Unable to retrieve latest PostgreSQL $version version" + # Currently there is only one postgres version for ubi8 and 9. This variable can be confusing when we use it for + # UBI 9 but I thought it was best to be clear that we get the postgresversion from the UBI8 repo and then use that + # for both UBI8 and UBI9 + postgresqlUBI8Version="${ubi8_pg_x86_64}" + if [ -z "$postgresqlUBI8Version" ]; then + echo "Unable to retrieve latest PostgreSQL $version version for UBI $ubi8Release" return fi @@ -228,7 +241,8 @@ generate_redhat() { echo "$version: ${postgresqlVersion}" if [ -f "${versionFile}" ]; then - oldUbiVersion=$(jq -r '.UBI_VERSION' "${versionFile}") + oldUbi8Version=$(jq -r '.UBI8_VERSION' "${versionFile}") + oldUbi9Version=$(jq -r '.UBI9_VERSION' "${versionFile}") oldPostgresqlVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") oldBarmanVersion=$(jq -r '.BARMAN_VERSION' "${versionFile}") oldImageReleaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") @@ -237,8 +251,9 @@ generate_redhat() { imageReleaseVersion=1 echo "{}" > "${versionFile}" - record_version "${versionFile}" "UBI_VERSION" "${ubiVersion}" - record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" + record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" + record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" + record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlUBI8Version}" record_version "${versionFile}" "BARMAN_VERSION" "${barmanVersion}" record_version "${versionFile}" "IMAGE_RELEASE_VERSION" "${imageReleaseVersion}" @@ -248,10 +263,16 @@ generate_redhat() { newRelease="false" # Detect an update of UBI image - if [ "$oldUbiVersion" != "$ubiVersion" ]; then - echo "UBI changed from $oldUbiVersion to $ubiVersion" + if [ "$oldUbi8Version" != "$ubi8Version" ]; then + echo "UBI changed from $oldUbi8Version to $ubi8Version" newRelease="true" - record_version "${versionFile}" "UBI_VERSION" "${ubiVersion}" + record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" + fi + + if [ "$oldUbi9Version" != "$ubi9Version" ]; then + echo "UBI changed from $oldUbi9Version to $ubi9Version" + newRelease="true" + record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" fi # Detect an update of Barman @@ -262,9 +283,9 @@ generate_redhat() { fi # Detect an update of PostgreSQL - if [ "$oldPostgresqlVersion" != "$postgresqlVersion" ]; then - echo "PostgreSQL changed from $oldPostgresqlVersion to $postgresqlVersion" - record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" + if [ "$oldPostgresqlVersion" != "$postgresqlUBI8Version" ]; then + echo "PostgreSQL changed from $oldPostgresqlVersion to $postgresqlUBI8Version" + record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlUBI8Version}" record_version "${versionFile}" "IMAGE_RELEASE_VERSION" 1 imageReleaseVersion=1 elif [ "$newRelease" = "true" ]; then @@ -273,32 +294,65 @@ generate_redhat() { fi rm -fr "${version:?}"/* - sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + sed -e 's/%%UBI_VERSION%%/'"$ubi8Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi8Release"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile.template \ - >"$version/Dockerfile" + >"$version/Dockerfile.ubi8" - sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + sed -e 's/%%UBI_VERSION%%/'"$ubi8Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi8Release"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile-multilang.template \ - >"$version/Dockerfile.multilang" + >"$version/Dockerfile.multilang.ubi8" - sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + sed -e 's/%%UBI_VERSION%%/'"$ubi8Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi8Release"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ + -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ + Dockerfile-multiarch.template \ + >"$version/Dockerfile.multiarch.ubi8" + + sed -e 's/%%UBI_VERSION%%/'"$ubi9Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/g' \ + -e 's/%%PG_MAJOR%%/'"$version"'/g' \ + -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ + -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ + Dockerfile.template \ + >"$version/Dockerfile.ubi9" + + sed -e 's/%%UBI_VERSION%%/'"$ubi9Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/g' \ + -e 's/%%PG_MAJOR%%/'"$version"'/g' \ + -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ + -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ + Dockerfile-multilang.template \ + >"$version/Dockerfile.multilang.ubi9" + + sed -e 's/%%UBI_VERSION%%/'"$ubi9Version"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/g' \ + -e 's/%%PG_MAJOR%%/'"$version"'/g' \ + -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile-multiarch.template \ - >"$version/Dockerfile.multiarch" + >"$version/Dockerfile.multiarch.ubi9" cp -r src/* "$version/" } @@ -311,10 +365,10 @@ generate_redhat_postgis() { imageReleaseVersion=1 # cache the result - get_latest_ubi_base "${ubiRelease}" >/dev/null + get_latest_ubi_base $ubiRelease >/dev/null get_latest_barman_version >/dev/null - ubiVersion=$(get_latest_ubi_base "${ubiRelease}") + ubiVersion=$(get_latest_ubi_base $ubiRelease) if [ -z "$ubiVersion" ]; then echo "Unable to retrieve latest UBI${ubiRelease} version" exit 1 @@ -429,6 +483,7 @@ generate_redhat_postgis() { cp update-postgis.sh "$version/" sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"8"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ @@ -440,6 +495,7 @@ generate_redhat_postgis() { >"$version/Dockerfile.postgis" sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"8"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ @@ -471,6 +527,7 @@ update_requirements() { update_requirements for version in "${versions[@]}"; do + echo "Generating Dockerfiles for $version" generate_redhat "${version}" generate_redhat_postgis "${version}" done