Skip to content

Commit

Permalink
feat: adding ubi9 image builds
Browse files Browse the repository at this point in the history
Signed-off-by: John Long <[email protected]>
  • Loading branch information
jlong49 authored and NiccoloFei committed Jan 25, 2024
1 parent 904bcee commit bcc77ca
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 61 deletions.
15 changes: 10 additions & 5 deletions .github/generate-strategy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions UBI/Dockerfile-multiarch.template
Original file line number Diff line number Diff line change
Expand Up @@ -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/ /

Expand All @@ -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) \
Expand Down
6 changes: 3 additions & 3 deletions UBI/Dockerfile-multilang.template
Original file line number Diff line number Diff line change
Expand Up @@ -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/ /

Expand All @@ -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 ;; \
Expand Down
10 changes: 5 additions & 5 deletions UBI/Dockerfile-postgis-multilang.template
Original file line number Diff line number Diff line change
Expand Up @@ -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/ /

Expand All @@ -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 ;; \
Expand Down Expand Up @@ -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) \
Expand All @@ -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%% \
; \
Expand Down
10 changes: 5 additions & 5 deletions UBI/Dockerfile-postgis.template
Original file line number Diff line number Diff line change
Expand Up @@ -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/ /

Expand All @@ -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 ;; \
Expand Down Expand Up @@ -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) \
Expand All @@ -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%% \
; \
Expand Down
6 changes: 3 additions & 3 deletions UBI/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -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/ /

Expand All @@ -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 ;; \
Expand Down
Loading

0 comments on commit bcc77ca

Please sign in to comment.