Merge commit '73f4794d6bbe777cbe4d46ae0f52befe46c73249' into production

This commit is contained in:
Dan Hawkins 2021-12-21 11:37:01 +00:00
commit 14adb0183f
11 changed files with 228 additions and 197 deletions

View file

@ -6,7 +6,7 @@ enum Store {
this.JENKINS = Store.JENKINS
this.ARTIFACTSERVER = Store.JENKINS
def archive(meta, artifactlist, Store store = JENKINS ) {
def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) {
echo "Archiving artifacts to store: ${store}"
meta.copyrelatedmeta()
if (store == JENKINS) {

View file

@ -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"
}

View file

@ -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,25 +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: artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
// This does not work: artifactarchiver.archive(artifacts: includes, excludes: excludes)
// so
cleanfolders = [
IMPORTS,
'autobuild',
]
cleaner.clean(cleanfolders)
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifacts: includes)
cleaner.clean([IMPORTS])
artifactarchiver.archive(meta, artifactlist)
}
}
}
@ -85,4 +76,4 @@ pipeline {
echo 'Succeeded build'
}
}
}
}

View file

@ -13,7 +13,7 @@ pipeline {
stage('Clean exports') {
steps {
script {
env.LOGICDEST = "${WORKSPACE}/logic"
LOGICDEST = 'logic'
cleanfolders = [
LOGICDEST,
"${WORKSPACE}/embedded_logic",
@ -24,12 +24,16 @@ pipeline {
}
}
}
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)
}
}
@ -37,14 +41,22 @@ 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"/* .
"""
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
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)
}
}
@ -64,4 +76,4 @@ pipeline {
echo 'Succeeded build'
}
}
}
}

View file

@ -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: ")

View file

@ -342,14 +342,15 @@ def artifactimport(meta,
}
// Import the artifacts of a named child component found below parent meta's hierarchy
def artifactimport(meta, parentmeta, String childproduct, String childsubcomponent, importoptions, String destinationfolder) {
def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, String childsubcomponent, importoptions, String destinationfolder) {
// Import from parent meta
def childmeta = meta.getNewMetaObject()
def childmeta2
echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}"
def findresults = parentmeta.findAssociatedMeta(childproduct, 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.matchedmeta
childmeta = findresults.matchedmetaitem.metainfo
if (childmeta.releaseinfo.released) {
importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag())
} else {

View file

@ -595,28 +595,23 @@ class MetaInfo extends GISJsonSerialised {
interface IRelatedMetaInfo {
abstract void deserialiseJson(rawmeta)
abstract LinkedHashMap serialisationdata()
abstract String format()
}
abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo {
private String format
String format
RelatedMetaInfo(script, format) {
super(script)
this.format = format
}
abstract void deserialiseJson(rawmeta)
abstract LinkedHashMap serialisationdata()
String format() {
return format
}
}
class RelatedMetaInfo_v0_1 extends RelatedMetaInfo {
String offsetpath
MetaInfo meta
private MetaInfo meta
private String offsetpath
RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) {
super(script, '0.1')
@ -830,16 +825,15 @@ class MetaInfo extends GISJsonSerialised {
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)
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_v0_2(script, importedmetafile, adjustedpath)
if (appendtoparentmeta) {
associatedmeta.add(rmi)
}
return mi
}
@ -877,10 +871,10 @@ class MetaInfo extends GISJsonSerialised {
return METAFOLDERNAME
}
String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here
ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // These items are not recorded in meta as released from here
String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
) {
def String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here
ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // 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) {
@ -893,31 +887,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<RelatedMetaInfo> releasewalkerp(int maxdepth, ArrayList<RelatedMetaInfo> releasemetacollection, String pathsofar) {
if (maxdepth > 0) {
if (releaseinfo.releaserepoURL) {
RelatedMetaInfo rmi = new RelatedMetaInfo_v0_1(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<RelatedMetaInfo> releasewalker(int maxdepth, String startpath = "") {
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
return releasemetacollection
}
String componentidentifier() {
return productinfo.productname + "_" + productinfo.subcomponentname
@ -939,54 +908,24 @@ class MetaInfo extends GISJsonSerialised {
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
}
Map<String, RelatedMetaInfo> putwithshortestoffsetpath(Map<String, RelatedMetaInfo> releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) {
if (releasemetacollection.containsKey(uniquestring)) {
def existingentry = releasemetacollection[uniquestring]
if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) {
releasemetacollection.put(uniquestring, relatedmetainfo)
}
} else {
releasemetacollection.put(uniquestring, 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
}
return releasemetacollection
}
Map<String, RelatedMetaInfo> releasewalkerunique(int maxdepth, String startpath = "") {
def ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
def Map<String, RelatedMetaInfo> releasemetauniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
for (relatedmetainfo in releasemetacollection) {
def String uniquestring = relatedmetainfo.meta.componentidentifier()
releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo)
}
return releasemetauniquecollection
}
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") {
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
for (relatedmetainfo in releasemetacollection) {
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier()
releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo)
}
return releasemetaversionuniquecollection
}
def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) {
def openchildmeta(String gatheredpath, String gatheredmetapath, RelatedMetaInfo relatedmetainfo) {
def MetaInfo mi = new MetaInfo(script)
def String nextpath
if (gatheredpath == '') {
nextpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}"
} else {
nextpath = "${gatheredpath}/${relatedmetainfo.offsetpath}"
}
def importedmetafile = "${nextpath}/${METAFILENAME}"
def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${gatheredmetapath}/${relatedmetainfo.offsetpath}")
def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}"
def boolean imported
if (script.fileExists(importedmetafile)) {
mi.deserialiseJson(importedmetafile)
@ -998,71 +937,156 @@ class MetaInfo extends GISJsonSerialised {
def childmetainfo = [
'imported': imported,
'nextpath': nextpath,
'nextgatheredpath': nextgatheredpath,
'nextgatheredmetapath': nextgatheredmetapath,
'childmeta': mi
]
return childmetainfo
}
def walkrelated_v0_1(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
def walkrelated_v0_1(ArrayList<CollectedMeta> metacollection,
String comment = '',
int level = 0,
String gatheredpath = '',
String gatheredmetapath = '',
boolean limiteddepth = false,
int maxdepth = 0) {
script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}")
def results = [
'metacollection' : metacollection,
'comment': comment
]
results.metacollection.add(this)
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1)
} else {
script.error("There is non v0.1 format related meta info under v0.1 related meta info")
if (!limiteddepth || maxdepth > 0) {
results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath))
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${gatheredmetapath}/${relatedmetainfo.offsetpath}")
results = othermeta.walkrelated_v0_1(results.metacollection,
results.comment,
level + 1,
nextgatheredpath,
nextgatheredmetapath,
limiteddepth,
maxdepth - 1)
} else {
script.error("There is non v0.1 format related meta info under v0.1 related meta info")
}
}
}
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
}
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0, String gatheredpath = '') {
def walkrelated(ArrayList<CollectedMeta> metacollection,
String comment = '',
int level = 0,
String gatheredpath = '',
String gatheredmetapath = '',
boolean limiteddepth = false,
int maxdepth = 0) {
script.echo("walkrelated Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}")
def results = [
'metacollection' : metacollection,
'comment': comment
]
results.metacollection.add(this)
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
if (relatedmetainfo.format == '0.2') {
def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo)
if (childmetainfo.imported) {
results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath)
if (!limiteddepth || maxdepth > 0) {
results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath))
results.comment += "${level} ".padRight(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(gatheredpath, gatheredmetapath, relatedmetainfo)
if (childmetainfo.imported) {
results = childmetainfo.childmeta.walkrelated(results.metacollection,
results.comment,
level + 1,
childmetainfo.nextgatheredpath,
childmetainfo.nextgatheredmetapath,
limiteddepth,
maxdepth - 1)
}
} else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
results = othermeta.walkrelated_v0_1(results.metacollection,
results.comment,
level + 1,
gatheredpath,
gatheredmetapath,
limiteddepth,
maxdepth - 1)
}
} else if (relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1)
}
}
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
}
def allrelatedmeta() {
ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>()
return walkrelated(metacollection)
def allrelatedmeta(String metapath = '') {
ArrayList<CollectedMeta> metacollection = new ArrayList<CollectedMeta>()
return walkrelated(metacollection, '', 0, '', metapath)
}
ArrayList<CollectedMeta> releasewalker(int maxdepth, String startpath = '', String startmetapath = '') {
def ArrayList<CollectedMeta> metacollection = new ArrayList<CollectedMeta>()
def results = walkrelated(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth)
return results.metacollection
}
Map<String, CollectedMeta> putwithshortestoffsetpath(Map<String, CollectedMeta> releasemetacollection, String uniquestring, CollectedMeta metaitem) {
if (releasemetacollection.containsKey(uniquestring)) {
def existingentry = releasemetacollection[uniquestring]
def existingentrypathlength = existingentry.accumulatedpath.split('/').size()
def newentrypathlength = metaitem.accumulatedpath.split('/').size()
if (existingentrypathlength > newentrypathlength) {
releasemetacollection.put(uniquestring, metaitem)
}
} else {
releasemetacollection.put(uniquestring, metaitem)
}
return releasemetacollection
}
Map<String, CollectedMeta> releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') {
def ArrayList<CollectedMeta> metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
def Map<String, CollectedMeta> versionuniquecollection = new LinkedHashMap<String, CollectedMeta>()
for (metaitem in metacollection) {
def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier()
versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem)
}
return versionuniquecollection
}
Map<String, MetaInfo> releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') {
def ArrayList<CollectedMeta> metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
def Map<String, CollectedMeta> uniquecollection = new LinkedHashMap<String, CollectedMeta>()
for (metaitem in metacollection) {
def String uniquestring = metaitem.metainfo.componentidentifier()
uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem)
}
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
}

View file

@ -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}: ")

View file

@ -89,7 +89,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 +97,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}")

View file

@ -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: "<SpecificBuildSelector plugin='copyartifact@1.41'><buildNumber>${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}</buildNumber></SpecificBuildSelector>"
parameterName: "<SpecificBuildSelector plugin='copyartifact@1.46.2'><buildNumber>${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}</buildNumber></SpecificBuildSelector>"
],
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)"
}
}

View file

@ -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'