Skip to content

Commit f863146

Browse files
committed
Write basic example of External Workspace Manager Plugin usage
1 parent 20a37eb commit f863146

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Synopsis
2+
Shows how to allocate the same workspace on multiple nodes using the
3+
[External Workspace Manager Plugin](https://github.com/jenkinsci/external-workspace-manager-plugin).
4+
5+
# Prerequisites
6+
Before using this script, you must configure several prerequisites.
7+
A starting guide may be found in the
8+
[prerequisites](https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/doc/PREREQUISITES.md)
9+
section, from the plugin's documentation.
10+
11+
# Documentation
12+
Additional examples can be found on the plugin's
13+
[documentation page](https://github.com/jenkinsci/external-workspace-manager-plugin/blob/master/README.md),
14+
along with all the available features.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// allocate a Disk from the Disk Pool defined in the Jenkins global config
2+
def extWorkspace = exwsAllocate 'diskpool1'
3+
4+
// on a node labeled 'linux', perform code checkout and build the project
5+
node('linux') {
6+
// compute complete workspace path, from current node to the allocated disk
7+
exws(extWorkspace) {
8+
// checkout code from repo
9+
checkout scm
10+
// build project, but skip running tests
11+
sh 'mvn clean install -DskipTests'
12+
}
13+
}
14+
15+
// on a different node, labeled 'test', perform testing using the same workspace as previously
16+
node('test') {
17+
// compute complete workspace path, from current node to the allocated disk
18+
exws(extWorkspace) {
19+
// run tests in the same workspace that the project was built
20+
sh 'mvn test'
21+
}
22+
}

0 commit comments

Comments
 (0)