Merge commit '8470480c48645f659ec2753f002fc26adb6e07f2'

This commit is contained in:
Dan Hawkins 2021-12-21 14:57:17 +00:00
commit fb4e313a39
20 changed files with 449 additions and 244 deletions

View file

@ -6,9 +6,11 @@ enum Store {
this.JENKINS = Store.JENKINS this.JENKINS = Store.JENKINS
this.ARTIFACTSERVER = 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) { if (store == JENKINS) {
archiveArtifacts(artifactlist) archiveArtifacts(artifacts: artifactlist)
} }
} }

View file

@ -11,7 +11,12 @@ def combineSubjobArtifacts(meta, importer, subJobs) {
dir(destFolder) { dir(destFolder) {
deleteDir() 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}/**") artifactFolders.add("${destFolder}/**")
} }
} }

View file

@ -52,8 +52,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) {
echo "All components:" echo "All components:"
def String componentinfo = "" def String componentinfo = ""
for (entry in buildinfo) { for (entry in buildinfo) {
def name = entry.meta.componentversionuniqueidentifier() def name = entry.metainfo.componentversionuniqueidentifier()
def offsetpath = entry.offsetpath def offsetpath = entry.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}" def abspath = "${buildpathroot}/${offsetpath}"
componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n" 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 = "" def String versioncomponent = ""
for (key in componentReleaseInfo.keySet()) { for (key in componentReleaseInfo.keySet()) {
def buildinfo2 = componentReleaseInfo[key] def buildinfo2 = componentReleaseInfo[key]
def offsetpath = buildinfo2.offsetpath def offsetpath = buildinfo2.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}" def abspath = "${buildpathroot}/${offsetpath}"
versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n"
} }

View file

@ -5,6 +5,8 @@ pipeline {
steps { steps {
script { script {
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) 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') { stage('Import source artifacts') {
steps { steps {
script { script {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
def copyoptions = importer.getNewImportOptions() def copyoptions = importer.getNewImportOptions()
copyoptions.source( copyoptions.source(
SOURCE_ARTIFACT_LOCATION, SOURCE_ARTIFACT_LOCATION,
@ -37,9 +38,14 @@ pipeline {
} }
} }
} }
stage('Copy source artifacts') { stage('Archiving artifacts') {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts(['**/*'])
def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
cleaner.clean(['meta', 'autobuild'])
dir(IMPORTS) { dir(IMPORTS) {
fileOperations([ fileOperations([
fileCopyOperation(excludes: '', fileCopyOperation(excludes: '',
@ -48,25 +54,10 @@ pipeline {
targetLocation: WORKSPACE) targetLocation: WORKSPACE)
]) ])
} }
}
} cleaner.clean([IMPORTS])
}
stage('Archiving artifacts') { artifactarchiver.archive(meta, artifactlist)
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)
} }
} }
} }

View file

@ -28,7 +28,10 @@ pipeline {
stage('Copying embedded software artifacts') { stage('Copying embedded software artifacts') {
steps { steps {
script { 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}"/* . mv -v "${ESW}"/* .
""" """
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifactlist) artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -27,7 +27,9 @@ pipeline {
stage('Import artifacts') { stage('Import artifacts') {
steps { steps {
script { 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 { script {
def artifactlist = meta.generateartifacts(["filtered/**"]) def artifactlist = meta.generateartifacts(["filtered/**"])
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifactlist) artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -13,22 +13,25 @@ pipeline {
stage('Clean exports') { stage('Clean exports') {
steps { steps {
script { script {
env.LOGICDEST = "${WORKSPACE}/logic" LOGICDEST = 'logic'
cleanfolders = [ cleanfolders = [
LOGICDEST, LOGICDEST,
"${WORKSPACE}/embedded_logic",
] ]
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
cleaner.clean(cleanfolders) cleaner.clean(cleanfolders)
} }
} }
} }
stage('Copying logic artifacts') { stage('Import source artifacts') {
steps { steps {
script { script {
sh('env')
def logicoptions = importer.getNewImportOptions() 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) importer.artifactimport(meta, logicoptions, LOGICDEST)
} }
} }
@ -36,15 +39,23 @@ pipeline {
stage('Archiving artifacts') { stage('Archiving artifacts') {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts(["embedded_logic/**"]) def artifactlist = meta.generateartifacts(['**/*'])
sh """ def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
rm -v -rf meta
# The following is removing a deprecated folder cleaner.clean(['meta', 'autobuild'])
rm -v -rf diff
mv -v "logic"/* . dir(LOGICDEST) {
""" fileOperations([
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") fileCopyOperation(excludes: '',
artifactarchiver.archive(artifactlist) flattenFiles: false,
includes: '**/*',
targetLocation: WORKSPACE)
])
}
cleaner.clean([LOGICDEST])
artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -95,8 +95,8 @@ def showmetaitems(metaitems) {
String info = '' String info = ''
for (key in metaitems.keySet()) { for (key in metaitems.keySet()) {
def relatedmetainfo = metaitems[key] def relatedmetainfo = metaitems[key]
def offsetpath = relatedmetainfo.offsetpath def accumulatedpath = relatedmetainfo.accumulatedpath
info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n" info += "Name: ${key}\t\t\t\tPath: ${accumulatedpath}\n"
} }
echo info echo info
} }
@ -768,8 +768,8 @@ def compare(earlymetaitems, latermetaitems, key) {
boolean result = true; boolean result = true;
echo "Collecting changes between early and later versions of component: ${key}" echo "Collecting changes between early and later versions of component: ${key}"
def earlymeta = earlymetaitems[key].meta def earlymeta = earlymetaitems[key].metainfo
def latermeta = latermetaitems[key].meta def latermeta = latermetaitems[key].metainfo
summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ")

View file

@ -37,8 +37,18 @@ pipeline {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy") importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim() 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)
} }
} }
} }

View file

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

View file

@ -20,12 +20,14 @@ abstract class GISJsonSerialised implements Serializable {
} }
class ProductInfo extends GISJsonSerialised { class ProductInfo extends GISJsonSerialised {
String productname private String format
String subcomponentname private String productname
String variant private String subcomponentname
private String variant
ProductInfo(script, productname = "", subcomponentname = "", variant = "") { ProductInfo(script, productname = "", subcomponentname = "", variant = "") {
super(script) super(script)
this.format = '0.1'
this.productname = productname this.productname = productname
this.subcomponentname = subcomponentname this.subcomponentname = subcomponentname
this.variant = variant this.variant = variant
@ -77,6 +79,7 @@ class ProductInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
productname = rawmeta['productname'] productname = rawmeta['productname']
subcomponentname = rawmeta['subcomponentname'] subcomponentname = rawmeta['subcomponentname']
variant = rawmeta['variant'] ?: "" variant = rawmeta['variant'] ?: ""
@ -84,6 +87,7 @@ class ProductInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'productname' : productname, 'productname' : productname,
'subcomponentname' : subcomponentname, 'subcomponentname' : subcomponentname,
'variant' : variant, 'variant' : variant,
@ -93,6 +97,7 @@ class ProductInfo extends GISJsonSerialised {
} }
class GitInfo extends GISJsonSerialised { class GitInfo extends GISJsonSerialised {
private String format
private String sourcepath private String sourcepath
private String sourcerevision private String sourcerevision
private String gitrevision private String gitrevision
@ -101,6 +106,7 @@ class GitInfo extends GISJsonSerialised {
GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") {
super(script) super(script)
this.format = '0.1'
this.sourcepath = sourcepath this.sourcepath = sourcepath
this.sourcerevision = sourcerevision this.sourcerevision = sourcerevision
this.gitrevision = gitrevision this.gitrevision = gitrevision
@ -134,6 +140,7 @@ class GitInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
sourcepath = rawmeta['sourcepath'] sourcepath = rawmeta['sourcepath']
sourcerevision = rawmeta['sourcerevision'] sourcerevision = rawmeta['sourcerevision']
gitrevision = rawmeta['gitrevision'] gitrevision = rawmeta['gitrevision']
@ -143,6 +150,7 @@ class GitInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'sourcepath' : sourcepath, 'sourcepath' : sourcepath,
'sourcerevision' : sourcerevision, 'sourcerevision' : sourcerevision,
'gitrevision' : gitrevision, 'gitrevision' : gitrevision,
@ -188,15 +196,17 @@ class JenkinsBuildParameter extends GISJsonSerialised {
} }
class JenkinsBuildInfo extends GISJsonSerialised { class JenkinsBuildInfo extends GISJsonSerialised {
String buildjobname private String format
int buildnumber private String buildjobname
private int buildnumber
private String buildmachine private String buildmachine
private String builddate private String builddate
ArrayList<JenkinsBuildParameter> parameters private ArrayList<JenkinsBuildParameter> parameters
boolean isfullbuild 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) super(script)
this.format = '0.1'
this.buildjobname = buildjobname this.buildjobname = buildjobname
this.buildnumber = buildnumber this.buildnumber = buildnumber
this.buildmachine = buildmachine this.buildmachine = buildmachine
@ -228,6 +238,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
buildjobname = rawmeta['buildjobname'] buildjobname = rawmeta['buildjobname']
buildnumber = rawmeta['buildnumber'] buildnumber = rawmeta['buildnumber']
buildmachine = rawmeta['buildmachine'] buildmachine = rawmeta['buildmachine']
@ -253,6 +264,7 @@ class JenkinsBuildInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'buildjobname' : buildjobname, 'buildjobname' : buildjobname,
'buildnumber' : buildnumber, 'buildnumber' : buildnumber,
'buildmachine' : buildmachine, 'buildmachine' : buildmachine,
@ -265,12 +277,14 @@ class JenkinsBuildInfo extends GISJsonSerialised {
} }
class BuildStampInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised {
String buildstampprefix private String format
int revision private String buildstampprefix
String buildstamp private int revision
private String buildstamp
BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") {
super(script) super(script)
this.format = '0.1'
this.buildstampprefix = buildstampprefix this.buildstampprefix = buildstampprefix
this.revision = revision this.revision = revision
this.buildstamp = buildstamp this.buildstamp = buildstamp
@ -333,6 +347,7 @@ class BuildStampInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
buildstampprefix = rawmeta['buildstampprefix'] buildstampprefix = rawmeta['buildstampprefix']
revision = rawmeta['revision'] revision = rawmeta['revision']
buildstamp = rawmeta['buildstamp'] buildstamp = rawmeta['buildstamp']
@ -340,6 +355,7 @@ class BuildStampInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'buildstampprefix' : buildstampprefix, 'buildstampprefix' : buildstampprefix,
'revision' : revision, 'revision' : revision,
'buildstamp' : buildstamp, 'buildstamp' : buildstamp,
@ -349,12 +365,14 @@ class BuildStampInfo extends GISJsonSerialised {
} }
class ReleaseInfo extends GISJsonSerialised { class ReleaseInfo extends GISJsonSerialised {
String releaserepoURL private String format
ArrayList<String> releaseitems private String releaserepoURL
boolean released private ArrayList<String> releaseitems
private boolean released
ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { ReleaseInfo(script, String releaserepoURL = "", boolean released = false) {
super(script) super(script)
this.format = '0.1'
this.releaserepoURL = releaserepoURL this.releaserepoURL = releaserepoURL
this.releaseitems = new ArrayList<String>() this.releaseitems = new ArrayList<String>()
this.released = released this.released = released
@ -382,6 +400,7 @@ class ReleaseInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
releaserepoURL = rawmeta['releaserepoURL'] releaserepoURL = rawmeta['releaserepoURL']
releaseitems = new ArrayList<String>() releaseitems = new ArrayList<String>()
for (rawreleaseitem in rawmeta['releaseitems']) { for (rawreleaseitem in rawmeta['releaseitems']) {
@ -392,6 +411,7 @@ class ReleaseInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'releaserepoURL' : releaserepoURL, 'releaserepoURL' : releaserepoURL,
'releaseitems' : releaseitemssserialised(), 'releaseitems' : releaseitemssserialised(),
'released' : released 'released' : released
@ -457,11 +477,13 @@ class ChecksumPair extends GISJsonSerialised {
} }
class ChecksumSet extends GISJsonSerialised { class ChecksumSet extends GISJsonSerialised {
private String format
private String artifactpath private String artifactpath
private ArrayList<ChecksumPair> checksumpairs private ArrayList<ChecksumPair> checksumpairs
ChecksumSet(script, artifactpath = "") { ChecksumSet(script, artifactpath = "") {
super(script) super(script)
this.format = '0.1'
this.artifactpath = artifactpath this.artifactpath = artifactpath
checksumpairs = new ArrayList<ChecksumPair>() checksumpairs = new ArrayList<ChecksumPair>()
} }
@ -481,6 +503,7 @@ class ChecksumSet extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
artifactpath = rawmeta['artifactpath'] artifactpath = rawmeta['artifactpath']
checksumpairs = new ArrayList<ChecksumPair>() checksumpairs = new ArrayList<ChecksumPair>()
for (rawchecksumpair in rawmeta['checksumpairs']) { for (rawchecksumpair in rawmeta['checksumpairs']) {
@ -492,6 +515,7 @@ class ChecksumSet extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'artifactpath' : artifactpath, 'artifactpath' : artifactpath,
'checksumpairs' : checksumpairsserialised(), 'checksumpairs' : checksumpairsserialised(),
] ]
@ -539,19 +563,23 @@ class ChecksumInfo extends GISJsonSerialised {
} }
class PublishableInfo extends GISJsonSerialised { class PublishableInfo extends GISJsonSerialised {
private String format
private String filepath private String filepath
PublishableInfo(script, String filepath = "") { PublishableInfo(script, String filepath = "") {
super(script) super(script)
this.format = '0.1'
this.filepath = filepath this.filepath = filepath
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
//format = rawmeta['format']
filepath = rawmeta['filepath'] filepath = rawmeta['filepath']
} }
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'filepath' : filepath, 'filepath' : filepath,
] ]
return data return data
@ -559,17 +587,34 @@ class PublishableInfo extends GISJsonSerialised {
} }
class MetaInfo extends GISJsonSerialised { class MetaInfo extends GISJsonSerialised {
private static String FORMAT = "0.1" private static String METAFOLDERNAME = 'meta'
private static String METAFOLDERNAME = "meta" private static String METAFILENAME = 'info.json'
private static String METAFILENAME = "info.json"
private static String METAARTIFACTS = "${METAFOLDERNAME}/**" private static String METAARTIFACTS = "${METAFOLDERNAME}/**"
private static String format = '0.2'
class RelatedMetaInfo extends GISJsonSerialised { interface IRelatedMetaInfo {
String offsetpath abstract void deserialiseJson(rawmeta)
MetaInfo meta abstract LinkedHashMap serialisationdata()
}
RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo {
String format
RelatedMetaInfo(script, format) {
super(script) 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.offsetpath = offsetpath
this.meta = meta this.meta = meta
} }
@ -582,6 +627,7 @@ class MetaInfo extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'offsetpath' : offsetpath, 'offsetpath' : offsetpath,
'meta' : meta.serialisationdata(), 'meta' : meta.serialisationdata(),
] ]
@ -589,13 +635,36 @@ class MetaInfo extends GISJsonSerialised {
} }
} }
private String format = FORMAT class RelatedMetaInfo_v0_2 extends RelatedMetaInfo {
ProductInfo productinfo private String importpath
GitInfo gitinfo private String offsetpath
JenkinsBuildInfo jenkinsbuildinfo
BuildStampInfo buildstampinfo RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") {
ReleaseInfo releaseinfo super(script, '0.2')
ChecksumInfo checksuminfo 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<ConfigurationInfo> configurationinfo
private ArrayList<PublishableInfo> publishableinfo private ArrayList<PublishableInfo> publishableinfo
private LinkedHashMap<String, String> custominfo private LinkedHashMap<String, String> custominfo
@ -677,8 +746,8 @@ class MetaInfo extends GISJsonSerialised {
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
if (rawmeta['format'] != FORMAT) { if (rawmeta['format'].toString() != '0.1' && rawmeta['format'].toString() != '0.2' ) {
script.error("Unsupported meta format found at ${filepath}") script.error("Unsupported meta format found")
return return
} }
productinfo.deserialiseJson(rawmeta['productinfo']) productinfo.deserialiseJson(rawmeta['productinfo'])
@ -699,9 +768,15 @@ class MetaInfo extends GISJsonSerialised {
} }
custominfo = rawmeta['custominfo'] custominfo = rawmeta['custominfo']
for (rawrelatedmeta in rawmeta['associatedmeta']) { for (rawrelatedmeta in rawmeta['associatedmeta']) {
def rm = new RelatedMetaInfo(script) if (!rawrelatedmeta['format'] || rawrelatedmeta['format'] == '0.1') {
rm.deserialiseJson(rawrelatedmeta) def rm = new RelatedMetaInfo_v0_1(script)
associatedmeta.add(rm) 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,20 +823,33 @@ class MetaInfo extends GISJsonSerialised {
def String adjustedpath = relativize(destpath) def String adjustedpath = relativize(destpath)
def importedmetafile = adjustedpath + "/" + metafilepath() def importedmetafile = adjustedpath + "/" + metafilepath()
if (script.fileExists(importedmetafile)) { if (script.fileExists(importedmetafile)) {
script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})")
mi.deserialiseJson(importedmetafile) mi.deserialiseJson(importedmetafile)
RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath)
if (appendtoparentmeta) {
associatedmeta.add(rmi)
}
} else { } else {
script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") 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 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() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format, 'format' : format,
@ -783,10 +871,10 @@ class MetaInfo extends GISJsonSerialised {
return METAFOLDERNAME return METAFOLDERNAME
} }
String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here 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 ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // These items are not recorded in meta as released from here
String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
) { ) {
def String artifactlist = METAARTIFACTS def String artifactlist = METAARTIFACTS
releaseinfo.addReleaseItem(METAARTIFACTS) releaseinfo.addReleaseItem(METAARTIFACTS)
for (releaseitem in releasedfromhere) { for (releaseitem in releasedfromhere) {
@ -800,31 +888,6 @@ class MetaInfo extends GISJsonSerialised {
return artifactlist 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() { String componentidentifier() {
return productinfo.productname + "_" + productinfo.subcomponentname return productinfo.productname + "_" + productinfo.subcomponentname
} }
@ -845,78 +908,185 @@ class MetaInfo extends GISJsonSerialised {
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
} }
Map<String, RelatedMetaInfo> putwithshortestoffsetpath(Map<String, RelatedMetaInfo> releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { class CollectedMeta {
if (releasemetacollection.containsKey(uniquestring)) { private MetaInfo metainfo
def existingentry = releasemetacollection[uniquestring] private String accumulatedpath
if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { private String accumulatedmetapath
releasemetacollection.put(uniquestring, relatedmetainfo)
} 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 { } else {
releasemetacollection.put(uniquestring, relatedmetainfo) script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist")
} imported = false
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 def childmetainfo = [
'imported': imported,
'nextgatheredpath': nextgatheredpath,
'nextgatheredmetapath': nextgatheredmetapath,
'childmeta': mi
]
return childmetainfo
} }
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") { def walkrelated_v0_1(ArrayList<CollectedMeta> metacollection,
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>() String comment = '',
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) int level = 0,
String gatheredpath = '',
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>() String gatheredmetapath = '',
for (relatedmetainfo in releasemetacollection) { boolean limiteddepth = false,
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() int maxdepth = 0) {
releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}")
}
return releasemetaversionuniquecollection
}
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
def results = [ def results = [
'metacollection' : metacollection, 'metacollection' : metacollection,
'comment': comment 'comment': comment
] ]
results.metacollection.add(this) if (!limiteddepth || maxdepth > 0) {
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath))
for (relatedmetainfo in associatedmeta) { results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
MetaInfo othermeta = relatedmetainfo.meta for (relatedmetainfo in associatedmeta) {
results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) 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 ] return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
} }
def allrelatedmeta() { def walkrelated(ArrayList<CollectedMeta> metacollection,
ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>() String comment = '',
return walkrelated(metacollection) 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(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) { MetaInfo getNewMetaObject(script) {
return new MetaInfo(script) return new MetaInfo(script)
} }
def findAssociatedMeta(String productname, String subcomponentname) { def findAssociatedMeta(String parentmetapath, String productname, String subcomponentname) {
def results = [ def results = [
'matchedmeta' : getNewMetaObject(this), 'matchedmetaitem' : new CollectedMeta(this),
'matchfound' : false 'matchfound' : false
] ]
def walkresults = allrelatedmeta() def walkresults = allrelatedmeta("${parentmetapath}/${METAFOLDERNAME}")
for (dependentmeta in walkresults.metacollection) { for (dependentmetaitem in walkresults.metacollection) {
if (dependentmeta.productinfo.productname == productname && script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}")
dependentmeta.productinfo.subcomponentname == subcomponentname) { if (dependentmetaitem.metainfo.productinfo.productname == productname &&
script.echo("Found matching component: ${dependentmeta.globalreleasetag()}") dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) {
results.matchedmeta = dependentmeta script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}")
results.matchedmetaitem = dependentmetaitem
results.matchfound = true results.matchfound = true
break break
} }
@ -926,9 +1096,9 @@ class MetaInfo extends GISJsonSerialised {
} }
MetaInfo metareset(script) { MetaInfo metareset(script) {
echo "Resetting meta folder"
def mi = new MetaInfo(script) def mi = new MetaInfo(script)
echo "Resetting meta folder"
dir(mi.folder()) { dir(mi.folder()) {
deleteDir() deleteDir()
} }

View file

@ -64,45 +64,47 @@ def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, S
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix)
} }
def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String credentials_id) {
try { withCredentials([usernamePassword(credentialsId: credentials_id,
sh """#!/bin/bash usernameVariable: 'SUDO_USERNAME',
# Exit if any command fails passwordVariable: 'SUDO_PASSWORD')]) {
set -xe 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}" mkdir -v -p "${uniquepackageout}"
echo "Building package:" cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
mkdir -v -p "${uniquepackageout}" echo "Showing package:"
cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
echo "Showing package contents:"
dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
echo "Showing package:" echo "Showing package lintian output:"
dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true
echo "Showing package contents:"
dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
echo "Showing package lintian output:" ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}"
lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true """
}
catch (Exception e) {
echo "Exception occurred"
sh """#!/bin/bash -v
${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}"
sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1
""" """
} }
catch (Exception e) {
echo "Exception occurred"
sh """#!/bin/bash -v
echo "${password}" | sudo -S echo
sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
exit 1
"""
} }
} }

View file

@ -60,7 +60,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) {
summaryappend("Artifacts: ") summaryappend("Artifacts: ")
def releasemeta = releaseinfo.meta def releasemeta = releaseinfo.metainfo
def String componentURL = releasemeta.releaseinfo.releaserepoURL def String componentURL = releasemeta.releaseinfo.releaserepoURL
def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}"
def publishableitems = releasemeta.publishableinfo def publishableitems = releasemeta.publishableinfo
@ -113,7 +113,7 @@ def copydirectory(File dirFrom, File dirTo) {
} }
def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) {
def releasemeta = releaseinfo.meta def releasemeta = releaseinfo.metainfo
def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta)
summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ")

View file

@ -48,7 +48,12 @@ pipeline {
steps { steps {
script { script {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy") 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" PACKAGE_FOLDER = "${PACKAGEDEST}/package"
UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage" UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage"
} }

View file

@ -89,7 +89,7 @@ class PublishableItemsSelection {
} }
def outputDescription(menuitems, releaseinfo) { def outputDescription(menuitems, releaseinfo) {
def meta = releaseinfo.meta def meta = releaseinfo.metainfo
for (publishableitem in meta.publishableinfo) { for (publishableitem in meta.publishableinfo) {
menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}")
@ -97,7 +97,7 @@ class PublishableItemsSelection {
} }
def outputSelection(menuitems, releaseinfo) { def outputSelection(menuitems, releaseinfo) {
def meta = releaseinfo.meta def meta = releaseinfo.metainfo
for (publishableitem in meta.publishableinfo) { for (publishableitem in meta.publishableinfo) {
menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") 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 // Copy relevant artifacts to temp folder
summaryappend("Artifacts: ") summaryappend("Artifacts: ")
def boolean result = true def boolean result = true
for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { for (artifactfilter in buildinfo.metainfo.releaseinfo.releaseitems) {
def filterpath = artifactfilter def filterpath = artifactfilter
if (buildinfo.offsetpath) { if (buildinfo.accumulatedpath) {
filterpath = buildinfo.offsetpath + '/' + artifactfilter filterpath = buildinfo.accumulatedpath + '/' + artifactfilter
} }
// Copy relevant artifacts to temp folder // 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 { try {
copyArtifacts( copyArtifacts(
filter: filterpath, filter: filterpath,
projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname,
selector: [ selector: [
$class: 'ParameterizedBuildSelector', $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 target: tempfolder
) )
@ -136,9 +136,9 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde
} }
if (result) { if (result) {
// Move relevant artifacts from temp folder to release position // Move relevant artifacts from temp folder to release position
def originalrootdir = tempfolder + "/" + buildinfo.offsetpath def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath
dir(originalrootdir) { dir(originalrootdir) {
sh("mv * ${repofolder}") sh("mv -v * ${repofolder}")
} }
} }
summaryappend("${artifactfilter},") summaryappend("${artifactfilter},")
@ -375,7 +375,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
} }
def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) {
def buildmeta = buildinfo.meta def buildmeta = buildinfo.metainfo
def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl) def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl)
def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}" def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}"
def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}"
@ -396,13 +396,13 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri
repoandtagsappend("\n") 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() def int md = maxdepth.toInteger()
resetfolders() resetfolders()
preconditions() preconditions()
// Walk the meta information to a max depth, looking for components to release // 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:" echo "Unique components:"
def String versioncomponent = "" def String versioncomponent = ""
for (key in componentReleaseInfo.keySet()) { for (key in componentReleaseInfo.keySet()) {
@ -411,14 +411,19 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
echo versioncomponent echo versioncomponent
// Walk the meta information to a max depth, looking for components to release // Walk the meta information to a max depth, looking for components to release
def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md) def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder, metafolder)
echo "Version unique components:" def String versionuniquecomponent = ''
def String versionuniquecomponent = "" def String versionwithpathscomponent = ''
for (key in componentReleaseInfoVersionUnique.keySet()) { for (key in componentReleaseInfoVersionUnique.keySet()) {
versionuniquecomponent += "${key}\n" versionuniquecomponent += "${key}\n"
versionwithpathscomponent += "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n"
} }
echo 'Version unique components:'
echo versionuniquecomponent echo versionuniquecomponent
echo 'Version unique components with paths:'
echo versionwithpathscomponent
if (DO_INTEGRITY_CHECK == "true") { if (DO_INTEGRITY_CHECK == "true") {
if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { 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)" 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()) { for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key] 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)" 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') { stage('Get build artifact meta') {
steps { steps {
script { script {
BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
copyArtifacts(
filter: 'meta/**', BUILD_ARTIFACTS = 'build'
projectName: BUILD_JOB,
selector: [ def importoptions = importer.getNewImportOptions()
$class: 'ParameterizedBuildSelector', importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR)
parameterName: BUILD_JOB_SELECTOR importoptions.setincrementversionnumber(false)
], importoptions.setfilter('meta/**')
target: BUILD_ARTIFACTS importoptions.setappendtoparentmeta(false)
) buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS)
def mfs = autobuilderscript.getmetafolderscript()
buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS)
} }
} }
} }
@ -44,7 +42,7 @@ pipeline {
def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") def releaser = load("${autobuilder.commonscripts()}/release/do.groovy")
// Place the top level build stamp on all // Place the top level build stamp on all
OTHER_RELEASE_TAGS = "${buildmeta.globalreleasetag()},${OTHER_RELEASE_TAGS}" 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) { if (markunstable) {
env.unstablereason = unstablereason env.unstablereason = unstablereason
currentBuild.result = 'UNSTABLE' currentBuild.result = 'UNSTABLE'

View file

@ -130,7 +130,7 @@ pipeline {
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"] ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease) def artifactlist = meta.generateartifacts(itemsForRelease)
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifactlist) artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -92,7 +92,7 @@ pipeline {
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"] ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease) def artifactlist = meta.generateartifacts(itemsForRelease)
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifactlist) artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -193,7 +193,7 @@ pipeline {
script { script {
def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"])
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(artifactlist) artifactarchiver.archive(meta, artifactlist)
} }
} }
} }