From 9c611cd5190863a753e5f5d8cc9c3431f1de70d3 Mon Sep 17 00:00:00 2001 From: arewm Date: Tue, 23 Jul 2024 14:51:37 -0400 Subject: [PATCH] Add an architecture suffix to images pushed for multi-platform In order to reduce the likelihood of users accidentally forgetting to specify unique tags for each architecture, we can add a suffix to the pushed image if an arch-specific one doesn't exist. Signed-off-by: arewm --- task-generator/remote/main.go | 4 ++++ task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml | 4 ++++ task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml | 4 ++++ task/buildah-remote/0.1/buildah-remote.yaml | 4 ++++ task/buildah-remote/0.2/buildah-remote.yaml | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/task-generator/remote/main.go b/task-generator/remote/main.go index d03c0e4359..2aa56a4091 100644 --- a/task-generator/remote/main.go +++ b/task-generator/remote/main.go @@ -123,6 +123,10 @@ mkdir -p scripts echo "$BUILD_DIR" ssh $SSH_ARGS "$SSH_HOST" mkdir -p "$BUILD_DIR/workspaces" "$BUILD_DIR/scripts" "$BUILD_DIR/volumes" +if [ "${IMAGE##*-}" != "${PLATFORM##*-}" ]; then + export IMAGE="${IMAGE}-${PLATFORM##*-}" +fi + PORT_FORWARD="" PODMAN_PORT_FORWARD="" if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] ; then diff --git a/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml b/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml index 5c750cd3e2..dbfc23117f 100644 --- a/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml +++ b/task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml @@ -234,6 +234,10 @@ spec: echo "$BUILD_DIR" ssh $SSH_ARGS "$SSH_HOST" mkdir -p "$BUILD_DIR/workspaces" "$BUILD_DIR/scripts" "$BUILD_DIR/volumes" + if [ "${IMAGE##*-}" != "${PLATFORM##*-}" ]; then + export IMAGE="${IMAGE}-${PLATFORM##*-}" + fi + PORT_FORWARD="" PODMAN_PORT_FORWARD="" if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] ; then diff --git a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml index 95acc3aa74..3133f3546f 100644 --- a/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml +++ b/task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml @@ -230,6 +230,10 @@ spec: echo "$BUILD_DIR" ssh $SSH_ARGS "$SSH_HOST" mkdir -p "$BUILD_DIR/workspaces" "$BUILD_DIR/scripts" "$BUILD_DIR/volumes" + if [ "${IMAGE##*-}" != "${PLATFORM##*-}" ]; then + export IMAGE="${IMAGE}-${PLATFORM##*-}" + fi + PORT_FORWARD="" PODMAN_PORT_FORWARD="" if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] ; then diff --git a/task/buildah-remote/0.1/buildah-remote.yaml b/task/buildah-remote/0.1/buildah-remote.yaml index 7b4997cae0..b7bd1f1fc6 100644 --- a/task/buildah-remote/0.1/buildah-remote.yaml +++ b/task/buildah-remote/0.1/buildah-remote.yaml @@ -222,6 +222,10 @@ spec: echo "$BUILD_DIR" ssh $SSH_ARGS "$SSH_HOST" mkdir -p "$BUILD_DIR/workspaces" "$BUILD_DIR/scripts" "$BUILD_DIR/volumes" + if [ "${IMAGE##*-}" != "${PLATFORM##*-}" ]; then + export IMAGE="${IMAGE}-${PLATFORM##*-}" + fi + PORT_FORWARD="" PODMAN_PORT_FORWARD="" if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] ; then diff --git a/task/buildah-remote/0.2/buildah-remote.yaml b/task/buildah-remote/0.2/buildah-remote.yaml index 97db9ded53..ddb20123d5 100644 --- a/task/buildah-remote/0.2/buildah-remote.yaml +++ b/task/buildah-remote/0.2/buildah-remote.yaml @@ -212,6 +212,10 @@ spec: echo "$BUILD_DIR" ssh $SSH_ARGS "$SSH_HOST" mkdir -p "$BUILD_DIR/workspaces" "$BUILD_DIR/scripts" "$BUILD_DIR/volumes" + if [ "${IMAGE##*-}" != "${PLATFORM##*-}" ]; then + export IMAGE="${IMAGE}-${PLATFORM##*-}" + fi + PORT_FORWARD="" PODMAN_PORT_FORWARD="" if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] ; then