From 9488eab07b383c27702c2fc9b25e088b06b0bea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Fri, 2 Dec 2022 10:14:16 +0100 Subject: [PATCH] ci: remove rhsm-host symlink and set a custom subscription name (#125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove rhsm-host symlink and set a custom subscription name * Restore the /etc/rhsm-host symlink after we don't need it Signed-off-by: Niccolò Fei Signed-off-by: Jonathan Gonzalez V Co-authored-by: Jonathan Gonzalez V --- .github/workflows/build.yml | 4 ++++ .github/workflows/ci.yml | 1 + UBI/Dockerfile-postgis.template | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40e450a42..566dfa6a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,8 @@ jobs: push: false load: true tags: ${{ env.TAGS }} + build-args: | + SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }} - name: Dockle scan uses: erzz/dockle-action@v1 @@ -109,6 +111,8 @@ jobs: push: true tags: ${{ env.TAGS }} labels: ${{ github.ref != 'refs/heads/main' && 'quay.expires-after=7d' || '' }} + build-args: | + SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }} - name: Slack Notification uses: rtCamp/action-slack-notify@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 511c91955..0f12bbf42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,7 @@ jobs: tags: ${{ env.TAGS }} load: true build-args: | + SUBSCRIPTION_NAME=docker-postgresql-cicd-${{ github.run_number }} ${{ env.BUILD-ARGS }} - name: History ${{ matrix.name }} diff --git a/UBI/Dockerfile-postgis.template b/UBI/Dockerfile-postgis.template index 19cf5041c..43bbe2836 100644 --- a/UBI/Dockerfile-postgis.template +++ b/UBI/Dockerfile-postgis.template @@ -1,5 +1,6 @@ # vim:set ft=dockerfile: FROM quay.io/enterprisedb/edb-ubi:%%UBI_VERSION%% +ARG SUBSCRIPTION_NAME # Do not split the description, otherwise we will see a blank space in the labels LABEL name="PostgreSQL + PostGIS Container Images" \ @@ -61,7 +62,8 @@ RUN mkdir /docker-entrypoint-initdb.d # Postgis RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ set -xe ; \ - bash /run/secrets/subscription.sh ; \ + 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 --enablerepo=ubi-8-codeready-builder,codeready-builder-for-rhel-8-x86_64-rpms \ postgis%%POSTGIS_MAJOR%%_%%PG_MAJOR%%-%%POSTGIS_VERSION%% ; \ @@ -70,6 +72,7 @@ RUN --mount=type=secret,id=subscription,target=/run/secrets/subscription.sh \ subscription-manager unregister ; \ subscription-manager clean ; \ yum -y clean all --enablerepo='*' ; \ + ln -sf /run/secrets/rhsm /etc/rhsm-host ; \ rm /var/log/rhsm/rhsm.log COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh