From 1a6b03835f97405092d34e431b044460b122c170 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 4 Jun 2025 10:25:13 +0200 Subject: [PATCH] try git ref --- Jenkinsfile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba73399..470e7d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,24 +4,24 @@ pipeline { CONTAINER_REGISTRY = credentials("container_registry") REGISTRY_NAMESPACE = credentials("registry_namespace") REPO_NAME = env.GIT_URL.replaceFirst(/^.*\/([^\/]+?).git$/, '$1') - ARCHITECTURES = ['aarch64', 'x86_64'] } stages { stage("Build") { when { tag "*" } - parallel { + steps { script { + def architectures = ['aarch64', 'x86_64'] def parallelStages = [:] - ARCHITECTURES.each { arch -> + for (arch in architectures) { + // Need to bind the label variable before the closure + def nodeLabel = arch + parallelStages[arch] = { - stage(arch) { - agent { label arch } - steps { - sh "podman build -t ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME}-${arch} ." - sh "podman save -o ${arch}.tar ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME}-${arch}" - stash includes: "${arch}.tar", name: "${arch}-image" - } + node(nodeLabel) { + sh "podman build -t ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME}-${nodeLabel} ." + sh "podman save -o ${nodeLabel}.tar ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME}-${nodeLabel}" + stash includes: "${nodeLabel}.tar", name: "${nodeLabel}-image" } } }