From 740b039a2ffd43e8f13d71b8ebe710ba3478fd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Wed, 24 Jan 2024 17:54:28 +0100 Subject: [PATCH] chore: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niccolò Fei --- .github/generate-strategy.sh | 244 ++++++++++++++++++----------------- .github/workflows/build.yml | 1 - README.md | 2 +- UBI/update.sh | 139 +++++++------------- 4 files changed, 173 insertions(+), 213 deletions(-) diff --git a/.github/generate-strategy.sh b/.github/generate-strategy.sh index 1e9a8aa9..81009196 100755 --- a/.github/generate-strategy.sh +++ b/.github/generate-strategy.sh @@ -39,132 +39,142 @@ join() { echo "${out#$sep}" } -entries=() - -# UBI -cd "$BASE_DIRECTORY"/UBI/ -for version in "${ubi_versions[@]}"; do - - # Read versions from the definition file - 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" - # A "-beta" suffix will be appended to the beta images. - if [ "${version}" -gt '16' ]; then - fullVersion=$(jq -r '.POSTGRES_VERSION | split("_") | .[0]' "${versionFile}") - versionAliases=( - "${version}-beta" - ${aliases[$version]:+"${aliases[$version]}"} - "${fullVersion}-${releaseVersion}" - ) - versionAliasesMultiLang=( - "${version}-beta-multilang" - ${aliases[$version]:+"${aliases[$version]}-multilang"} - "${fullVersion}-${releaseVersion}-multilang" - ) - versionAliasesMultiArch=( - "${version}-beta-multiarch" - ${aliases[$version]:+"${aliases[$version]}-multiarch"} - "${fullVersion}-${releaseVersion}-multiarch" - ) - else - versionAliases=( - "${version}" - ${aliases[$version]:+"${aliases[$version]}"} - "${fullVersion}-${releaseVersion}" - ) - versionAliasesMultiLang=( - "${version}-multilang" - ${aliases[$version]:+"${aliases[$version]}-multilang"} - "${fullVersion}-${releaseVersion}-multilang" - ) - versionAliasesMultiArch=( - "${version}-multiarch" - ${aliases[$version]:+"${aliases[$version]}-multiarch"} - "${fullVersion}-${releaseVersion}-multiarch" +generator() { + local ubiRelease="$1"; shift + + cd "$BASE_DIRECTORY"/UBI/ + for version in "${ubi_versions[@]}"; do + + versionFile="${version}/.versions-ubi${ubiRelease}.json" + ubiVersion=$(jq -r '.UBI_VERSION' "${versionFile}") + fullVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") + releaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") + + # Initial aliases are "major version", "optional alias", "full version with release" + # i.e. "13", "latest", "13.2-1" + # A "-beta" suffix will be appended to the beta images. + if [ "${version}" -gt '16' ]; then + fullVersion=$(jq -r '.POSTGRES_VERSION | split("_") | .[0]' "${versionFile}") + versionAliases=( + "${version}-beta" + ${aliases[$version]:+"${aliases[$version]}"} + "${fullVersion}-${releaseVersion}" + ) + versionAliasesMultiLang=( + "${version}-beta-multilang" + ${aliases[$version]:+"${aliases[$version]}-multilang"} + "${fullVersion}-${releaseVersion}-multilang" + ) + versionAliasesMultiArch=( + "${version}-beta-multiarch" + ${aliases[$version]:+"${aliases[$version]}-multiarch"} + "${fullVersion}-${releaseVersion}-multiarch" + ) + else + versionAliases=( + "${version}" + ${aliases[$version]:+"${aliases[$version]}"} + "${fullVersion}-${releaseVersion}" + ) + versionAliasesMultiLang=( + "${version}-multilang" + ${aliases[$version]:+"${aliases[$version]}-multilang"} + "${fullVersion}-${releaseVersion}-multilang" + ) + versionAliasesMultiArch=( + "${version}-multiarch" + ${aliases[$version]:+"${aliases[$version]}-multiarch"} + "${fullVersion}-${releaseVersion}-multiarch" + ) + fi + + # Add all the version prefixes between full version and major version + # i.e "13.2" + while [ "$fullVersion" != "$version" ] && [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do + versionAliases+=("$fullVersion") + versionAliasesMultiLang+=("$fullVersion-multilang") + versionAliasesMultiArch+=("$fullVersion-multiarch") + fullVersion="${fullVersion%[.-]*}" + done + + platforms="linux/amd64, linux/arm64" + platformsMultiArch="${platforms}, linux/ppc64le,linux/s390x" + + # Build the json entry + entries+=( + "{\"name\": \"${fullVersion} UBI${ubiRelease}\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.ubi${ubiRelease}\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliases[@]}")\"]}" + "{\"name\": \"${fullVersion} UBI${ubiRelease} MultiLang\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multilang.ubi${ubiRelease}\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiLang[@]}")\"]}" + "{\"name\": \"${fullVersion} UBI${ubiRelease} MultiArch\", \"ubi_version\": \"$ubiVersion\", \"platforms\": \"$platformsMultiArch\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.multiarch.ubi${ubiRelease}\", \"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiArch[@]}")\"]}" ) - fi - # Add all the version prefixes between full version and major version - # i.e "13.2" - while [ "$fullVersion" != "$version" ] && [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do - versionAliases+=("$fullVersion") - versionAliasesMultiLang+=("$fullVersion-multilang") - versionAliasesMultiArch+=("$fullVersion-multiarch") - fullVersion="${fullVersion%[.-]*}" done +} - platforms="linux/amd64, linux/arm64" - platformsMultiArch="${platforms}, linux/ppc64le,linux/s390x" - - # Build the json entry - for ubiVersion in "$ubi8Version" "$ubi9Version"; do - majorVersion="${ubiVersion%%.*}" +generator_postgis() { + local ubiRelease="$1"; shift + + cd "$BASE_DIRECTORY"/UBI/ + for version in "${ubi_versions[@]}"; do + + # Read versions from the definition file + versionFile="${version}/.versions-postgis.json" + fullVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") + postgisVersion=$(jq -r '.POSTGIS_VERSION' "${versionFile}" | cut -f1,2 -d.) + releaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") + + # Initial aliases are "major version", "optional alias", "full version with release" + # i.e. "13", "latest", "13.2-1" + # A "-beta" suffix will be appended to the beta images. + if [ "${version}" -gt '16' ]; then + fullVersion=$(jq -r '.POSTGRES_VERSION | split("_") | .[0]' "${versionFile}") + versionAliases=( + "${version}-beta-postgis" + ${aliases[$version]:+"${aliases[$version]}-postgis"} + "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}" + ) + versionAliasesMultiLang=( + "${version}-beta-postgis-multilang" + ${aliases[$version]:+"${aliases[$version]}-postgis-multilang"} + "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}-multilang" + ) + else + versionAliases=( + "${version}-postgis" + ${aliases[$version]:+"${aliases[$version]}-postgis"} + "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}" + ) + versionAliasesMultiLang=( + "${version}-postgis-multilang" + ${aliases[$version]:+"${aliases[$version]}-postgis-multilang"} + "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}-multilang" + ) + fi + + # Add all the version prefixes between full version and major version + # i.e "13.2" + while [ "$fullVersion" != "$version" ] && [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do + versionAliases+=("$fullVersion-${postgisVersion}-postgis") + versionAliasesMultiLang+=("$fullVersion-${postgisVersion}-postgis-multilang") + fullVersion="${fullVersion%[.-]*}" + done + + platforms="linux/amd64,linux/arm64" + + # Build the json entry 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[@]}")\"]}" + "{\"name\": \"PostGIS ${fullVersion}-${postgisVersion} UBI${ubiRelease}\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.postgis\",\"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliases[@]}")\"]}" + "{\"name\": \"PostGIS ${fullVersion}-${postgisVersion} UBI${ubiRelease} MultiLang\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.postgis-multilang\",\"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiLang[@]}")\"]}" ) done -done +} -# UBI PostGIS -for version in "${ubi_versions[@]}"; do - - # Read versions from the definition file - versionFile="${version}/.versions-postgis.json" - fullVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") - postgisVersion=$(jq -r '.POSTGIS_VERSION' "${versionFile}" | cut -f1,2 -d.) - releaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") - - # Initial aliases are "major version", "optional alias", "full version with release" - # i.e. "13", "latest", "13.2-1" - # A "-beta" suffix will be appended to the beta images. - if [ "${version}" -gt '16' ]; then - fullVersion=$(jq -r '.POSTGRES_VERSION | split("_") | .[0]' "${versionFile}") - versionAliases=( - "${version}-beta-postgis" - ${aliases[$version]:+"${aliases[$version]}-postgis"} - "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}" - ) - versionAliasesMultiLang=( - "${version}-beta-postgis-multilang" - ${aliases[$version]:+"${aliases[$version]}-postgis-multilang"} - "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}-multilang" - ) - else - versionAliases=( - "${version}-postgis" - ${aliases[$version]:+"${aliases[$version]}-postgis"} - "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}" - ) - versionAliasesMultiLang=( - "${version}-postgis-multilang" - ${aliases[$version]:+"${aliases[$version]}-postgis-multilang"} - "${fullVersion}-${postgisVersion}-postgis-${releaseVersion}-multilang" - ) - fi - - # Add all the version prefixes between full version and major version - # i.e "13.2" - while [ "$fullVersion" != "$version" ] && [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do - versionAliases+=("$fullVersion-${postgisVersion}-postgis") - versionAliasesMultiLang+=("$fullVersion-${postgisVersion}-postgis-multilang") - fullVersion="${fullVersion%[.-]*}" - done +entries=() - platforms="linux/amd64,linux/arm64" +# UBI +generator "8" +generator "9" - # Build the json entry - entries+=( - "{\"name\": \"UBI PostGIS ${fullVersion}-${postgisVersion}\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.postgis\",\"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliases[@]}")\"]}" - "{\"name\": \"UBI PostGIS ${fullVersion}-${postgisVersion} MultiLang\", \"platforms\": \"$platforms\", \"dir\": \"UBI/$version\", \"file\": \"UBI/$version/Dockerfile.postgis-multilang\",\"version\": \"$version\", \"tags\": [\"$(join "\", \"" "${versionAliasesMultiLang[@]}")\"]}" - ) -done +# UBI PostGIS +generator "8" # Build the strategy as a JSON object strategy="{\"fail-fast\": false, \"matrix\": {\"include\": [$(join ', ' "${entries[@]}")]}}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 136f461b..3290589d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,6 @@ 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/README.md b/README.md index d2d16d12..1444296a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Maintenance scripts to generate Immutable Application Containers for all available PostgreSQL versions (12 to 16) based on -Red Hat Universal Base Images (UBI) 8: +Red Hat Universal Base Images (UBI) 8 and 9: - Standard minimal image - amd64/arm64 - multilang version (all Locales installed) - amd64/arm64 diff --git a/UBI/update.sh b/UBI/update.sh index 9c0af4ef..12794b1b 100755 --- a/UBI/update.sh +++ b/UBI/update.sh @@ -177,45 +177,32 @@ record_version() { generate_redhat() { local version="$1"; shift - ubi8Release="8" - ubi9Release="9" - local versionFile="${version}/.versions.json" + local ubiRelease="$1"; shift + local versionFile="${version}/.versions-ubi${ubiRelease}.json" imageReleaseVersion=1 # cache the result - 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" + 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" exit 1 fi - 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 + 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 return fi - # 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" + postgresqlVersion="${pg_x86_64}" + if [ -z "$postgresqlVersion" ]; then + echo "Unable to retrieve latest PostgreSQL $version version for UBI$ubiRelease" return fi @@ -238,11 +225,10 @@ generate_redhat() { fi # Output the full Postgresql package name - echo "$version: ${postgresqlVersion}" + echo "$version: ${postgresqlVersion} (UBI${ubiRelease})" if [ -f "${versionFile}" ]; then - oldUbi8Version=$(jq -r '.UBI8_VERSION' "${versionFile}") - oldUbi9Version=$(jq -r '.UBI9_VERSION' "${versionFile}") + oldUbiVersion=$(jq -r '.UBI_VERSION' "${versionFile}") oldPostgresqlVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") oldBarmanVersion=$(jq -r '.BARMAN_VERSION' "${versionFile}") oldImageReleaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") @@ -251,9 +237,8 @@ generate_redhat() { imageReleaseVersion=1 echo "{}" > "${versionFile}" - record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" - record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" - record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlUBI8Version}" + record_version "${versionFile}" "UBI_VERSION" "${ubiVersion}" + record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" record_version "${versionFile}" "BARMAN_VERSION" "${barmanVersion}" record_version "${versionFile}" "IMAGE_RELEASE_VERSION" "${imageReleaseVersion}" @@ -263,16 +248,10 @@ generate_redhat() { newRelease="false" # Detect an update of UBI image - if [ "$oldUbi8Version" != "$ubi8Version" ]; then - echo "UBI changed from $oldUbi8Version to $ubi8Version" - newRelease="true" - record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" - fi - - if [ "$oldUbi9Version" != "$ubi9Version" ]; then - echo "UBI changed from $oldUbi9Version to $ubi9Version" + if [ "$oldUbiVersion" != "$ubiVersion" ]; then + echo "UBI changed from $oldUbiVersion to $ubiVersion" newRelease="true" - record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" + record_version "${versionFile}" "UBI_VERSION" "${ubiVersion}" fi # Detect an update of Barman @@ -283,9 +262,9 @@ generate_redhat() { fi # Detect an update of PostgreSQL - if [ "$oldPostgresqlVersion" != "$postgresqlUBI8Version" ]; then - echo "PostgreSQL changed from $oldPostgresqlVersion to $postgresqlUBI8Version" - record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlUBI8Version}" + if [ "$oldPostgresqlVersion" != "$postgresqlVersion" ]; then + echo "PostgreSQL changed from $oldPostgresqlVersion to $postgresqlVersion" + record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" record_version "${versionFile}" "IMAGE_RELEASE_VERSION" 1 imageReleaseVersion=1 elif [ "$newRelease" = "true" ]; then @@ -293,66 +272,38 @@ generate_redhat() { record_version "${versionFile}" "IMAGE_RELEASE_VERSION" $imageReleaseVersion fi - rm -fr "${version:?}"/* - 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%%/'"$postgresqlUBI8Version"'/g' \ - -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ - -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ - Dockerfile.template \ - >"$version/Dockerfile.ubi8" - - 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%%/'"$postgresqlUBI8Version"'/g' \ - -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ - -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ - Dockerfile-multilang.template \ - >"$version/Dockerfile.multilang.ubi8" + rm -fr "${version:?}/root" \ + "${version:?}/Dockerfile*${ubiRelease}" - 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%%/'"$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' \ + sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubiRelease"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile.template \ - >"$version/Dockerfile.ubi9" + >"$version/Dockerfile.ubi${ubiRelease}" - sed -e 's/%%UBI_VERSION%%/'"$ubi9Version"'/g' \ - -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/g' \ + sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubiRelease"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile-multilang.template \ - >"$version/Dockerfile.multilang.ubi9" + >"$version/Dockerfile.multilang.ubi${ubiRelease}" - sed -e 's/%%UBI_VERSION%%/'"$ubi9Version"'/g' \ - -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/g' \ + sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubiRelease"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ - -e 's/%%POSTGRES_VERSION%%/'"$postgresqlUBI8Version"'/g' \ + -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ -e 's/%%PGAUDIT_VERSION%%/'"$pgauditVersion"'/g' \ -e 's/%%IMAGE_RELEASE_VERSION%%/'"$imageReleaseVersion"'/g' \ Dockerfile-multiarch.template \ - >"$version/Dockerfile.multiarch.ubi9" + >"$version/Dockerfile.multiarch.ubi${ubiRelease}" cp -r src/* "$version/" } @@ -420,7 +371,7 @@ generate_redhat_postgis() { fi # Output the full Postgresql and PostGIS package name - echo "$version: ${postgresqlVersion} - PostGIS ${postgisVersion}" + echo "$version: ${postgresqlVersion} - PostGIS ${postgisVersion} (UBI${ubiRelease})" if [ -f "${versionFile}" ]; then oldUbiVersion=$(jq -r '.UBI_VERSION' "${versionFile}") @@ -483,7 +434,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/%%UBI_MAJOR_VERSION%%/'"$ubiRelease"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ @@ -495,7 +446,7 @@ generate_redhat_postgis() { >"$version/Dockerfile.postgis" sed -e 's/%%UBI_VERSION%%/'"$ubiVersion"'/g' \ - -e 's/%%UBI_MAJOR_VERSION%%/'"8"'/g' \ + -e 's/%%UBI_MAJOR_VERSION%%/'"$ubiRelease"'/g' \ -e 's/%%PG_MAJOR%%/'"$version"'/g' \ -e 's/%%YUM_OPTIONS%%/'"${yumOptions}"'/g' \ -e 's/%%POSTGRES_VERSION%%/'"$postgresqlVersion"'/g' \ @@ -527,7 +478,7 @@ update_requirements() { update_requirements for version in "${versions[@]}"; do - echo "Generating Dockerfiles for $version" - generate_redhat "${version}" + generate_redhat "${version}" "8" + generate_redhat "${version}" "9" generate_redhat_postgis "${version}" done