From d4b7db2c9ac2284c5393cedec53b1004508ac0bd Mon Sep 17 00:00:00 2001 From: mbussolotto Date: Wed, 13 Sep 2023 14:54:58 +0200 Subject: [PATCH] set BuildTag for Dockerfile and Chart.yaml using push-packages-to-obs.sh helm enforces semverv2 on the image tags on OCI repositories. This means that we need one to pull the chart from the repository generated by OBS. For the testsuite we need to add the semantic version as tag on Helm Charts only. --- containers/proxy-helm/Chart.yaml | 4 ++-- .../proxy-helm/proxy-helm.changes.cbosdo.tag-cleanup | 1 + containers/proxy-httpd-image/Dockerfile | 2 +- .../proxy-httpd-image.changes.cbosdo.tag-cleanup | 1 + containers/proxy-salt-broker-image/Dockerfile | 2 +- ...proxy-salt-broker-image.changes.cbosdo.tag-cleanup | 1 + containers/proxy-squid-image/Dockerfile | 2 +- .../proxy-squid-image.changes.cbosdo.tag-cleanup | 1 + containers/proxy-ssh-image/Dockerfile | 2 +- .../proxy-ssh-image.changes.cbosdo.tag-cleanup | 1 + containers/proxy-tftpd-image/Dockerfile | 2 +- .../proxy-tftpd-image.changes.cbosdo.tag-cleanup | 1 + rel-eng/push-packages-to-obs.sh | 11 +++++++---- 13 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 containers/proxy-helm/proxy-helm.changes.cbosdo.tag-cleanup create mode 100644 containers/proxy-httpd-image/proxy-httpd-image.changes.cbosdo.tag-cleanup create mode 100644 containers/proxy-salt-broker-image/proxy-salt-broker-image.changes.cbosdo.tag-cleanup create mode 100644 containers/proxy-squid-image/proxy-squid-image.changes.cbosdo.tag-cleanup create mode 100644 containers/proxy-ssh-image/proxy-ssh-image.changes.cbosdo.tag-cleanup create mode 100644 containers/proxy-tftpd-image/proxy-tftpd-image.changes.cbosdo.tag-cleanup diff --git a/containers/proxy-helm/Chart.yaml b/containers/proxy-helm/Chart.yaml index 04686d2fafdb..0eeea66a3190 100644 --- a/containers/proxy-helm/Chart.yaml +++ b/containers/proxy-helm/Chart.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-helm:latest uyuni/proxy-helm:4.4.1 uyuni/proxy-helm:4.4.1-build%RELEASE% +#!BuildTag: uyuni/proxy:latest apiVersion: v2 -name: proxy-helm +name: proxy description: Uyuni proxy containers. type: application home: https://www.uyuni-project.org/ diff --git a/containers/proxy-helm/proxy-helm.changes.cbosdo.tag-cleanup b/containers/proxy-helm/proxy-helm.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-helm/proxy-helm.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/containers/proxy-httpd-image/Dockerfile b/containers/proxy-httpd-image/Dockerfile index 13c9396372cd..3f6ba7bf085d 100644 --- a/containers/proxy-httpd-image/Dockerfile +++ b/containers/proxy-httpd-image/Dockerfile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-httpd:latest uyuni/proxy-httpd:4.4.1 uyuni/proxy-httpd:4.4.1.%RELEASE% +#!BuildTag: uyuni/proxy-httpd:latest ARG BASE=registry.suse.com/bci/bci-base:15.5 FROM $BASE AS base diff --git a/containers/proxy-httpd-image/proxy-httpd-image.changes.cbosdo.tag-cleanup b/containers/proxy-httpd-image/proxy-httpd-image.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-httpd-image/proxy-httpd-image.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/containers/proxy-salt-broker-image/Dockerfile b/containers/proxy-salt-broker-image/Dockerfile index 141a2e82a3b2..234654e4f5b5 100644 --- a/containers/proxy-salt-broker-image/Dockerfile +++ b/containers/proxy-salt-broker-image/Dockerfile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-salt-broker:latest uyuni/proxy-salt-broker:4.4.1 uyuni/proxy-salt-broker:4.4.1.%RELEASE% +#!BuildTag: uyuni/proxy-salt-broker:latest ARG BASE=registry.suse.com/bci/bci-base:15.5 FROM $BASE AS fat diff --git a/containers/proxy-salt-broker-image/proxy-salt-broker-image.changes.cbosdo.tag-cleanup b/containers/proxy-salt-broker-image/proxy-salt-broker-image.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-salt-broker-image/proxy-salt-broker-image.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/containers/proxy-squid-image/Dockerfile b/containers/proxy-squid-image/Dockerfile index 418b5c512ef5..caec53cf15ae 100644 --- a/containers/proxy-squid-image/Dockerfile +++ b/containers/proxy-squid-image/Dockerfile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-squid:latest uyuni/proxy-squid:4.4.1 uyuni/proxy-squid:4.4.1.%RELEASE% +#!BuildTag: uyuni/proxy-squid:latest ARG BASE=registry.suse.com/bci/bci-base:15.5 FROM $BASE AS base diff --git a/containers/proxy-squid-image/proxy-squid-image.changes.cbosdo.tag-cleanup b/containers/proxy-squid-image/proxy-squid-image.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-squid-image/proxy-squid-image.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/containers/proxy-ssh-image/Dockerfile b/containers/proxy-ssh-image/Dockerfile index da77b1b08455..9b7850569c23 100644 --- a/containers/proxy-ssh-image/Dockerfile +++ b/containers/proxy-ssh-image/Dockerfile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-ssh:latest uyuni/proxy-ssh:4.4.1 uyuni/proxy-ssh:4.4.1.%RELEASE% +#!BuildTag: uyuni/proxy-ssh:latest ARG BASE=registry.suse.com/bci/bci-base:15.5 FROM $BASE AS base diff --git a/containers/proxy-ssh-image/proxy-ssh-image.changes.cbosdo.tag-cleanup b/containers/proxy-ssh-image/proxy-ssh-image.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-ssh-image/proxy-ssh-image.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/containers/proxy-tftpd-image/Dockerfile b/containers/proxy-tftpd-image/Dockerfile index e07e561a6dd6..34171ad4633d 100644 --- a/containers/proxy-tftpd-image/Dockerfile +++ b/containers/proxy-tftpd-image/Dockerfile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -#!BuildTag: uyuni/proxy-tftpd:latest uyuni/proxy-tftpd:4.4.1 uyuni/proxy-tftpd:4.4.1.%RELEASE% +#!BuildTag: uyuni/proxy-tftpd:latest ARG BASE=registry.suse.com/bci/bci-base:15.5 FROM $BASE AS base diff --git a/containers/proxy-tftpd-image/proxy-tftpd-image.changes.cbosdo.tag-cleanup b/containers/proxy-tftpd-image/proxy-tftpd-image.changes.cbosdo.tag-cleanup new file mode 100644 index 000000000000..3d1224d8dc2b --- /dev/null +++ b/containers/proxy-tftpd-image/proxy-tftpd-image.changes.cbosdo.tag-cleanup @@ -0,0 +1 @@ +- Remove statically defined image tags diff --git a/rel-eng/push-packages-to-obs.sh b/rel-eng/push-packages-to-obs.sh index 4aaeec98c97a..ba754d1310b2 100755 --- a/rel-eng/push-packages-to-obs.sh +++ b/rel-eng/push-packages-to-obs.sh @@ -242,10 +242,10 @@ FAILED_PKG= # check which endpoint we are using to match the product if [ "${OSCAPI}" == "https://api.suse.de" ]; then - PRODUCT_VERSION="susemanager-$(sed -n 's/.*web.version\s*=\s*\(.*\)$/\1/p' ${BASE_DIR}/../web/conf/rhn_web.conf)" + PRODUCT_VERSION="$(sed -n 's/.*web.version\s*=\s*\(.*\)$/\1/p' ${BASE_DIR}/../web/conf/rhn_web.conf)" else # Uyuni settings - PRODUCT_VERSION="uyuni-$(sed -n 's/.*web.version.uyuni\s*=\s*\(.*\)$/\1/p' ${BASE_DIR}/../web/conf/rhn_web.conf)" + PRODUCT_VERSION="$(sed -n 's/.*web.version.uyuni\s*=\s*\(.*\)$/\1/p' ${BASE_DIR}/../web/conf/rhn_web.conf)" fi # to lowercase with ",," and replace spaces " " with "-" PRODUCT_VERSION=$(echo ${PRODUCT_VERSION,,} | sed -r 's/ /-/g') @@ -282,7 +282,7 @@ while read PKG_NAME; do fi if [ -f "$SRPM_PKG_DIR/Chart.yaml" ]; then - NAME="${PKG_NAME}" + NAME="${PKG_NAME%%-helm}" if [ "${OSCAPI}" == "https://api.suse.de" ]; then # SUSE Manager settings VERSION=$(sed 's/^\([0-9]\+\.[0-9]\+\).*$/\1/' ${BASE_DIR}/packages/uyuni-base) @@ -299,7 +299,10 @@ while read PKG_NAME; do NAME="uyuni\/${NAME}" fi - sed "/^#\!BuildTag:/ s/$/ ${NAME}:${PRODUCT_VERSION} ${NAME}:${PRODUCT_VERSION}.%RELEASE%/" -i $SRPM_PKG_DIR/Chart.yaml + # Remove leading zero from Uyuni release and add potentially missing micro part + SEMANTIC_VERSION=$(echo ${PRODUCT_VERSION} | sed 's/\([0-9]\+\)\.0\?\([1-9][0-9]*\)\(\.\([0-9]\+\)\)\?\( .\+\)\?/\1.\2.\4\5/' | sed 's/\.$/.0/') + # Also include the semantic version since helm chart wants it for OCI repos (those generated by OBS) + sed "/^#\!BuildTag:/ s/$/ ${NAME}:${SEMANTIC_VERSION} ${NAME}:${PRODUCT_VERSION} ${NAME}:${PRODUCT_VERSION}.%RELEASE%/" -i $SRPM_PKG_DIR/Chart.yaml fi # update from obs (create missing package on the fly)