diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy
new file mode 100644
index 0000000..bafba02
--- /dev/null
+++ b/artifacts/archiver.groovy
@@ -0,0 +1,17 @@
+enum Store {
+ JENKINS,
+ ARTIFACTSERVER,
+}
+
+this.JENKINS = Store.JENKINS
+this.ARTIFACTSERVER = Store.JENKINS
+
+def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) {
+ echo "Archiving artifacts to store: ${store}"
+ meta.copyrelatedmeta()
+ if (store == JENKINS) {
+ archiveArtifacts(artifacts: artifactlist)
+ }
+}
+
+return this
\ No newline at end of file
diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy
index 4d93cc5..a40e9a8 100644
--- a/artifacts/metaexport.groovy
+++ b/artifacts/metaexport.groovy
@@ -4,14 +4,19 @@ def combineSubjobArtifacts(meta, importer, subJobs) {
for (subJob in subJobs) {
def subJobObject = subJob[0]
if (subJobObject != null) {
- def subJobName = subJobObject.getProjectName()
+ def subJobName = subJobObject.getFullProjectName()
def subJobNumber = subJobObject.getNumber()
def destFolder = subJob[1]
def boolean incrementversionnumber = subJob[2]
dir(destFolder) {
deleteDir()
}
- importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber)
+
+ def importoptions = importer.getNewImportOptions()
+ importoptions.jenkinsjob(subJobName, subJobNumber)
+ importoptions.setincrementversionnumber(incrementversionnumber)
+ importer.artifactimport(meta, importoptions, destFolder)
+
artifactFolders.add("${destFolder}/**")
}
}
diff --git a/build/postactions.groovy b/build/postactions.groovy
index 06ad8ad..8b18908 100644
--- a/build/postactions.groovy
+++ b/build/postactions.groovy
@@ -85,26 +85,15 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam
return jobname
}
-def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) {
+def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) {
def jobname = getActionJobName(postbuildactions, action, alternativeparamname)
if (jobname) {
build(
wait: false,
job: jobname,
parameters: [
- // For most jobs
- string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME),
- string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector),
- // For doxygen jobs
- string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME),
- string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector),
- // For diff jobs
- string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'),
- string(name: 'LATER_BUILD_JOB', value: JOB_NAME),
- string(name: 'LATER_BUILD_SELECTOR', value: buildselector),
- // For regression jobs
- string(name: 'BUILD_JOB', value: JOB_NAME),
- string(name: 'BUILD_JOB_SELECTOR', value: buildselector),
+ string(name: jobnameparametername, value: JOB_NAME),
+ string(name: jobselectorparametername, value: buildselector),
]
)
}
@@ -130,12 +119,12 @@ def performSuccessfulBuildActions() {
}
}
def String buildselector = "${BUILD_NUMBER}"
- deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB')
- deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB')
- deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB')
- deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB')
- deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB')
- deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB')
+ deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR')
+ deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' )
+ deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
+ deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
+ deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR')
+ deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR')
}
def sendemails(emailinfo) {
diff --git a/check/build_meta.groovy b/check/build_meta.groovy
index 6e669bc..fb8a75d 100644
--- a/check/build_meta.groovy
+++ b/check/build_meta.groovy
@@ -53,7 +53,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts()
- archiveArtifacts "summary/**,${artifactlist}"
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive("summary/**,${artifactlist}")
}
}
}
diff --git a/check/do_meta.groovy b/check/do_meta.groovy
index 7bfe2d1..4b8a89e 100644
--- a/check/do_meta.groovy
+++ b/check/do_meta.groovy
@@ -52,8 +52,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) {
echo "All components:"
def String componentinfo = ""
for (entry in buildinfo) {
- def name = entry.meta.componentversionuniqueidentifier()
- def offsetpath = entry.offsetpath
+ def name = entry.metainfo.componentversionuniqueidentifier()
+ def offsetpath = entry.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}"
componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n"
}
@@ -65,7 +65,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) {
def String versioncomponent = ""
for (key in componentReleaseInfo.keySet()) {
def buildinfo2 = componentReleaseInfo[key]
- def offsetpath = buildinfo2.offsetpath
+ def offsetpath = buildinfo2.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}"
versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n"
}
diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy
index 2a7f1ab..7a89975 100644
--- a/configuration/configuration.groovy
+++ b/configuration/configuration.groovy
@@ -1,7 +1,7 @@
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
- meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
+ return meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
}
def registerPipelineScriptConfiguration(meta) {
@@ -12,7 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St
def ArrayList sparseitemlist = gh.convertSparseItemsString(filter)
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
- registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
+ return registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
}
return this
diff --git a/copy/all.groovy b/copy/all.groovy
index 6d09903..aab479c 100644
--- a/copy/all.groovy
+++ b/copy/all.groovy
@@ -5,6 +5,8 @@ pipeline {
steps {
script {
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
+
+ importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
}
}
}
@@ -23,7 +25,6 @@ pipeline {
stage('Import source artifacts') {
steps {
script {
- importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
def copyoptions = importer.getNewImportOptions()
copyoptions.source(
SOURCE_ARTIFACT_LOCATION,
@@ -37,9 +38,14 @@ pipeline {
}
}
}
- stage('Copy source artifacts') {
+ stage('Archiving artifacts') {
steps {
script {
+ def artifactlist = meta.generateartifacts(['**/*'])
+ def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+
+ cleaner.clean(['meta', 'autobuild'])
+
dir(IMPORTS) {
fileOperations([
fileCopyOperation(excludes: '',
@@ -48,23 +54,10 @@ pipeline {
targetLocation: WORKSPACE)
])
}
- }
- }
- }
- stage('Archiving artifacts') {
- steps {
- script {
- def includes = '**/*'
- def excludes = "${IMPORTS}/*"
- echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}"
- // This does not work: archiveArtifacts artifacts: includes, excludes: excludes
- // so
- cleanfolders = [
- IMPORTS,
- 'autobuild',
- ]
- cleaner.clean(cleanfolders)
- archiveArtifacts artifacts: includes
+
+ cleaner.clean([IMPORTS])
+
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
@@ -83,4 +76,4 @@ pipeline {
echo 'Succeeded build'
}
}
-}
\ No newline at end of file
+}
diff --git a/copy/esw.groovy b/copy/esw.groovy
index c6c0147..b9eb737 100644
--- a/copy/esw.groovy
+++ b/copy/esw.groovy
@@ -28,7 +28,10 @@ pipeline {
stage('Copying embedded software artifacts') {
steps {
script {
- importer.artifactimport(meta, ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION, ESWDEST)
+ def eswimportoptions = importer.getNewImportOptions()
+ eswimportoptions.source(ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION)
+ eswimportoptions.setincrementversionnumber(true)
+ importer.artifactimport(meta, eswimportoptions, ESWDEST)
}
}
}
@@ -41,7 +44,8 @@ pipeline {
rm -v -rf meta
mv -v "${ESW}"/* .
"""
- archiveArtifacts artifactlist
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
diff --git a/copy/filtered.groovy b/copy/filtered.groovy
index 7fd87b6..3ad24cd 100644
--- a/copy/filtered.groovy
+++ b/copy/filtered.groovy
@@ -27,7 +27,9 @@ pipeline {
stage('Import artifacts') {
steps {
script {
- importer.artifactimport(meta, ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION, IMPORT)
+ def importoptions = importer.getNewImportOptions()
+ importoptions.source(ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION)
+ importer.artifactimport(meta, importoptions, IMPORT)
}
}
}
@@ -48,7 +50,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts(["filtered/**"])
- archiveArtifacts artifactlist
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
diff --git a/copy/logic.groovy b/copy/logic.groovy
index 9585f01..db9dbc3 100644
--- a/copy/logic.groovy
+++ b/copy/logic.groovy
@@ -13,22 +13,27 @@ pipeline {
stage('Clean exports') {
steps {
script {
- env.LOGICDEST = "${WORKSPACE}/logic"
+ LOGICDEST = 'logic'
cleanfolders = [
LOGICDEST,
"${WORKSPACE}/embedded_logic",
+ "${WORKSPACE}/el",
]
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
cleaner.clean(cleanfolders)
}
}
}
- stage('Copying logic artifacts') {
+ stage('Import source artifacts') {
steps {
script {
- sh('env')
def logicoptions = importer.getNewImportOptions()
- logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
+ logicoptions.source(
+ LOGIC_ARTIFACT_LOCATION,
+ LOGIC_ARTIFACT_PROJECT,
+ LOGIC_ARTIFACT_BUILD_SELECTOR,
+ LOGIC_ARTIFACT_RELEASE_REPO,
+ LOGIC_ARTIFACT_RELEASE_REVISION)
importer.artifactimport(meta, logicoptions, LOGICDEST)
}
}
@@ -36,14 +41,23 @@ pipeline {
stage('Archiving artifacts') {
steps {
script {
- def artifactlist = meta.generateartifacts(["embedded_logic/**"])
- sh """
- rm -v -rf meta
- # The following is removing a deprecated folder
- rm -v -rf diff
- mv -v "logic"/* .
- """
- archiveArtifacts artifactlist
+ def artifactlist = meta.generateartifacts(['**/*'])
+ def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+
+ cleaner.clean(['meta', 'autobuild'])
+
+ dir(LOGICDEST) {
+ fileOperations([
+ fileCopyOperation(excludes: '',
+ flattenFiles: false,
+ includes: '**/*',
+ targetLocation: WORKSPACE)
+ ])
+ }
+
+ cleaner.clean([LOGICDEST])
+
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
@@ -62,4 +76,4 @@ pipeline {
echo 'Succeeded build'
}
}
-}
\ No newline at end of file
+}
diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy
index 6280960..3b25798 100644
--- a/differences/dometahierarchy.groovy
+++ b/differences/dometahierarchy.groovy
@@ -95,8 +95,8 @@ def showmetaitems(metaitems) {
String info = ''
for (key in metaitems.keySet()) {
def relatedmetainfo = metaitems[key]
- def offsetpath = relatedmetainfo.offsetpath
- info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n"
+ def accumulatedpath = relatedmetainfo.accumulatedpath
+ info += "Name: ${key}\t\t\t\tPath: ${accumulatedpath}\n"
}
echo info
}
@@ -768,8 +768,8 @@ def compare(earlymetaitems, latermetaitems, key) {
boolean result = true;
echo "Collecting changes between early and later versions of component: ${key}"
- def earlymeta = earlymetaitems[key].meta
- def latermeta = latermetaitems[key].meta
+ def earlymeta = earlymetaitems[key].metainfo
+ def latermeta = latermetaitems[key].metainfo
summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ")
@@ -803,8 +803,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin
def earlymeta = meta.importrelated(true, earlymetafolder)
def latermeta = meta.importrelated(true, latermetafolder)
- def earlymetaitems = earlymeta.releasewalkerunique(md)
- def latermetaitems = latermeta.releasewalkerunique(md)
+ def earlymetaitems = earlymeta.releasewalkerunique(md, '', earlymetafolder)
+ def latermetaitems = latermeta.releasewalkerunique(md, '', latermetafolder)
echo "Early items:"
showmetaitems(earlymetaitems)
diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy
index 10b24a0..01c1890 100644
--- a/differences/metahierarchy.groovy
+++ b/differences/metahierarchy.groovy
@@ -37,8 +37,18 @@ pipeline {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim()
- importer.artifactimport(meta, EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION, EARLYROOTDIR, false, 'meta/**')
- importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR, false, 'meta/**')
+
+ def earlyimportoptions = importer.getNewImportOptions()
+ earlyimportoptions.source(EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION)
+ earlyimportoptions.setincrementversionnumber(false)
+ earlyimportoptions.setfilter('meta/**')
+ importer.artifactimport(meta, earlyimportoptions, EARLYROOTDIR)
+
+ def laterimportoptions = importer.getNewImportOptions()
+ laterimportoptions.source(LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION)
+ laterimportoptions.setincrementversionnumber(false)
+ laterimportoptions.setfilter('meta/**')
+ importer.artifactimport(meta, laterimportoptions, LATERROOTDIR)
}
}
}
@@ -58,7 +68,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts()
- archiveArtifacts "summary/**,reports/**,${artifactlist}"
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive("summary/**,reports/**,${artifactlist}")
}
}
}
diff --git a/import/importer.groovy b/import/importer.groovy
index 2562693..438410d 100644
--- a/import/importer.groovy
+++ b/import/importer.groovy
@@ -20,6 +20,8 @@ class ImportOptions {
String m_repo
String m_revision
+
+ boolean m_showdetails
ImportOptions(script,
String sourceselect = 'Jenkins job artifact',
@@ -31,7 +33,8 @@ class ImportOptions {
boolean flatten = false,
boolean includemetainfilter = true,
boolean clean = true,
- appendtoparentmeta = true) {
+ appendtoparentmeta = true,
+ showdetails = false) {
m_script = script
m_sourceselect = sourceselect.trim()
m_incrementversionnumber = incrementversionnumber
@@ -43,6 +46,25 @@ class ImportOptions {
m_includemetainfilter = includemetainfilter
m_clean = clean
m_appendtoparentmeta = appendtoparentmeta
+ m_showdetails = showdetails
+ }
+
+ String show() {
+ return """m_incrementversionnumber: ${m_incrementversionnumber}
+ m_filter: ${m_filter}
+ m_excludes: ${m_excludes}
+ m_fingerprint: ${m_fingerprint}
+ m_nested: ${m_nested}
+ m_flatten: ${m_flatten}
+ m_includemetainfilter: ${m_includemetainfilter}
+ m_clean: ${m_clean}
+ m_appendtoparentmeta: ${m_appendtoparentmeta}
+ m_sourceselect: ${m_sourceselect}
+ m_jobname: ${m_jobname}
+ m_buildnumberorselector: ${m_buildnumberorselector}
+ m_repo: ${m_repo}
+ m_revision: ${m_revision}
+ """
}
void setsourceselect(String sourceselect) {
@@ -56,7 +78,7 @@ class ImportOptions {
m_sourceselect = sourceselect
break
default:
- error("Unknown type of artifact source select: ${m_sourceselect}")
+ m_script.error("Unknown type of artifact source select: ${sourceselect}")
}
}
@@ -96,7 +118,7 @@ class ImportOptions {
m_appendtoparentmeta = appendtoparentmeta
}
- void jenkinsjob(String jobname, buildnumberorselector) {
+ void jenkinsjob(String jobname, String buildnumberorselector) {
m_jobname = jobname.trim()
m_buildnumberorselector = [
$class: 'ParameterizedBuildSelector',
@@ -109,7 +131,7 @@ class ImportOptions {
m_jobname = jobname.trim()
m_buildnumberorselector = [
$class: 'ParameterizedBuildSelector',
- parameterName: "${buildnumberorselector}"
+ parameterName: "${buildnumberorselector}"
]
setsourceselect('Jenkins job artifact')
}
@@ -125,6 +147,10 @@ class ImportOptions {
releaserepo(repo, revision)
setsourceselect(sourceselect)
}
+
+ void showdetails(boolean showdetails) {
+ m_showdetails = showdetails
+ }
}
ImportOptions getNewImportOptions() {
@@ -151,7 +177,7 @@ def conditionalClean(ImportOptions importoptions, String destpath) {
}
}
-def artifactimportfrombuildjob(meta, importoptions, String destpath) {
+def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Jenkins job artifact') {
error("Import options settings have not been set for: Jenkins job artifact")
return
@@ -183,7 +209,7 @@ def rewritemetafileasreleased(meta, String filepath) {
meta.saveJsonSerialised(filepath)
}
-def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
+def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Release repository') {
error("Import options settings have not been set for: Release repository")
return
@@ -199,24 +225,32 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist)
def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
-
- relatedimportinfo = importedmeta.getassociated()
- echo "Cloning associated repos"
- for(relatedmetainfo in relatedimportinfo) {
- def relatedmeta = relatedmetainfo.meta
- def relatedoffsetpath = relatedmetainfo.offsetpath
+
+ echo "Getting associated metadata from path: ${destpath}"
+ def collectedmetalist = importedmeta.getassociated(destpath)
+ for(def collectedmeta in collectedmetalist) {
+ echo "Collection meta item: ${collectedmeta.metainfo.componentversionuniqueidentifier()} offset path: ${collectedmeta.accumulatedpath}"
+ }
+
+ echo "Cloning associated repos inside path: ${destpath}"
+ for(def collectedmeta in collectedmetalist) {
+ def relatedmeta = collectedmeta.metainfo
+ def relatedoffsetpath = collectedmeta.accumulatedpath
def cloneurl = relatedmeta.releaseinfo.releaserepoURL
def clonerevision = "refs/tags/${relatedmeta.releasetag()}"
def clonepath = "${destpath}/${relatedoffsetpath}"
- echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}"
-
- gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, [])
-
- gh.stripgithistory(clonepath)
-
- def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}"
- echo "Marking related meta as released and rewriting meta file: ${metafilepath}"
- rewritemetafileasreleased(relatedmeta, metafilepath)
+ if (relatedmeta.componentidentifier() != '___' &&
+ relatedmeta.componentidentifier() != '_' &&
+ cloneurl != '') {
+ echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}"
+ gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, [])
+ gh.stripgithistory(clonepath)
+ def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}"
+ echo "Marking related meta as released and rewriting meta file: ${metafilepath}"
+ rewritemetafileasreleased(relatedmeta, metafilepath)
+ } else {
+ echo "Not importing component that would be placed at path: ${clonepath}"
+ }
}
gh.stripgithistory(destpath)
def metafilepath = "${destpath}/${meta.metafilepath()}"
@@ -229,7 +263,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
return importedmeta
}
-def artifactimportfromrepo(meta, importoptions, String destpath) {
+def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Release repository') {
error("Import options settings have not been set for: Release repository")
return
@@ -257,7 +291,10 @@ def artifactimportfromrepo(meta, importoptions, String destpath) {
return importedmeta
}
-def artifactimport(meta, importoptions, String destpath) {
+def artifactimport(meta, ImportOptions importoptions, String destpath) {
+ if (importoptions.m_showdetails) {
+ echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}"
+ }
switch (importoptions.m_sourceselect) {
case 'Jenkins job artifact':
case 'Jenkins job artefact':
@@ -341,4 +378,32 @@ def artifactimport(meta,
return artifactimport(meta, importoptions, destpath)
}
+// Import the artifacts of a named child component found below parent meta's hierarchy
+def artifactimport(meta,
+ parentmeta,
+ String parentmetapath,
+ String childproduct,
+ String childsubcomponent,
+ ImportOptions importoptions,
+ String destinationfolder) {
+ // Import from parent meta
+ def childmeta = meta.getNewMetaObject()
+ def childmeta2
+ echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}"
+ echo "From parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}"
+ def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent)
+ if (findresults.matchfound) {
+ childmeta = findresults.matchedmetaitem.metainfo
+ if (importoptions.m_sourceselect == 'Release repository' || childmeta.releaseinfo.released) {
+ importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag())
+ } else {
+ importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber)
+ }
+ childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder)
+ } else {
+ error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}")
+ }
+ return childmeta2
+}
+
return this;
diff --git a/install/installhelper.groovy b/install/installhelper.groovy
index 96a8b2e..8dbf23e 100644
--- a/install/installhelper.groovy
+++ b/install/installhelper.groovy
@@ -23,17 +23,32 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin
}
// Given details about artifacts to import and details of installers to build, import artifacts that are required
-def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) {
+def Map artifactsImporter(meta, importer, toBuild, artifactDetails, installerDetails, boolean showdetails = false) {
artifactFetched = [:]
+ if (showdetails) {
+ echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}")
+ }
def importoptions = importer.getNewImportOptions()
+ importoptions.showdetails(showdetails)
for (installer in toBuild) {
- def artifactKeys = installerDetails.get(installer)[1]
+ def installerinfo = installerDetails.get(installer)
+ if (showdetails) {
+ echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}")
+ }
+ def artifactKeys = installerinfo[1]
if (artifactKeys instanceof java.lang.String) {
artifactKeys = [ artifactKeys ]
}
+ if (showdetails) {
+ echo ("artifactKeys:\n${artifactKeys}")
+ }
for (artifactKey in artifactKeys) {
- (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
+ artifactDetail = artifactDetails.get(artifactKey)
+ if (showdetails) {
+ echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}")
+ }
+ (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail
if (artifactFetched.get(artifactKey) == null) {
importoptions.jenkinsjob(sourceProject, sourceselector)
importoptions.setincrementversionnumber(incrementversionnumber)
@@ -45,6 +60,9 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) {
}
}
}
+ if (showdetails) {
+ echo ("artifactFetched:\n${artifactFetched}")
+ }
return artifactFetched
}
@@ -93,6 +111,7 @@ def checkISMfilebackend(String xml) {
def checkISMfile(String ISMfile) {
echo "Checking ISM file: ${ISMfile}"
def xml = readFile(ISMfile)
+ //echo "ISM file xml: ${xml}"
(exitcode, message) = checkISMfilebackend(xml)
echo message
if (exitcode > 0) {
diff --git a/meta/folder.groovy b/meta/folder.groovy
index 694a40c..6715145 100644
--- a/meta/folder.groovy
+++ b/meta/folder.groovy
@@ -20,15 +20,19 @@ abstract class GISJsonSerialised implements Serializable {
}
class ProductInfo extends GISJsonSerialised {
- String productname
- String subcomponentname
- String variant
+ private String format
+ private String productname
+ private String subcomponentname
+ private String variant
+ private String uniqueid
- ProductInfo(script, productname = "", subcomponentname = "", variant = "") {
+ ProductInfo(script, String productname = '', String subcomponentname = '', String variant = '') {
super(script)
+ this.format = '0.1'
this.productname = productname
this.subcomponentname = subcomponentname
this.variant = variant
+ this.uniqueid = UUID.randomUUID().toString()
}
void set(String productname, String subcomponentname, String variant = '') {
@@ -74,33 +78,40 @@ class ProductInfo extends GISJsonSerialised {
this.productname = otherinfo.productname
this.subcomponentname = otherinfo.subcomponentname
this.variant = otherinfo.variant
+ this.uniqueid = otherinfo.uniqueid
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
productname = rawmeta['productname']
subcomponentname = rawmeta['subcomponentname']
- variant = rawmeta['variant'] ?: ""
+ variant = rawmeta['variant'] ?: ''
+ uniqueid = rawmeta['uniqueid'] ?: uniqueid
}
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'productname' : productname,
'subcomponentname' : subcomponentname,
'variant' : variant,
+ 'uniqueid': uniqueid,
]
return data
}
}
class GitInfo extends GISJsonSerialised {
+ private String format
private String sourcepath
private String sourcerevision
private String gitrevision
private String remoteurl
private String remoteinfo
- GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") {
+ GitInfo(script, sourcepath = '', sourcerevision = '', gitrevision = '', remoteurl = '', remoteinfo = '') {
super(script)
+ this.format = '0.1'
this.sourcepath = sourcepath
this.sourcerevision = sourcerevision
this.gitrevision = gitrevision
@@ -134,6 +145,7 @@ class GitInfo extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
sourcepath = rawmeta['sourcepath']
sourcerevision = rawmeta['sourcerevision']
gitrevision = rawmeta['gitrevision']
@@ -143,6 +155,7 @@ class GitInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'sourcepath' : sourcepath,
'sourcerevision' : sourcerevision,
'gitrevision' : gitrevision,
@@ -188,15 +201,17 @@ class JenkinsBuildParameter extends GISJsonSerialised {
}
class JenkinsBuildInfo extends GISJsonSerialised {
- String buildjobname
- int buildnumber
+ private String format
+ private String buildjobname
+ private int buildnumber
private String buildmachine
private String builddate
- ArrayList parameters
- boolean isfullbuild
+ private ArrayList parameters
+ private boolean isfullbuild
- JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) {
+ JenkinsBuildInfo(script, String buildjobname = '', int buildnumber = 0, String buildmachine = '', String builddate = '', boolean isfullbuild = true) {
super(script)
+ this.format = '0.1'
this.buildjobname = buildjobname
this.buildnumber = buildnumber
this.buildmachine = buildmachine
@@ -228,6 +243,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
buildjobname = rawmeta['buildjobname']
buildnumber = rawmeta['buildnumber']
buildmachine = rawmeta['buildmachine']
@@ -253,6 +269,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'buildjobname' : buildjobname,
'buildnumber' : buildnumber,
'buildmachine' : buildmachine,
@@ -265,12 +282,14 @@ class JenkinsBuildInfo extends GISJsonSerialised {
}
class BuildStampInfo extends GISJsonSerialised {
- String buildstampprefix
- int revision
- String buildstamp
+ private String format
+ private String buildstampprefix
+ private int revision
+ private String buildstamp
BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") {
super(script)
+ this.format = '0.1'
this.buildstampprefix = buildstampprefix
this.revision = revision
this.buildstamp = buildstamp
@@ -293,6 +312,20 @@ class BuildStampInfo extends GISJsonSerialised {
set(other.buildstampprefix, other.revision, other.buildstamp)
}
+ // Override the buildstamp
+ void override(String buildstamp) {
+ this.buildstamp = buildstamp
+ script.echo("Build stamp overridden to: ${this.buildstamp}")
+ def s = this.buildstamp.split('\\.')
+ if (s.size() != 4) {
+ script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4")
+ }
+ this.buildstampprefix = "${s[0]}.${s[1]}.${s[2]}"
+ script.echo("Stamp prefix overridden to: ${this.buildstampprefix}")
+ this.revision = s[3].toInteger()
+ script.echo("Revision overridden to: ${this.revision}")
+ }
+
String buildstampcommasep() {
def String buildstampcommasep = buildstamp.replace(".", ",")
return buildstampcommasep
@@ -319,6 +352,7 @@ class BuildStampInfo extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
buildstampprefix = rawmeta['buildstampprefix']
revision = rawmeta['revision']
buildstamp = rawmeta['buildstamp']
@@ -326,6 +360,7 @@ class BuildStampInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'buildstampprefix' : buildstampprefix,
'revision' : revision,
'buildstamp' : buildstamp,
@@ -335,18 +370,20 @@ class BuildStampInfo extends GISJsonSerialised {
}
class ReleaseInfo extends GISJsonSerialised {
- String releaserepoURL
- ArrayList releaseitems
- boolean released
+ private String format
+ private String releaserepoURL
+ private ArrayList releaseitems
+ private boolean released
- ReleaseInfo(script, String releaserepoURL = "", boolean released = false) {
+ ReleaseInfo(script, String releaserepoURL = '', boolean released = false) {
super(script)
+ this.format = '0.1'
this.releaserepoURL = releaserepoURL
this.releaseitems = new ArrayList()
this.released = released
}
- void set(String releaserepoURL = "") {
+ void set(String releaserepoURL = '') {
this.releaserepoURL = releaserepoURL
}
@@ -368,6 +405,7 @@ class ReleaseInfo extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
releaserepoURL = rawmeta['releaserepoURL']
releaseitems = new ArrayList()
for (rawreleaseitem in rawmeta['releaseitems']) {
@@ -378,6 +416,7 @@ class ReleaseInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'releaserepoURL' : releaserepoURL,
'releaseitems' : releaseitemssserialised(),
'released' : released
@@ -392,7 +431,7 @@ class ConfigurationInfo extends GISJsonSerialised {
private String configurationversion
private String configurationSHA
- ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") {
+ ConfigurationInfo(script, configurationname = '', configurationURL = '', configurationversion = '', configurationSHA = '') {
super(script)
this.configurationname = configurationname
this.configurationURL = configurationURL
@@ -422,7 +461,7 @@ class ChecksumPair extends GISJsonSerialised {
private String filepath
private String sum
- ChecksumPair(script, String filepath = "", String sum = "") {
+ ChecksumPair(script, String filepath = '', String sum = '') {
super(script)
this.filepath = filepath
this.sum = sum
@@ -443,11 +482,13 @@ class ChecksumPair extends GISJsonSerialised {
}
class ChecksumSet extends GISJsonSerialised {
+ private String format
private String artifactpath
private ArrayList checksumpairs
- ChecksumSet(script, artifactpath = "") {
+ ChecksumSet(script, artifactpath = '') {
super(script)
+ this.format = '0.1'
this.artifactpath = artifactpath
checksumpairs = new ArrayList()
}
@@ -467,6 +508,7 @@ class ChecksumSet extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
artifactpath = rawmeta['artifactpath']
checksumpairs = new ArrayList()
for (rawchecksumpair in rawmeta['checksumpairs']) {
@@ -478,6 +520,7 @@ class ChecksumSet extends GISJsonSerialised {
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'artifactpath' : artifactpath,
'checksumpairs' : checksumpairsserialised(),
]
@@ -525,19 +568,23 @@ class ChecksumInfo extends GISJsonSerialised {
}
class PublishableInfo extends GISJsonSerialised {
+ private String format
private String filepath
- PublishableInfo(script, String filepath = "") {
+ PublishableInfo(script, String filepath = '') {
super(script)
+ this.format = '0.1'
this.filepath = filepath
}
void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
filepath = rawmeta['filepath']
}
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'filepath' : filepath,
]
return data
@@ -545,43 +592,105 @@ class PublishableInfo extends GISJsonSerialised {
}
class MetaInfo extends GISJsonSerialised {
- private static String FORMAT = "0.1"
- private static String METAFOLDERNAME = "meta"
- private static String METAFILENAME = "info.json"
+ private static String METAFOLDERNAME = 'meta'
+ private static String METAFILENAME = 'info.json'
private static String METAARTIFACTS = "${METAFOLDERNAME}/**"
+ private static String format = '0.2'
- class RelatedMetaInfo extends GISJsonSerialised {
- String offsetpath
- MetaInfo meta
-
- RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) {
+ abstract class RelatedMetaInfo extends GISJsonSerialised {
+ String format
+
+ RelatedMetaInfo(script, format) {
super(script)
+ this.format = format
+ }
+
+ abstract void deserialiseJson(rawmeta)
+ abstract LinkedHashMap serialisationdata()
+ abstract String getrelatedid()
+ abstract void markreleased()
+ }
+
+ class RelatedMetaInfo_v0_1 extends RelatedMetaInfo {
+ private MetaInfo meta
+ private String offsetpath
+ private String uniqueid
+
+ RelatedMetaInfo_v0_1(script, String offsetpath = '', MetaInfo meta = null, String uniqueid = UUID.randomUUID().toString()) {
+ super(script, '0.1')
this.offsetpath = offsetpath
+ this.uniqueid = uniqueid
this.meta = meta
}
void deserialiseJson(rawmeta) {
offsetpath = rawmeta['offsetpath']
+ uniqueid = rawmeta['uniqueid'] ?: uniqueid
meta = new MetaInfo(script)
meta.deserialiseJson(rawmeta['meta'])
}
LinkedHashMap serialisationdata() {
def data = [
+ 'format' : format,
'offsetpath' : offsetpath,
+ 'uniqueid' : uniqueid,
'meta' : meta.serialisationdata(),
]
return data
}
+
+ String getrelatedid() {
+ return uniqueid
+ }
+
+ void markreleased() {
+ meta.releaseinfo.markreleased()
+ }
}
- private String format = FORMAT
- ProductInfo productinfo
- GitInfo gitinfo
- JenkinsBuildInfo jenkinsbuildinfo
- BuildStampInfo buildstampinfo
- ReleaseInfo releaseinfo
- ChecksumInfo checksuminfo
+ class RelatedMetaInfo_v0_2 extends RelatedMetaInfo {
+ private String importpath
+ private String offsetpath
+ private String uniqueid
+
+ RelatedMetaInfo_v0_2(script, String importpath = '', String offsetpath = '', String uniqueid = UUID.randomUUID().toString()) {
+ super(script, '0.2')
+ this.importpath = importpath
+ this.offsetpath = offsetpath
+ this.uniqueid = uniqueid
+ }
+
+ void deserialiseJson(rawmeta) {
+ //format = rawmeta['format']
+ offsetpath = rawmeta['offsetpath']
+ uniqueid = rawmeta['uniqueid']
+ }
+
+ LinkedHashMap serialisationdata() {
+ def data = [
+ 'format' : format,
+ 'offsetpath' : offsetpath,
+ 'uniqueid' : uniqueid
+ ]
+ return data
+ }
+
+ String getrelatedid() {
+ return uniqueid
+ }
+
+ void markreleased() {
+ // Do nothing
+ }
+ }
+
+ private ProductInfo productinfo
+ private GitInfo gitinfo
+ private JenkinsBuildInfo jenkinsbuildinfo
+ private BuildStampInfo buildstampinfo
+ private ReleaseInfo releaseinfo
+ private ChecksumInfo checksuminfo
private ArrayList configurationinfo
private ArrayList publishableinfo
private LinkedHashMap custominfo
@@ -601,15 +710,11 @@ class MetaInfo extends GISJsonSerialised {
associatedmeta = new ArrayList()
}
- List getassociated() {
- return associatedmeta
- }
-
void markreleased() {
script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released")
releaseinfo.markreleased()
for (associated in associatedmeta) {
- associated.meta.releaseinfo.markreleased()
+ associated.markreleased()
}
}
@@ -631,6 +736,7 @@ class MetaInfo extends GISJsonSerialised {
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
configurationinfo.add(ci)
+ return ci
}
void addCustomInfo(String customId, String customValue) {
@@ -662,8 +768,8 @@ class MetaInfo extends GISJsonSerialised {
}
void deserialiseJson(rawmeta) {
- if (rawmeta['format'] != FORMAT) {
- script.error("Unsupported meta format found at ${filepath}")
+ if (rawmeta['format'].toString() != '0.1' && rawmeta['format'].toString() != '0.2' ) {
+ script.error("Unsupported meta format found")
return
}
productinfo.deserialiseJson(rawmeta['productinfo'])
@@ -684,9 +790,15 @@ class MetaInfo extends GISJsonSerialised {
}
custominfo = rawmeta['custominfo']
for (rawrelatedmeta in rawmeta['associatedmeta']) {
- def rm = new RelatedMetaInfo(script)
- rm.deserialiseJson(rawrelatedmeta)
- associatedmeta.add(rm)
+ if (!rawrelatedmeta['format'] || rawrelatedmeta['format'] == '0.1') {
+ def rm = new RelatedMetaInfo_v0_1(script)
+ rm.deserialiseJson(rawrelatedmeta)
+ associatedmeta.add(rm)
+ } else if (rawrelatedmeta['format'] == '0.2') {
+ def rm = new RelatedMetaInfo_v0_2(script)
+ rm.deserialiseJson(rawrelatedmeta)
+ associatedmeta.add(rm)
+ }
}
}
@@ -733,19 +845,32 @@ class MetaInfo extends GISJsonSerialised {
def String adjustedpath = relativize(destpath)
def importedmetafile = adjustedpath + "/" + metafilepath()
if (script.fileExists(importedmetafile)) {
+ script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})")
mi.deserialiseJson(importedmetafile)
+
+ RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath, mi.productinfo.uniqueid)
+ if (appendtoparentmeta) {
+ associatedmeta.add(rmi)
+ }
} else {
script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist")
- mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA)
+ addConfigurationInfo('', givenRepo, givenRevision, givenSHA)
}
-
- RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi)
- if (appendtoparentmeta) {
- associatedmeta.add(rmi)
- }
-
return mi
}
+
+ def copyrelatedmeta() {
+ script.echo("Copying related input meta data to output meta")
+ for (relatedmetainfo in associatedmeta) {
+ def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}"
+ def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}"
+ script.echo("Copying related meta folder: ${srcpath} to meta output folder: ${destpath} recursively")
+ script.fileOperations([
+ script.folderCreateOperation(folderPath: destpath),
+ script.folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath)
+ ])
+ }
+ }
LinkedHashMap serialisationdata() {
def data = [
@@ -768,10 +893,10 @@ class MetaInfo extends GISJsonSerialised {
return METAFOLDERNAME
}
- String generateartifacts(ArrayList releasedfromhere = new ArrayList(), // These items are recorded in meta as released from here
- ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here
- String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
- ) {
+ def String generateartifacts(ArrayList releasedfromhere = new ArrayList(), // These items are recorded in meta as released from here
+ ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here
+ String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
+ ) {
def String artifactlist = METAARTIFACTS
releaseinfo.addReleaseItem(METAARTIFACTS)
for (releaseitem in releasedfromhere) {
@@ -784,31 +909,6 @@ class MetaInfo extends GISJsonSerialised {
saveJsonSerialised(metafilepath)
return artifactlist
}
-
- // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java
- private ArrayList releasewalkerp(int maxdepth, ArrayList releasemetacollection, String pathsofar) {
- if (maxdepth > 0) {
- if (releaseinfo.releaserepoURL) {
- RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this)
- releasemetacollection.add(rmi)
- }
- if (pathsofar) {
- pathsofar += "/"
- }
- for (relatedmetainfo in associatedmeta) {
- MetaInfo othermeta = relatedmetainfo.meta
- String newpathsofar = pathsofar + relatedmetainfo.offsetpath
- releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar)
- }
- }
- return releasemetacollection
- }
-
- ArrayList releasewalker(int maxdepth, String startpath = "") {
- ArrayList releasemetacollection = new ArrayList()
- releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
- return releasemetacollection
- }
String componentidentifier() {
return productinfo.productname + "_" + productinfo.subcomponentname
@@ -830,78 +930,235 @@ class MetaInfo extends GISJsonSerialised {
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
}
- Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) {
+ class CollectedMeta {
+ private MetaInfo metainfo
+ private String accumulatedpath
+ private String accumulatedmetapath
+
+ CollectedMeta(MetaInfo metainfo, String accumulatedpath = '', String accumulatedmetapath = '') {
+ this.metainfo = metainfo
+ this.accumulatedpath = accumulatedpath
+ this.accumulatedmetapath = accumulatedmetapath
+ }
+ }
+
+ class IterationInfo {
+ private ArrayList metacollection
+ private Map metamap
+ private String comment
+ private int level
+ private String gatheredpath
+ private String gatheredmetapath
+ private boolean limiteddepth
+ private int maxdepth
+
+ IterationInfo(ArrayList metacollection,
+ Map metamap,
+ String comment = '',
+ int level = 0,
+ String gatheredpath = '',
+ String gatheredmetapath = '',
+ boolean limiteddepth = false,
+ int maxdepth = 0) {
+ this.metacollection = metacollection
+ this.metamap = metamap
+ this.comment = comment
+ this.level = level
+ this.gatheredpath = gatheredpath
+ this.gatheredmetapath = gatheredmetapath
+ this.limiteddepth = limiteddepth
+ this.maxdepth = maxdepth
+ }
+
+ String show() {
+ return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}"
+ }
+
+ void add(CollectedMeta item) {
+ metacollection.add(item)
+ metamap.put(item.metainfo.productinfo.uniqueid, item)
+ }
+ }
+
+ def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) {
+ def MetaInfo mi = new MetaInfo(script)
+
+ def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
+ def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
+ def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}"
+ def boolean imported
+ // If this has already been read in from a file
+ if (relatedmetainfo.getrelatedid() in ii.metamap) {
+ //script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it")
+ mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo
+ imported = true
+ } else if (script.fileExists(importedmetafile)) {
+ mi.deserialiseJson(importedmetafile)
+ imported = true
+ } else {
+ script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist")
+ imported = false
+ }
+
+ def childmetainfo = [
+ 'imported': imported,
+ 'nextgatheredpath': nextgatheredpath,
+ 'nextgatheredmetapath': nextgatheredmetapath,
+ 'childmeta': mi
+ ]
+ return childmetainfo
+ }
+
+ def walkrelated_v0_1(IterationInfo ii) {
+ //script.echo("Walk related v0.1: ${ii.show()}")
+ if (!ii.limiteddepth || ii.maxdepth > 0) {
+ ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath))
+ ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n'
+ for (relatedmetainfo in associatedmeta) {
+ if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
+ def MetaInfo othermeta = relatedmetainfo.meta
+ def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
+ def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
+ def nextii = new IterationInfo(ii.metacollection,
+ ii.metamap,
+ ii.comment,
+ ii.level + 1,
+ nextgatheredpath,
+ nextgatheredmetapath,
+ ii.limiteddepth,
+ ii.maxdepth - 1)
+ def results = othermeta.walkrelated_v0_1(nextii)
+ ii.metacollection = results.metacollection
+ ii.metamap = results.metamap
+ ii.comment = results.comment
+ } else {
+ script.error("There is non v0.1 format related meta info under v0.1 related meta info")
+ }
+ }
+ }
+ return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ]
+ }
+
+ def walkrelated(IterationInfo ii) {
+ //script.echo("Walk related: ${ii.show()}")
+ if (!ii.limiteddepth || ii.maxdepth > 0) {
+ ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath))
+ ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n'
+ for (relatedmetainfo in associatedmeta) {
+ //script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}")
+ if (relatedmetainfo.format == '0.2') {
+ def childmetainfo = openchildmeta(ii, relatedmetainfo)
+ if (childmetainfo.imported) {
+ def nextii = new IterationInfo(ii.metacollection,
+ ii.metamap,
+ ii.comment,
+ ii.level + 1,
+ childmetainfo.nextgatheredpath,
+ childmetainfo.nextgatheredmetapath,
+ ii.limiteddepth,
+ ii.maxdepth - 1)
+ def results = childmetainfo.childmeta.walkrelated(nextii)
+ ii.metacollection = results.metacollection
+ ii.metamap = results.metamap
+ ii.comment = results.comment
+ }
+ } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
+ def MetaInfo othermeta = relatedmetainfo.meta
+ def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
+ def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
+ def nextii = new IterationInfo(ii.metacollection,
+ ii.metamap,
+ ii.comment,
+ ii.level + 1,
+ nextgatheredpath,
+ nextgatheredmetapath,
+ ii.limiteddepth,
+ ii.maxdepth - 1)
+ def results = othermeta.walkrelated_v0_1(nextii)
+ ii.metacollection = results.metacollection
+ ii.metamap = results.metamap
+ ii.comment = results.comment
+ }
+ }
+ }
+ return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ]
+ }
+
+ // Walks all layers of associated data only
+ def allrelatedmeta(String metapath = '') {
+ def ArrayList metacollection = new ArrayList()
+ def Map metamap = new LinkedHashMap()
+ return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath))
+ }
+
+ ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') {
+ def ArrayList metacollection = new ArrayList()
+ def Map metamap = new LinkedHashMap()
+ def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth)
+ script.echo("Release walker iteration info at start:\n${ii.show()}")
+ def results = walkrelated(ii)
+ return results.metacollection
+ }
+
+ // Walks 1 layer of associated data only
+ def getassociated(String rootpath) {
+ return releasewalker(2, '', "${rootpath}/${METAFOLDERNAME}") // Max depth 2 (including itself)
+ }
+
+ Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) {
if (releasemetacollection.containsKey(uniquestring)) {
def existingentry = releasemetacollection[uniquestring]
- if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) {
- releasemetacollection.put(uniquestring, relatedmetainfo)
+ def existingentrypathlength = existingentry.accumulatedpath.split('/').size()
+ def newentrypathlength = metaitem.accumulatedpath.split('/').size()
+ if (existingentrypathlength > newentrypathlength) {
+ releasemetacollection.put(uniquestring, metaitem)
}
} else {
- releasemetacollection.put(uniquestring, relatedmetainfo)
+ releasemetacollection.put(uniquestring, metaitem)
}
return releasemetacollection
}
-
- Map releasewalkerunique(int maxdepth, String startpath = "") {
- def ArrayList releasemetacollection = new ArrayList()
- releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
- def Map releasemetauniquecollection = new LinkedHashMap()
- for (relatedmetainfo in releasemetacollection) {
- def String uniquestring = relatedmetainfo.meta.componentidentifier()
- releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo)
+ Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') {
+ def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
+
+ def Map versionuniquecollection = new LinkedHashMap()
+ for (metaitem in metacollection) {
+ def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier()
+ versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem)
}
- return releasemetauniquecollection
+ return versionuniquecollection
}
- Map releasewalkerversionunique(int maxdepth, String startpath = "") {
- ArrayList releasemetacollection = new ArrayList()
- releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
+ Map releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') {
+ def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
- def Map releasemetaversionuniquecollection = new LinkedHashMap()
- for (relatedmetainfo in releasemetacollection) {
- def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier()
- releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo)
+ def Map uniquecollection = new LinkedHashMap()
+ for (metaitem in metacollection) {
+ def String uniquestring = metaitem.metainfo.componentidentifier()
+ uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem)
}
- return releasemetaversionuniquecollection
- }
-
- def walkrelated(ArrayList metacollection, String comment = '', int level = 0) {
- def results = [
- 'metacollection' : metacollection,
- 'comment': comment
- ]
- results.metacollection.add(this)
- results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
- for (relatedmetainfo in associatedmeta) {
- MetaInfo othermeta = relatedmetainfo.meta
- results = othermeta.walkrelated(results.metacollection, results.comment, level + 1)
- }
- return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
- }
-
- def allrelatedmeta() {
- ArrayList metacollection = new ArrayList()
- return walkrelated(metacollection)
+ return uniquecollection
}
MetaInfo getNewMetaObject(script) {
return new MetaInfo(script)
}
- def findAssociatedMeta(String productname, String subcomponentname) {
+ def findAssociatedMeta(String parentmetapath, String productname, String subcomponentname) {
def results = [
- 'matchedmeta' : getNewMetaObject(this),
+ 'matchedmetaitem' : new CollectedMeta(this),
'matchfound' : false
]
- def walkresults = allrelatedmeta()
- for (dependentmeta in walkresults.metacollection) {
- if (dependentmeta.productinfo.productname == productname &&
- dependentmeta.productinfo.subcomponentname == subcomponentname) {
- script.echo("Found matching component: ${dependentmeta.globalreleasetag()}")
- results.matchedmeta = dependentmeta
+ def walkresults = allrelatedmeta("${parentmetapath}/${METAFOLDERNAME}")
+ for (dependentmetaitem in walkresults.metacollection) {
+ script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}")
+ if (dependentmetaitem.metainfo.productinfo.productname == productname &&
+ dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) {
+ script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}")
+ results.matchedmetaitem = dependentmetaitem
results.matchfound = true
break
}
@@ -911,9 +1168,9 @@ class MetaInfo extends GISJsonSerialised {
}
MetaInfo metareset(script) {
- echo "Resetting meta folder"
def mi = new MetaInfo(script)
+ echo "Resetting meta folder"
dir(mi.folder()) {
deleteDir()
}
@@ -921,13 +1178,13 @@ MetaInfo metareset(script) {
return mi
}
-MetaInfo metafromfolder(String folder = "") {
+MetaInfo metafromfolder(String folder = '') {
MetaInfo buildmeta = new MetaInfo(this)
buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}")
return buildmeta
}
-MetaInfo metafromfolderSlurper(String folder = "") {
+MetaInfo metafromfolderSlurper(String folder = '') {
MetaInfo buildmeta = new MetaInfo(this)
buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}")
return buildmeta
diff --git a/packaging/debian.groovy b/packaging/debian.groovy
index c0a4dbb..9f2f4d3 100644
--- a/packaging/debian.groovy
+++ b/packaging/debian.groovy
@@ -64,45 +64,47 @@ def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, S
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix)
}
-def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) {
- try {
- sh """#!/bin/bash
- # Exit if any command fails
- set -xe
+def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String credentials_id) {
+ withCredentials([usernamePassword(credentialsId: credentials_id,
+ usernameVariable: 'SUDO_USERNAME',
+ passwordVariable: 'SUDO_PASSWORD')]) {
+ def sudo_S = "echo ${SUDO_PASSWORD} | sudo -S"
+ def sudo_Sk = "echo ${SUDO_PASSWORD} | sudo -S -k"
+ try {
+ sh """#!/bin/bash
+ # Exit if any command fails
+ set -xe
- echo "${password}" | sudo -S echo
+ cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}"
- cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}"
+ ${sudo_Sk} chown -v -R root: "${packagedefs.DEBPATH}"
- sudo chown -v -R root: "${packagedefs.DEBPATH}"
+ mkdir -v -p "${packageout}"
+ echo "Building package:"
+ dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
- mkdir -v -p "${packageout}"
- echo "Building package:"
- dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
+ mkdir -v -p "${uniquepackageout}"
+ cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
- mkdir -v -p "${uniquepackageout}"
- cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
+ echo "Showing package:"
+ dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
+ echo "Showing package contents:"
+ dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
- echo "Showing package:"
- dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
- echo "Showing package contents:"
- dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
+ echo "Showing package lintian output:"
+ lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true
- echo "Showing package lintian output:"
- lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true
+ ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}"
+ """
+ }
+ catch (Exception e) {
+ echo "Exception occurred"
+ sh """#!/bin/bash -v
+ ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}"
- sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
- """
- }
- catch (Exception e) {
- echo "Exception occurred"
- sh """#!/bin/bash -v
- echo "${password}" | sudo -S echo
-
- sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
-
- exit 1
- """
+ exit 1
+ """
+ }
}
}
diff --git a/publish/do.groovy b/publish/do.groovy
index 1b227f4..ea090f0 100644
--- a/publish/do.groovy
+++ b/publish/do.groovy
@@ -60,7 +60,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) {
summaryappend("Artifacts: ")
- def releasemeta = releaseinfo.meta
+ def releasemeta = releaseinfo.metainfo
def String componentURL = releasemeta.releaseinfo.releaserepoURL
def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}"
def publishableitems = releasemeta.publishableinfo
@@ -113,7 +113,7 @@ def copydirectory(File dirFrom, File dirTo) {
}
def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) {
- def releasemeta = releaseinfo.meta
+ def releasemeta = releaseinfo.metainfo
def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta)
summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ")
@@ -140,14 +140,14 @@ def convertitemstopublish(String itemstopublishstring) {
// Publish selected items from a release to the customer folder on the ftp site
// itemstopublishstring is a comma-seperated set of strings in this format ##
-def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
+def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
int md = maxdepth.toInteger()
resetfolders()
preconditions()
def productline = releasemeta.productinfo.productname
// Walk the meta information to a max depth, looking for artifacts to publish
- def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md)
+ def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md, '', releasemetapath)
echo "Version unique components:"
def String versionuniquecomponent = ""
@@ -167,8 +167,8 @@ def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring
return [summarystring, markunstable, unstablereason]
}
-def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) {
- return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth)
+def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, String customer, String softwarerelease, String maxdepth) {
+ return publishhierarchy(hostedftpsiteinfo, releasemeta, releasemetapath, '', customer, softwarerelease, maxdepth)
}
return this;
diff --git a/publish/package.groovy b/publish/package.groovy
index 958a614..68c41f3 100644
--- a/publish/package.groovy
+++ b/publish/package.groovy
@@ -48,7 +48,12 @@ pipeline {
steps {
script {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
- packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST)
+
+ def packageimportoptions = importer.getNewImportOptions()
+ packageimportoptions.jenkinsjob(PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR)
+ packageimportoptions.setincrementversionnumber(true)
+ packagemeta = importer.artifactimport(meta, packageimportoptions, PACKAGEDEST)
+
PACKAGE_FOLDER = "${PACKAGEDEST}/package"
UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage"
}
diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy
index 9d51915..ce6a805 100644
--- a/publish/promptingpublish.groovy
+++ b/publish/promptingpublish.groovy
@@ -114,6 +114,7 @@ pipeline {
'Select software items',
'Software items',
releasemeta,
+ SOURCEDIR,
ITEMSDEFAULTLIST,
MAX_META_DEPTH,
'20',
@@ -135,7 +136,7 @@ pipeline {
script {
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
- (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH)
+ (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, SOURCEDIR, selecteditems, customer, release, MAX_META_DEPTH)
if (markunstable) {
env.unstablereason = unstablereason
currentBuild.result = 'UNSTABLE'
@@ -147,7 +148,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts()
- archiveArtifacts "summary/**,${artifactlist}"
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive("summary/**,${artifactlist}")
}
}
}
diff --git a/publish/publish.groovy b/publish/publish.groovy
index 82a32ad..ad33df9 100644
--- a/publish/publish.groovy
+++ b/publish/publish.groovy
@@ -58,7 +58,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts()
- archiveArtifacts "summary/**,${artifactlist}"
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive("summary/**,${artifactlist}")
}
}
}
diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy
index 677970e..9f6c368 100644
--- a/publish/publishitems.groovy
+++ b/publish/publishitems.groovy
@@ -18,6 +18,7 @@ class PublishableItemsSelection {
String name,
String description,
releasemeta,
+ String releasemetapath,
String preselectedext,
String metalevelsstringext,
String visibleItemCountExt,
@@ -25,7 +26,7 @@ class PublishableItemsSelection {
outputSelectionfromPreselect(preselectedmenuitems, preselectedext)
def Integer metalevelsext = metalevelsstringext.toInteger()
def Integer visibleItemCount = visibleItemCountExt.toInteger()
- def metaitems = releasemeta.releasewalkerunique(metalevelsext)
+ def metaitems = releasemeta.releasewalkerunique(metalevelsext, '', releasemetapath)
for (key in metaitems.keySet()) {
def releaseinfo = metaitems[key]
outputDescription(menuitemdescriptions, releaseinfo)
@@ -89,7 +90,7 @@ class PublishableItemsSelection {
}
def outputDescription(menuitems, releaseinfo) {
- def meta = releaseinfo.meta
+ def meta = releaseinfo.metainfo
for (publishableitem in meta.publishableinfo) {
menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}")
@@ -97,7 +98,7 @@ class PublishableItemsSelection {
}
def outputSelection(menuitems, releaseinfo) {
- def meta = releaseinfo.meta
+ def meta = releaseinfo.metainfo
for (publishableitem in meta.publishableinfo) {
menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}")
@@ -113,13 +114,14 @@ PublishableItemsSelection createItemSelector(
String name,
String description,
releasemeta,
+ String releasemetapath,
String preselectedext,
String metalevelsstringext,
String visibleItemCountExt = '20',
String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT"
PublishableItemsSelection pis = new PublishableItemsSelection(this)
- pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type)
+ pis.init(name, description, releasemeta, releasemetapath, preselectedext, metalevelsstringext, visibleItemCountExt, type)
return pis
}
diff --git a/release/do.groovy b/release/do.groovy
index e0b9471..4dcb091 100644
--- a/release/do.groovy
+++ b/release/do.groovy
@@ -112,20 +112,20 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde
// Copy relevant artifacts to temp folder
summaryappend("Artifacts: ")
def boolean result = true
- for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) {
+ for (artifactfilter in buildinfo.metainfo.releaseinfo.releaseitems) {
def filterpath = artifactfilter
- if (buildinfo.offsetpath) {
- filterpath = buildinfo.offsetpath + '/' + artifactfilter
+ if (buildinfo.accumulatedpath) {
+ filterpath = buildinfo.accumulatedpath + '/' + artifactfilter
}
// Copy relevant artifacts to temp folder
- echo "Copying artifacts: ${filterpath} to ${tempfolder}"
+ echo "Copying artifacts: Filter path: ${filterpath} to ${tempfolder} from job: ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname} #${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}"
try {
copyArtifacts(
filter: filterpath,
projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname,
selector: [
$class: 'ParameterizedBuildSelector',
- parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}"
+ parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}"
],
target: tempfolder
)
@@ -136,9 +136,9 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde
}
if (result) {
// Move relevant artifacts from temp folder to release position
- def originalrootdir = tempfolder + "/" + buildinfo.offsetpath
+ def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath
dir(originalrootdir) {
- sh("mv * ${repofolder}")
+ sh("mv -v * ${repofolder}")
}
}
summaryappend("${artifactfilter},")
@@ -375,7 +375,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
}
def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) {
- def buildmeta = buildinfo.meta
+ def buildmeta = buildinfo.metainfo
def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl)
def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}"
def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}"
@@ -396,13 +396,13 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri
repoandtagsappend("\n")
}
-def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) {
+def releasehierarchy(String buildfolder, String metafolder, buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) {
def int md = maxdepth.toInteger()
resetfolders()
preconditions()
// Walk the meta information to a max depth, looking for components to release
- def componentReleaseInfo = buildmeta.releasewalkerunique(md)
+ def componentReleaseInfo = buildmeta.releasewalkerunique(md, buildfolder, metafolder)
echo "Unique components:"
def String versioncomponent = ""
for (key in componentReleaseInfo.keySet()) {
@@ -411,14 +411,19 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
echo versioncomponent
// Walk the meta information to a max depth, looking for components to release
- def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md)
- echo "Version unique components:"
- def String versionuniquecomponent = ""
+ def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder, metafolder)
+ def String versionuniquecomponent = ''
+ def String versionwithpathscomponent = ''
for (key in componentReleaseInfoVersionUnique.keySet()) {
versionuniquecomponent += "${key}\n"
+ versionwithpathscomponent += "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n"
}
+ echo 'Version unique components:'
echo versionuniquecomponent
+ echo 'Version unique components with paths:'
+ echo versionwithpathscomponent
+
if (DO_INTEGRITY_CHECK == "true") {
if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) {
error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)"
@@ -427,7 +432,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key]
- if (!buildinfo.jenkinsbuildinfo.isFullBuild()) {
+ if (!buildinfo.metainfo.jenkinsbuildinfo.isFullBuild()) {
error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)"
}
}
@@ -436,8 +441,11 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
// For each component
for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key]
- if (toplevelid != key) {
- releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush)
+ echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}"
+ if (buildinfo.metainfo.componentidentifier() != '___' && buildinfo.metainfo.componentidentifier() != '_') {
+ if (toplevelid != key) {
+ releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush)
+ }
}
}
// Do the top level last
diff --git a/release/release.groovy b/release/release.groovy
index 351985d..82af511 100644
--- a/release/release.groovy
+++ b/release/release.groovy
@@ -23,18 +23,16 @@ pipeline {
stage('Get build artifact meta') {
steps {
script {
- BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts"
- copyArtifacts(
- filter: 'meta/**',
- projectName: BUILD_JOB,
- selector: [
- $class: 'ParameterizedBuildSelector',
- parameterName: BUILD_JOB_SELECTOR
- ],
- target: BUILD_ARTIFACTS
- )
- def mfs = autobuilderscript.getmetafolderscript()
- buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS)
+ importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
+
+ BUILD_ARTIFACTS = 'build'
+
+ def importoptions = importer.getNewImportOptions()
+ importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR)
+ importoptions.setincrementversionnumber(false)
+ importoptions.setfilter('meta/**')
+ importoptions.setappendtoparentmeta(false)
+ buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS)
}
}
}
@@ -44,7 +42,7 @@ pipeline {
def releaser = load("${autobuilder.commonscripts()}/release/do.groovy")
// Place the top level build stamp on all
OTHER_RELEASE_TAGS = "${buildmeta.globalreleasetag()},${OTHER_RELEASE_TAGS}"
- (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH)
+ (summarystring, markunstable, unstablereason) = releaser.releasehierarchy('', BUILD_ARTIFACTS, buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH)
if (markunstable) {
env.unstablereason = unstablereason
currentBuild.result = 'UNSTABLE'
@@ -56,7 +54,8 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts()
- archiveArtifacts "summary/**,${artifactlist}"
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive("summary/**,${artifactlist}")
}
}
}
diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy
index 5a77cab..c04649c 100644
--- a/staticanalysis/cpd.groovy
+++ b/staticanalysis/cpd.groovy
@@ -129,7 +129,8 @@ pipeline {
script {
ArrayList itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease)
- archiveArtifacts artifactlist
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy
index 9455b0b..d959770 100644
--- a/staticanalysis/cppcheck.groovy
+++ b/staticanalysis/cppcheck.groovy
@@ -91,7 +91,8 @@ pipeline {
script {
ArrayList itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease)
- archiveArtifacts artifactlist
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy
index 92d6414..5e2ce53 100644
--- a/test/testethernetproduct.groovy
+++ b/test/testethernetproduct.groovy
@@ -192,7 +192,8 @@ pipeline {
steps{
script {
def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"])
- archiveArtifacts artifactlist
+ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
+ artifactarchiver.archive(meta, artifactlist)
}
}
}
diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy
index 6e0db11..5e974e2 100644
--- a/versionnumbering/generate.groovy
+++ b/versionnumbering/generate.groovy
@@ -98,6 +98,9 @@ def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) {
def integerstrings = sourcebranch.findAll(/\d+/)
def integers = []
for (integerstring in integerstrings) {
+ if (integerstring.length() > 6) {
+ integerstring = integerstring.substring(0, 5)
+ }
int integer = integerstring.toInteger()
integer = integer % (maxversionnumber() + 1)
integers.add(integer)
@@ -154,6 +157,13 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum
return buildstamp
}
+String pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) {
+ generate(meta, sourcerevision, sourcepath, basebuildnumber)
+ meta.buildstampinfo.override(pregeneratedbuildstamp)
+
+ return pregeneratedbuildstamp
+}
+
String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) {
def int bbn = basebuildnumber.trim().toInteger()
return generate(meta, sourcerevision, sourcepath, bbn)