Condense autobuild startup boilerplate
This commit is contained in:
parent
a1b8494944
commit
3d1326836b
1 changed files with 39 additions and 0 deletions
39
autobuilder.gsh
Normal file
39
autobuilder.gsh
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Assume that WORKSPACE environment variable is set
|
||||
|
||||
def autobuildroot = "${WORKSPACE}/autobuild"
|
||||
def commonscriptsroot = "${autobuildroot}/Common_scripts"
|
||||
|
||||
def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") {
|
||||
if (doclean) {
|
||||
echo "Cleaning workspace"
|
||||
// Save any script files that were loaded into the workspace at first and are required after cleaning the workspace
|
||||
stash allowEmpty: true, includes: 'autobuild/**/*', name: 'Clean workspace stash', useDefaultExcludes: false
|
||||
cleanWs()
|
||||
unstash name: 'Clean workspace stash'
|
||||
}
|
||||
else {
|
||||
echo "Not cleaning workspace"
|
||||
}
|
||||
}
|
||||
|
||||
// Start up boilderplate
|
||||
def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autobuildroot}/Common_scripts") {
|
||||
echo "Starting...."
|
||||
|
||||
autobuildroot = autobuildpath
|
||||
commonscriptsroot = commonscriptspath
|
||||
|
||||
conditionalclean()
|
||||
|
||||
configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh")
|
||||
configurationhelper.registerPipelineScriptConfiguration()
|
||||
|
||||
def commonscripts()
|
||||
return commonscriptsroot
|
||||
}
|
||||
|
||||
def configurationhelper() {
|
||||
return load("${commonscripts()}/configuration/configuration.gsh")
|
||||
}
|
||||
|
||||
return this;
|
||||
Loading…
Add table
Add a link
Reference in a new issue