diff --git a/Jenkinsfile b/Jenkinsfile index e56c5f3..4460f18 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { agent any options { + skipDefaultCheckout() buildDiscarder(logRotator(numToKeepStr: '5')) timeout(time: 90, unit: 'MINUTES') } @@ -19,16 +20,15 @@ pipeline { } stages { + stage('Checkout Workspace') { + steps { + checkout scm + stash(name: 'workspace', includes: '**') + } + } stage('Run Builds') { parallel { stage('nginx') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('nginx', 'stable-alpine', 'nginx/stable-alpine', [:], true) buildImage('nginx', 'stable-alpine-for-staging', 'nginx/stable-alpine-for-staging') @@ -36,38 +36,17 @@ pipeline { } stage('planet-venus') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('planet-venus', 'debian-11-slim', 'planet-venus', [:], true) } } stage('kubectl') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('kubectl', 'okd-c1', 'kubectl/okd-c1', [:], true) } } stage('hugo-node') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('hugo-node', 'h0.99.1-n16.15.0', 'hugo-node', ['HUGO_VERSION':'0.99.1', 'HUGO_FILENAME':'hugo_0.99.1_Linux-64bit.deb','NODE_VERSION': 'v16.15.0']) buildImage('hugo-node', 'h0.110.0-n18.19.1', 'hugo-node', ['HUGO_VERSION':'0.110.0', 'NODE_VERSION': 'v18.19.1'], true) @@ -78,13 +57,6 @@ pipeline { } stage('drupal-node') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('drupal-node', 'd10.3.13-n22.14.0', 'drupal-node', ['DRUPAL_VERSION':'10.3.13', 'NODE_VERSION': 'v22.14.0'], true) buildImage('drupal-node', 'd11.1.3-n22.14.0', 'drupal-node', ['DRUPAL_VERSION':'11.1.3', 'NODE_VERSION': 'v22.14.0']) @@ -92,13 +64,6 @@ pipeline { } stage('stack-build-agent') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('stack-build-agent', 'h111.3-n18.19-jdk11', 'stack-build-agent', [:], true) buildImage('stack-build-agent', 'h111.3-n18.19-jdk17', 'stack-build-agent', ['JDK_VERSION':'17']) @@ -108,13 +73,6 @@ pipeline { } stage('java-api-base') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('java-api-base', 'j11-openjdk', 'java-api-base', ['JDK_VERSION':'11:1.17']) buildImage('java-api-base', 'j17-openjdk', 'java-api-base', ['JDK_VERSION':'17:1.22-1.1752621170'], true) @@ -123,39 +81,18 @@ pipeline { } stage('native-build-agent') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('native-build-agent', 'jdk21-n22', 'native-build-agent', ['NODE_VERSION':'v22.17.0'], true) } } stage('containertools') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('containertools', 'alpine-latest', 'containertools', [:], true) } } stage('aws') { - agent { - kubernetes { - yaml loadOverridableResource( - libraryResource: 'org/eclipsefdn/container/agent.yml' - ) - } - } steps { buildImage('aws', 'alpine-latest', 'aws/alpine-latest', [:], true) } @@ -184,18 +121,22 @@ def buildImage(String name, String version, String context, Map * Dockerfile ${context}/Dockerfile * Latest ${latest} """ - - container('containertools') { - containerBuild( - credentialsId: env.CREDENTIALS_ID, - name: env.NAMESPACE + '/' + name, - version: version, - dockerfile: context + '/Dockerfile', - context: context, - buildArgs: containerBuildArgs, - push: env.GIT_BRANCH == 'master', - latest: latest, - debug: false - ) + 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, + version: version, + dockerfile: context + '/Dockerfile', + context: context, + buildArgs: containerBuildArgs, + push: env.GIT_BRANCH == 'master', + latest: latest, + debug: false + ) + } + } } }