Skip to content

Commit

Permalink
set BuildTag for Dockerfile and Chart.yaml using push-packages-to-obs.sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mbussolotto authored and cbosdo committed Oct 3, 2023
1 parent d2eb86d commit 146a0e6
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions containers/proxy-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
2 changes: 1 addition & 1 deletion containers/proxy-httpd-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
2 changes: 1 addition & 1 deletion containers/proxy-salt-broker-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
2 changes: 1 addition & 1 deletion containers/proxy-squid-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
2 changes: 1 addition & 1 deletion containers/proxy-ssh-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
2 changes: 1 addition & 1 deletion containers/proxy-tftpd-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove statically defined image tags
11 changes: 7 additions & 4 deletions rel-eng/push-packages-to-obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 146a0e6

Please sign in to comment.