From b6528264be819a05a38b482bbc10bc68d7c22a48 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Jul 2019 17:21:18 +0100 Subject: [PATCH 1/5] GIS-1621 - Import print server source such that it is registered in the meta data --- configuration/configuration.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 1864ba9..b8c0b47 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -8,8 +8,10 @@ def registerPipelineScriptConfiguration(meta) { registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } -def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } From 6b7eb941a4597f843e56529fe13122f4052bbea6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 30 Jul 2019 22:48:18 +0100 Subject: [PATCH 2/5] GIS-1621 - Allow installer builder handle a list of artifact keys or a single string --- install/installhelper.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index eebbd34..0d1863e 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -28,11 +28,16 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { - 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) - artifactFetched.put(artifactKey, importmeta) + def artifactKeys = installerDetails.get(installer)[1] + if (obj instanceof java.lang.Integer) { + artifactKeys = [ artifactKeys ] + } + for (artifactKey in artifactKeys) { + (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) + artifactFetched.put(artifactKey, importmeta) + } } } return artifactFetched From 09e3bfcd0cf62bc58660694335997fee8a9fc6a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Jul 2019 08:03:54 +0100 Subject: [PATCH 3/5] GIS-1621 - Allow installer builder handle a list of artifact keys or a single string --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 0d1863e..75ba5d6 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -29,7 +29,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] - if (obj instanceof java.lang.Integer) { + if (artifactKeys instanceof java.lang.String) { artifactKeys = [ artifactKeys ] } for (artifactKey in artifactKeys) { From e7b86d95226095c5f2f601b6e08a6710705aa942 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Aug 2019 08:55:18 +0100 Subject: [PATCH 4/5] Perform a shallow clone check on repos being used to generate version numbers --- versioncontrol/git.groovy | 15 +++++++++++++++ versionnumbering/generate.groovy | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 3ea97ec..0e27faf 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -4,6 +4,21 @@ import hudson.plugins.git.extensions.impl.* clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") +def boolean isShallowClonedRepo(String gitrootpath) { + def boolean isshallowclone = true + + dir( gitrootpath) { + if (isUnix()) { + isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() + } + else { + isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + } + echo "Repo at ${gitrootpath} is shallow cloned: Change count: ${isshallowclone}" + } + return isshallowclone +} + String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { return clh.getCommandOutput('git rev-parse HEAD') diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f4f1bdc..2e4f60d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,4 +1,5 @@ - +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def int maxversionnumber() { def int MAXVERSIONNUMBER = 65535 return MAXVERSIONNUMBER @@ -15,6 +16,12 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String gitrevision def String remoteinfo def String remoteurl + + def boolean isShallowCloned = gh.isShallowClonedRepo(gitrootpath) + if (isShallowCloned) { + error("Cannot generate a version number from a shallow cloned repo at ${gitrootpath}") + } + dir( gitrootpath) { def int changecount = 0 if (isUnix()) { From b6aa653aeb590a37e2766b89cfc0e08106dee7eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Aug 2019 08:57:53 +0100 Subject: [PATCH 5/5] Perform a shallow clone check on repos being used to generate version numbers --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 0e27faf..bb7c0ce 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -14,7 +14,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { else { isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() } - echo "Repo at ${gitrootpath} is shallow cloned: Change count: ${isshallowclone}" + echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } return isshallowclone }