diff --git a/UBI/update.sh b/UBI/update.sh index 5da65e98..de23a748 100755 --- a/UBI/update.sh +++ b/UBI/update.sh @@ -186,7 +186,6 @@ generate_redhat() { # cache the result echo "Getting latest UBI versions" - echo "the ubi releases are $ubi8Release and $ubi9Release" # get_latest_ubi_base $ubi8Release >/dev/null # get_latest_ubi_base $ubi9Release >/dev/null # get_latest_barman_version >/dev/null @@ -212,17 +211,9 @@ generate_redhat() { return fi - ubi9_pg_x86_64=$(get_postgresql_version "${ubi9Release}" 'x86_64' "$version") - ubi9_pg_ppc64le=$(get_postgresql_version "${ubi9Release}" 'ppc64le' "$version") - ubi9_pg_s390x=$(get_postgresql_version "${ubi9Release}" 's390x' "$version") - ubi9_pg_arm64=$(get_postgresql_version "${ubi9Release}" 'aarch64' "$version") - if ! compare_architecture_pkgs "$ubi9_pg_x86_64" "$ubi9_pg_arm64" "$ubi9_pg_ppc64le" "$ubi9_pg_s390x"; then - return - fi - - postgresqlVersion="${ubi8_pg_x86_64}" - if [ -z "$postgresqlVersion" ]; then - echo "Unable to retrieve latest PostgreSQL $version version" + postgresqlUBI8Version="${ubi8_pg_x86_64}" + if [ -z "$postgresqlUBI8Version" ]; then + echo "Unable to retrieve latest PostgreSQL $version version for UBI $ubi8Release" return fi @@ -248,7 +239,6 @@ generate_redhat() { echo "$version: ${postgresqlVersion}" if [ -f "${versionFile}" ]; then - echo "versionFile exists" oldUbi8Version=$(jq -r '.UBI8_VERSION' "${versionFile}") oldUbi9Version=$(jq -r '.UBI9_VERSION' "${versionFile}") oldPostgresqlVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") @@ -256,13 +246,12 @@ generate_redhat() { oldImageReleaseVersion=$(jq -r '.IMAGE_RELEASE_VERSION' "${versionFile}") imageReleaseVersion=$oldImageReleaseVersion else - echo "versionFile does not exist" imageReleaseVersion=1 echo "{}" > "${versionFile}" record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" - record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" + record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlUBI8Version}" record_version "${versionFile}" "BARMAN_VERSION" "${barmanVersion}" record_version "${versionFile}" "IMAGE_RELEASE_VERSION" "${imageReleaseVersion}" @@ -275,13 +264,13 @@ generate_redhat() { if [ "$oldUbi8Version" != "$ubi8Version" ]; then echo "UBI changed from $oldUbi8Version to $ubi8Version" newRelease="true" - record_version "${versionFile}" "UBI_VERSION" "${ubi8Version}" + record_version "${versionFile}" "UBI8_VERSION" "${ubi8Version}" fi if [ "$oldUbi9Version" != "$ubi9Version" ]; then echo "UBI changed from $oldUbi9Version to $ubi9Version" newRelease="true" - record_version "${versionFile}" "UBI_VERSION" "${ubi9Version}" + record_version "${versionFile}" "UBI9_VERSION" "${ubi9Version}" fi # Detect an update of Barman @@ -292,9 +281,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 @@ -307,7 +296,7 @@ generate_redhat() { -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 \ @@ -317,7 +306,7 @@ generate_redhat() { -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 \ @@ -327,7 +316,7 @@ generate_redhat() { -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 \ @@ -337,7 +326,7 @@ generate_redhat() { -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/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 \ @@ -347,7 +336,7 @@ generate_redhat() { -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/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 \ @@ -357,7 +346,7 @@ generate_redhat() { -e 's/%%UBI_MAJOR_VERSION%%/'"$ubi9Release"'/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 \ @@ -432,7 +421,7 @@ generate_redhat_postgis() { echo "$version: ${postgresqlVersion} - PostGIS ${postgisVersion}" if [ -f "${versionFile}" ]; then - oldUbiVersion=$(jq -r '.UBI8_VERSION' "${versionFile}") + oldUbiVersion=$(jq -r '.UBI_VERSION' "${versionFile}") oldPostgresqlVersion=$(jq -r '.POSTGRES_VERSION' "${versionFile}") oldPostgisVersion=$(jq -r '.POSTGIS_VERSION' "${versionFile}") oldBarmanVersion=$(jq -r '.BARMAN_VERSION' "${versionFile}") @@ -442,7 +431,7 @@ generate_redhat_postgis() { imageReleaseVersion=1 echo "{}" > "${versionFile}" - record_version "${versionFile}" "UBI8_VERSION" "${ubiVersion}" + record_version "${versionFile}" "UBI_VERSION" "${ubiVersion}" record_version "${versionFile}" "POSTGRES_VERSION" "${postgresqlVersion}" record_version "${versionFile}" "POSTGIS_VERSION" "${postgisVersion}" record_version "${versionFile}" "BARMAN_VERSION" "${barmanVersion}" @@ -492,6 +481,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' \ @@ -503,6 +493,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' \ @@ -515,9 +506,7 @@ generate_redhat_postgis() { } update_requirements() { - echo "Updating requirements" barmanVersion=$(get_latest_barman_version) - echo "Latest barman version: $barmanVersion" # If there's a new version we need to recreate the requirements files echo "barman[cloud,azure,snappy,google] == $barmanVersion" > requirements.in