From a8aa67d7c542f6520a9353e22ccad03d273edf53 Mon Sep 17 00:00:00 2001 From: "sebastien.heurtematte" Date: Thu, 16 May 2024 09:36:35 +0200 Subject: [PATCH] refactor: agent definition per stage in buildImage function Signed-off-by: sebastien.heurtematte --- Jenkinsfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b1acce..1fdeba4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { agent any options { + skipDefaultCheckout() buildDiscarder(logRotator(numToKeepStr: '5')) timeout(time: 90, unit: 'MINUTES') } @@ -19,6 +20,12 @@ pipeline { } stages { + stage('Checkout Workspace') { + steps { + checkout scm + stash(name: 'workspace', includes: '**') + } + } stage('Run Builds') { parallel { stage('nginx') { @@ -86,13 +93,6 @@ pipeline { } stage('aws') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('aws', 'alpine-latest', 'aws/alpine-latest', [:], true) } @@ -124,6 +124,7 @@ def buildImage(String name, String version, String context, Map podTemplate(yaml: loadOverridableResource(libraryResource: 'org/eclipsefdn/container/agent.yml')) { node(POD_LABEL) { container('containertools') { + unstash('workspace') containerBuild( credentialsId: env.CREDENTIALS_ID, name: env.NAMESPACE + '/' + name,