aboutsummaryrefslogtreecommitdiff
path: root/vars/utils.groovy
diff options
context:
space:
mode:
authorMatt Rendina <mrendina@stsci.edu>2017-11-27 11:56:55 -0500
committerMatt Rendina <mrendina@stsci.edu>2017-11-27 11:56:55 -0500
commit5645a735d75d96307843fe05a1bef9d526cbf376 (patch)
treeae915885415ea24d90258fbe2b636489c9b6cc5b /vars/utils.groovy
parent62567f22fb64f30750c7de038ad080a4cb16c5e2 (diff)
downloadjscu_refactor-5645a735d75d96307843fe05a1bef9d526cbf376.tar.gz
Rename file
Diffstat (limited to 'vars/utils.groovy')
-rw-r--r--vars/utils.groovy37
1 files changed, 37 insertions, 0 deletions
diff --git a/vars/utils.groovy b/vars/utils.groovy
new file mode 100644
index 0000000..d56bf8a
--- /dev/null
+++ b/vars/utils.groovy
@@ -0,0 +1,37 @@
+// Jenkinsfile utilities
+
+// Clone the source repository and examine the most recent commit message.
+// If a '[ci skip]' or '[skip ci]' directive is present, immediately
+// terminate the job with a success code.
+// If no skip directive is found, stash all the source files for efficient retrieval
+// by subsequent nodes.
+def scm_checkout() {
+ skip_job = 0
+ node("on-master") {
+ stage("Setup") {
+ checkout(scm)
+ // Obtain the last commit message and examine it for skip directives.
+ logoutput = sh(script:"git log -1 --pretty=%B", returnStdout: true).trim()
+ if (logoutput.contains("[ci skip]") || logoutput.contains("[skip ci]")) {
+ skip_job = 1
+ currentBuild.result = 'SUCCESS'
+ println("\nBuild skipped due to commit message directive.\n")
+ // System.exit(0) // WARNING: FATAL to Jenkins
+ return skip_job
+ //throw new hudson.AbortException('Guess what!')
+ //throw new java.io.IOException('Guess what!')
+ }
+ sh(script: "ls -al")
+ stash includes: '**/*', name: 'source_tree'
+ }
+ }
+ return skip_job
+}
+
+
+def concurrent2(configs) {
+ def tasks = [:]
+ for (config in configs) {
+ println("concurrent2: build.nodetype = ${config.nodetype}")
+ }
+}