This commit is contained in:
Dan Hawkins 2019-02-20 21:37:00 +00:00
commit 4c42a5ebb8
7 changed files with 54 additions and 16 deletions

View file

@ -32,7 +32,7 @@ def getmetafolderscript() {
}
// Start up boilderplate
def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
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
@ -48,7 +48,29 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
def rr = load("${commonscripts()}/release/registerrepo.groovy")
rr.registerrepo(meta, releaserepo)
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)

16
differences/file.groovy Normal file
View file

@ -0,0 +1,16 @@
def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
if (isUnix()) {
def wsparameter = "-w"
if (!ignorewhitespace) {
wsparameter = ""
}
sh """
diff -c ${wsparameter} "${importedfile}" "${currentfile}"
"""
}
else {
error "Windows not currently supporting file comparison"
}
}
return this;

View file

@ -1,12 +1,10 @@
def comparefiles(importedjsonfile, currentjsonfile) {
env.IMPORTED_JSON="${importedjsonfile}"
env.CURRENT_JSON="${currentjsonfile}"
if (isUnix()) {
sh """
which jq
if [ \$? -ne 0 ]; then exit 1; fi
# jq -S sorts json output
diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}")
diff -c <(jq -S . "${importedjsonfile}") <(jq -S . "${currentjsonfile}")
"""
}
else {

View file

@ -4,7 +4,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) {
def importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
for (installer in toBuild) {
def artifactKey = installerDetails.get(installer)[0]
def artifactKey = installerDetails.get(installer)[1]
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
if (artifactFetched.get(artifactKey) == null) {
def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy)
@ -17,12 +17,12 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) {
// Export any required binaries to the <WORKSPACE>/bin folder
def placeBinaries(artifactDetails, installerDetails) {
for (installer in toBuild) {
(artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer)
(installertool, artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer)
if (exportBinaries) {
(artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet)
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactSet)
for (binaryFolder in binariesFolders) {
binariesSourceFolder = "${destinationFolder}/${binaryFolder}"
binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}"
def binariesSourceFolder = "${destFolder}/${binaryFolder}"
def binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}"
echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}"
fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)])
}

View file

@ -157,7 +157,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
}
class BuildStampInfo extends GISJsonSerialised {
private String buildstampprefix
String buildstampprefix
int revision
String buildstamp
@ -486,6 +486,7 @@ class MetaInfo extends GISJsonSerialised {
void addPublishable(String filepath) {
def PublishableInfo pi = new PublishableInfo(script, filepath)
script.echo("Adding ${filepath} to publishable list")
publishableinfo.add(pi)
}

View file

@ -2,9 +2,9 @@
vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data
def registerrepo(meta, String releaserepo) {
def registerrepo(meta, String releaserepo, String repoRootSuffix = "") {
if (releaserepo?.trim()) {
vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo")
vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo", repoRootSuffix)
}
meta.releaseinfo.set(releaserepo)
}

View file

@ -19,10 +19,11 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList<String> paths) {
return new SparseCheckoutPaths(sparsecheckoutpaths)
}
def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
reporootenv = env.REPO_ROOT
if (reporootenv != null && repoRoot != "") {
reporootpath = "${reporootenv.trim()}/${repoRoot}"
if (reporootenv != null && repoRootSuffix != "") {
reporootpath = "${reporootenv.trim()}/${repoRootSuffix}"
echo "Using release repo: ${reporootpath}"
} else {
reporootpath = ""
echo "To improve Git performance: Define the REPO_ROOT enviroment to a path where a cache of git repositories can be placed on this slave"