External workspace manager plugin with declarative pipeline

I want to use the specified plugin with a declarative pipeline, more precisely, I want to convert the following documentation example to a declarative pipeline:

The pipeline code in the original job is as follows:

stage ('Stage 1. Allocate workspace in the upstream job') def extWorkspace = exwsAllocate 'diskpool1' node ('linux') { exws (extWorkspace) { stage('Stage 2. Build in the upstream job') git url: 'https://github.com/alexsomai/dummy-hello-world.git' def mvnHome = tool 'M3' sh '${mvnHome}/bin/mvn clean install -DskipTests' } } 

And the downstream pipeline code:

 stage ('Stage 3. Select the upstream run') def run = selectRun 'upstream' stage ('Stage 4. Allocate workspace in the downstream job') def extWorkspace = exwsAllocate selectedRun: run node ('test') { exws (extWorkspace) { stage('Stage 5. Run tests in the downstream job') def mvnHome = tool 'M3' sh '${mvnHome}/bin/mvn test' } } 

Thanks!

+8
source share
1 answer

You can use this agent directive:

 agent { node { label 'my-defined-label' customWorkspace '/some/other/path' } } 
0
source

Source: https://habr.com/ru/post/1269863/


All Articles