Merge commit '8470480c48645f659ec2753f002fc26adb6e07f2'
This commit is contained in:
commit
fb4e313a39
20 changed files with 449 additions and 244 deletions
|
|
@ -6,9 +6,11 @@ enum Store {
|
|||
this.JENKINS = Store.JENKINS
|
||||
this.ARTIFACTSERVER = Store.JENKINS
|
||||
|
||||
def archive(artifactlist, Store store = JENKINS ) {
|
||||
def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) {
|
||||
echo "Archiving artifacts to store: ${store}"
|
||||
meta.copyrelatedmeta()
|
||||
if (store == JENKINS) {
|
||||
archiveArtifacts(artifactlist)
|
||||
archiveArtifacts(artifacts: artifactlist)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,12 @@ def combineSubjobArtifacts(meta, importer, subJobs) {
|
|||
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}/**")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +45,7 @@ pipeline {
|
|||
mv -v "${ESW}"/* .
|
||||
"""
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(artifactlist)
|
||||
artifactarchiver.archive(meta, artifactlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +51,7 @@ pipeline {
|
|||
script {
|
||||
def artifactlist = meta.generateartifacts(["filtered/**"])
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(artifactlist)
|
||||
artifactarchiver.archive(meta, artifactlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,22 +13,25 @@ pipeline {
|
|||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
env.LOGICDEST = "${WORKSPACE}/logic"
|
||||
LOGICDEST = 'logic'
|
||||
cleanfolders = [
|
||||
LOGICDEST,
|
||||
"${WORKSPACE}/embedded_logic",
|
||||
]
|
||||
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,15 +39,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"/* .
|
||||
"""
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,4 +74,4 @@ pipeline {
|
|||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: ")
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@ 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
|
||||
|
||||
ProductInfo(script, productname = "", subcomponentname = "", variant = "") {
|
||||
super(script)
|
||||
this.format = '0.1'
|
||||
this.productname = productname
|
||||
this.subcomponentname = subcomponentname
|
||||
this.variant = variant
|
||||
|
|
@ -77,6 +79,7 @@ class ProductInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
productname = rawmeta['productname']
|
||||
subcomponentname = rawmeta['subcomponentname']
|
||||
variant = rawmeta['variant'] ?: ""
|
||||
|
|
@ -84,6 +87,7 @@ class ProductInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'productname' : productname,
|
||||
'subcomponentname' : subcomponentname,
|
||||
'variant' : variant,
|
||||
|
|
@ -93,6 +97,7 @@ class ProductInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
class GitInfo extends GISJsonSerialised {
|
||||
private String format
|
||||
private String sourcepath
|
||||
private String sourcerevision
|
||||
private String gitrevision
|
||||
|
|
@ -101,6 +106,7 @@ class GitInfo extends GISJsonSerialised {
|
|||
|
||||
GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") {
|
||||
super(script)
|
||||
this.format = '0.1'
|
||||
this.sourcepath = sourcepath
|
||||
this.sourcerevision = sourcerevision
|
||||
this.gitrevision = gitrevision
|
||||
|
|
@ -134,6 +140,7 @@ class GitInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
sourcepath = rawmeta['sourcepath']
|
||||
sourcerevision = rawmeta['sourcerevision']
|
||||
gitrevision = rawmeta['gitrevision']
|
||||
|
|
@ -143,6 +150,7 @@ class GitInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'sourcepath' : sourcepath,
|
||||
'sourcerevision' : sourcerevision,
|
||||
'gitrevision' : gitrevision,
|
||||
|
|
@ -188,15 +196,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<JenkinsBuildParameter> parameters
|
||||
boolean isfullbuild
|
||||
private ArrayList<JenkinsBuildParameter> parameters
|
||||
private boolean isfullbuild
|
||||
|
||||
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 +238,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
buildjobname = rawmeta['buildjobname']
|
||||
buildnumber = rawmeta['buildnumber']
|
||||
buildmachine = rawmeta['buildmachine']
|
||||
|
|
@ -253,6 +264,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'buildjobname' : buildjobname,
|
||||
'buildnumber' : buildnumber,
|
||||
'buildmachine' : buildmachine,
|
||||
|
|
@ -265,12 +277,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
|
||||
|
|
@ -333,6 +347,7 @@ class BuildStampInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
buildstampprefix = rawmeta['buildstampprefix']
|
||||
revision = rawmeta['revision']
|
||||
buildstamp = rawmeta['buildstamp']
|
||||
|
|
@ -340,6 +355,7 @@ class BuildStampInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'buildstampprefix' : buildstampprefix,
|
||||
'revision' : revision,
|
||||
'buildstamp' : buildstamp,
|
||||
|
|
@ -349,12 +365,14 @@ class BuildStampInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
class ReleaseInfo extends GISJsonSerialised {
|
||||
String releaserepoURL
|
||||
ArrayList<String> releaseitems
|
||||
boolean released
|
||||
private String format
|
||||
private String releaserepoURL
|
||||
private ArrayList<String> releaseitems
|
||||
private boolean released
|
||||
|
||||
ReleaseInfo(script, String releaserepoURL = "", boolean released = false) {
|
||||
super(script)
|
||||
this.format = '0.1'
|
||||
this.releaserepoURL = releaserepoURL
|
||||
this.releaseitems = new ArrayList<String>()
|
||||
this.released = released
|
||||
|
|
@ -382,6 +400,7 @@ class ReleaseInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
releaserepoURL = rawmeta['releaserepoURL']
|
||||
releaseitems = new ArrayList<String>()
|
||||
for (rawreleaseitem in rawmeta['releaseitems']) {
|
||||
|
|
@ -392,6 +411,7 @@ class ReleaseInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'releaserepoURL' : releaserepoURL,
|
||||
'releaseitems' : releaseitemssserialised(),
|
||||
'released' : released
|
||||
|
|
@ -457,11 +477,13 @@ class ChecksumPair extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
class ChecksumSet extends GISJsonSerialised {
|
||||
private String format
|
||||
private String artifactpath
|
||||
private ArrayList<ChecksumPair> checksumpairs
|
||||
|
||||
ChecksumSet(script, artifactpath = "") {
|
||||
super(script)
|
||||
this.format = '0.1'
|
||||
this.artifactpath = artifactpath
|
||||
checksumpairs = new ArrayList<ChecksumPair>()
|
||||
}
|
||||
|
|
@ -481,6 +503,7 @@ class ChecksumSet extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
artifactpath = rawmeta['artifactpath']
|
||||
checksumpairs = new ArrayList<ChecksumPair>()
|
||||
for (rawchecksumpair in rawmeta['checksumpairs']) {
|
||||
|
|
@ -492,6 +515,7 @@ class ChecksumSet extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'artifactpath' : artifactpath,
|
||||
'checksumpairs' : checksumpairsserialised(),
|
||||
]
|
||||
|
|
@ -539,19 +563,23 @@ class ChecksumInfo extends GISJsonSerialised {
|
|||
}
|
||||
|
||||
class PublishableInfo extends GISJsonSerialised {
|
||||
private String format
|
||||
private 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
|
||||
|
|
@ -559,17 +587,34 @@ 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) {
|
||||
interface IRelatedMetaInfo {
|
||||
abstract void deserialiseJson(rawmeta)
|
||||
abstract LinkedHashMap serialisationdata()
|
||||
}
|
||||
|
||||
abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo {
|
||||
String format
|
||||
|
||||
RelatedMetaInfo(script, format) {
|
||||
super(script)
|
||||
this.format = format
|
||||
}
|
||||
|
||||
abstract void deserialiseJson(rawmeta)
|
||||
abstract LinkedHashMap serialisationdata()
|
||||
}
|
||||
|
||||
class RelatedMetaInfo_v0_1 extends RelatedMetaInfo {
|
||||
private MetaInfo meta
|
||||
private String offsetpath
|
||||
|
||||
RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) {
|
||||
super(script, '0.1')
|
||||
this.offsetpath = offsetpath
|
||||
this.meta = meta
|
||||
}
|
||||
|
|
@ -582,6 +627,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'offsetpath' : offsetpath,
|
||||
'meta' : meta.serialisationdata(),
|
||||
]
|
||||
|
|
@ -589,13 +635,36 @@ class MetaInfo extends GISJsonSerialised {
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") {
|
||||
super(script, '0.2')
|
||||
this.importpath = importpath
|
||||
this.offsetpath = offsetpath
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
//format = rawmeta['format']
|
||||
offsetpath = rawmeta['offsetpath']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'offsetpath' : offsetpath,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
private ProductInfo productinfo
|
||||
private GitInfo gitinfo
|
||||
private JenkinsBuildInfo jenkinsbuildinfo
|
||||
private BuildStampInfo buildstampinfo
|
||||
private ReleaseInfo releaseinfo
|
||||
private ChecksumInfo checksuminfo
|
||||
private ArrayList<ConfigurationInfo> configurationinfo
|
||||
private ArrayList<PublishableInfo> publishableinfo
|
||||
private LinkedHashMap<String, String> custominfo
|
||||
|
|
@ -677,8 +746,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'])
|
||||
|
|
@ -699,9 +768,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -748,19 +823,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)
|
||||
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 = [
|
||||
|
|
@ -783,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) {
|
||||
|
|
@ -799,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(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
|
||||
|
|
@ -845,78 +908,185 @@ 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)
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
def openchildmeta(String gatheredpath, String gatheredmetapath, RelatedMetaInfo relatedmetainfo) {
|
||||
def MetaInfo mi = new MetaInfo(script)
|
||||
|
||||
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)
|
||||
imported = true
|
||||
} else {
|
||||
releasemetacollection.put(uniquestring, relatedmetainfo)
|
||||
}
|
||||
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)
|
||||
script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist")
|
||||
imported = false
|
||||
}
|
||||
|
||||
return releasemetauniquecollection
|
||||
def childmetainfo = [
|
||||
'imported': imported,
|
||||
'nextgatheredpath': nextgatheredpath,
|
||||
'nextgatheredmetapath': nextgatheredmetapath,
|
||||
'childmeta': mi
|
||||
]
|
||||
return childmetainfo
|
||||
}
|
||||
|
||||
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 walkrelated(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) {
|
||||
MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated(results.metacollection, results.comment, level + 1)
|
||||
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<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
|
||||
]
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
@ -926,9 +1096,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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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}: ")
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ pipeline {
|
|||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(artifactlist)
|
||||
artifactarchiver.archive(meta, artifactlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ pipeline {
|
|||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(artifactlist)
|
||||
artifactarchiver.archive(meta, artifactlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ pipeline {
|
|||
script {
|
||||
def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"])
|
||||
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
|
||||
artifactarchiver.archive(artifactlist)
|
||||
artifactarchiver.archive(meta, artifactlist)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue