Pipeline: use dedicated workspace to checkout and load pipeline script
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 15 Nov 2016 09:03:17 +0000
changeset 74 57edfcce2a40
parent 73 d2fd92cae180 (current diff)
parent 70 8e73f248c6d4 (diff)
child 75 9b57c88b2ab3
Pipeline: use dedicated workspace to checkout and load pipeline script ...as it seems that `checkout` steps cleans up existing workspace contents. This is not desirable as checkout takes ages on Windows guests.
Jenkinsfile
--- a/Jenkinsfile	Mon Nov 14 22:32:36 2016 +0000
+++ b/Jenkinsfile	Tue Nov 15 09:03:17 2016 +0000
@@ -5,8 +5,15 @@
 def pipeline;
 stage ( "Load Pipeline") {
     node {
-        checkout scm
-        pipeline = load "pipeline.groovy"
+        /*
+         * Do not use default workspace here as checkout
+         * would erase all contents. Use a dedicated
+         * workspace instead
+         */
+        ws ("workspace/${env.JOB_NAME}@loadpipeline") {
+            checkout scm
+            pipeline = load "pipeline.groovy"
+        }
     }
 }