From 5645a735d75d96307843fe05a1bef9d526cbf376 Mon Sep 17 00:00:00 2001 From: Matt Rendina Date: Mon, 27 Nov 2017 11:56:55 -0500 Subject: Rename file --- vars/utils.groovy | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 vars/utils.groovy (limited to 'vars/utils.groovy') 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}") + } +} -- cgit