88 lines
2.7 KiB
Groovy
88 lines
2.7 KiB
Groovy
// Assume that WORKSPACE environment variable is set
|
|
|
|
autobuildroot = "${WORKSPACE}/autobuild"
|
|
|
|
commonscriptsroot = "${autobuildroot}/Common_scripts"
|
|
|
|
metafolderscript = null
|
|
|
|
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"
|
|
}
|
|
}
|
|
|
|
def commonscripts() {
|
|
return commonscriptsroot
|
|
}
|
|
|
|
def getautobuildpath() {
|
|
return autobuildroot
|
|
}
|
|
|
|
def getmetafolderscript() {
|
|
return metafolderscript
|
|
}
|
|
|
|
// Start up boilderplate
|
|
def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, String repoRootSuffix = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
|
|
echo "Starting...."
|
|
|
|
autobuildroot = autobuildpath
|
|
commonscriptsroot = commonscriptspath
|
|
metafolderscript = load("${commonscripts()}/meta/folder.groovy")
|
|
|
|
conditionalclean()
|
|
|
|
def meta = getmetafolderscript().metareset(script)
|
|
meta.productinfo.set(productname, subcomponentname, jirakey)
|
|
def now = new Date()
|
|
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
|
|
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
|
|
|
|
def rr = load("${commonscripts()}/release/registerrepo.groovy")
|
|
rr.registerrepo(meta, releaserepo, repoRootSuffix)
|
|
|
|
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
|
ch.registerPipelineScriptConfiguration(meta)
|
|
|
|
return meta
|
|
}
|
|
|
|
// Start up boilderplate
|
|
def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
|
|
echo "Starting non-build job...."
|
|
|
|
autobuildroot = autobuildpath
|
|
commonscriptsroot = commonscriptspath
|
|
metafolderscript = load("${commonscripts()}/meta/folder.groovy")
|
|
|
|
conditionalclean()
|
|
|
|
def meta = getmetafolderscript().metareset(script)
|
|
meta.productinfo.set("Non-build-product", "Non-build-subcomponent", "Non-build-jira-key")
|
|
def now = new Date()
|
|
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
|
|
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
|
|
|
|
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
|
ch.registerPipelineScriptConfiguration(meta)
|
|
|
|
return meta
|
|
}
|
|
|
|
def configurationhelper() {
|
|
return load("${commonscripts()}/configuration/configuration.groovy")
|
|
}
|
|
|
|
// Everyone wants to know this
|
|
autobuilder = this
|
|
|
|
return this;
|