I am rebuilding an existing assembly pipeline as a jenkins declarative pipeline (multi-branch pipeline) and have problems processing the assembly.
After packing and storing all the relevant files, the pipeline must wait for user input to start the deployment.
If I just add an input step, the current build-node is blocked. Since this performer is quite heavy, I would like to move this step to a lighter car.
First, I completed the task as a script and only created two different node('label')
blocks. is there any way to do something similar with declarative syntax?
node('spine') { stage('builder') { sh 'mvn clean compile' stash name: 'artifact', includes: 'target/*.war' } } node('lightweight') { stage('wait') { timeout(time:5, unit:'DAYS') { input message:'Approve deployment?' } }
I already tried a couple of things:
setting up the agent at the top level and adding an additional agent configuration to the distribution step, but then I have two executors blocking, since the not installed top-level construction of the node does not stop.
Configure agent none
at the top level and configure agents for each step. then the git check is missing on the first node.
EDIT 1
i reconfigured my pipeline after your advice, currently it looks like this:
pipeline { agent none tools { maven 'M3' } stages { stage('Build') { agent { label 'spine' } steps { checkout scm // needed, otherwise the workspace on the first step is empty sh "mvn clean compile" } } stage('Test') { agent { label 'spine' } steps { sh "mvn verify" // fails because the workspace is empty aggain junit '**/target/surefire-reports/TEST-*.xml' } } } }
this assembly will fail because the workspace does not migrate between steps because they do not run on the same artist.
EDIT 2
apparently, sometimes the steps are performed on the same artist, and sometimes not. (we create a workstation on our mesos / dcos cluster on demand, so changing the executive mid-build will be a problem)
I expected jenkins to simply start with the current executor until the label in the agent definition changes.