This commit is contained in:
Dan Hawkins 2018-11-14 08:14:58 +00:00
commit 08278ddcf6
14 changed files with 115 additions and 3 deletions

45
autobuilder.groovy Normal file
View file

@ -0,0 +1,45 @@
// Assume that WORKSPACE environment variable is set
autobuildroot = "${WORKSPACE}/autobuild"
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.groovy")
configurationhelper.registerPipelineScriptConfiguration()
}
def commonscripts() {
return commonscriptsroot
}
def getautobuildpath() {
return autobuildroot
}
def configurationhelper() {
return load("${commonscripts()}/configuration/configuration.groovy")
}
return this;

10
clean/clean.groovy Normal file
View file

@ -0,0 +1,10 @@
def clean(folderlist) {
for (folder in folderlist) {
dir(folder) {
deleteDir()
}
}
}
return this;

View file

@ -1,4 +1,4 @@
gh = load("${COMMON_SCRIPTS}/versioncontrol/git.gsh")
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
configurationCollection = [:]
@ -8,7 +8,7 @@ def registerConfigurationInfo(String configurationName, String configurationURL,
}
def registerPipelineScriptConfiguration() {
registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${AUTOBUILD_SCRIPTS}"))
registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}"))
}
def saveConfigurationInVersionInfo() {

17
differences/do.groovy Normal file
View file

@ -0,0 +1,17 @@
def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") {
cs = autobuilder.commonscripts()
if (isUnix()) {
sh """
"${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}"
"""
}
else {
bat """
"%${PYTHON}%" -u "%${cs}%\\differences\\show_release_differences.py" -g "%${sourcepath}%" -s "%${sourcerevision}%" -p "%${previoussourcerevision}%" -j ${jirakey} -o "opposite notcommon" -v "%${versionfolder}%"
"""
}
}
return this;

View file

@ -1,4 +1,4 @@
clh = load("${COMMON_SCRIPTS}/commandline/commandline.gsh")
clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy")
String getGitInfo(String workingSetRootPath) {
dir(workingSetRootPath) {

View file

@ -0,0 +1,20 @@
def stamp(convertdetails) {
for (convertdetail in convertdetails) {
filetoconvert = convertdetail[0]
pattern = convertdetail[1]
replacement = convertdetail[2]
if (isUnix()) {
sh """
"${PYTHON}" -u "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
"""
}
else {
bat """
"%${PYTHON}%" -u "%${autobuilder.commonscripts()}%\\versionstamping\\versionstamper.py" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%"
"""
}
}
}
return this;

View file

@ -0,0 +1,20 @@
def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${WORKSPACE}/version", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") {
cs = autobuilder.commonscripts()
if (isUnix()) {
sh """
"${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}"
"""
}
else {
bat """
"%${PYTHON}%" -u "%${cs}%\\versionnumbering\\versioninfo.py" -s "%${sourcerevision}%" -v "${versionfolder}" -g "${sourcepath}" -b %${basebuildnumber}% -j "%${jobname}%" -n "%${buildid}%" -r "%${releasejobname}%"
"""
}
env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim()
env.BUILD_STAMP_COMMA_SEP = readFile("${WORKSPACE}/version/buildstampcommasep.txt").trim()
env.SRC_REVISION = readFile("${WORKSPACE}/version/revision.txt").trim()
configurationhelper.saveConfigurationInVersionInfo();
}
return this;