Merge remote-tracking branch 'origin/master' into CORE-348

This commit is contained in:
Dan Hawkins 2022-01-27 11:21:00 +00:00
commit 3db76ce63b
27 changed files with 731 additions and 321 deletions

17
artifacts/archiver.groovy Normal file
View file

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

View file

@ -4,14 +4,19 @@ def combineSubjobArtifacts(meta, importer, subJobs) {
for (subJob in subJobs) { for (subJob in subJobs) {
def subJobObject = subJob[0] def subJobObject = subJob[0]
if (subJobObject != null) { if (subJobObject != null) {
def subJobName = subJobObject.getProjectName() def subJobName = subJobObject.getFullProjectName()
def subJobNumber = subJobObject.getNumber() def subJobNumber = subJobObject.getNumber()
def destFolder = subJob[1] def destFolder = subJob[1]
def boolean incrementversionnumber = subJob[2] def boolean incrementversionnumber = subJob[2]
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

@ -85,26 +85,15 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam
return jobname return jobname
} }
def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) { def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) {
def jobname = getActionJobName(postbuildactions, action, alternativeparamname) def jobname = getActionJobName(postbuildactions, action, alternativeparamname)
if (jobname) { if (jobname) {
build( build(
wait: false, wait: false,
job: jobname, job: jobname,
parameters: [ parameters: [
// For most jobs string(name: jobnameparametername, value: JOB_NAME),
string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), string(name: jobselectorparametername, value: buildselector),
string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector),
// For doxygen jobs
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME),
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector),
// For diff jobs
string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'),
string(name: 'LATER_BUILD_JOB', value: JOB_NAME),
string(name: 'LATER_BUILD_SELECTOR', value: buildselector),
// For regression jobs
string(name: 'BUILD_JOB', value: JOB_NAME),
string(name: 'BUILD_JOB_SELECTOR', value: buildselector),
] ]
) )
} }
@ -130,12 +119,12 @@ def performSuccessfulBuildActions() {
} }
} }
def String buildselector = "<SpecificBuildSelector plugin='copyartifact@1.46.2'><buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>" def String buildselector = "<SpecificBuildSelector plugin='copyartifact@1.46.2'><buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"
deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB') deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR')
deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB') deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' )
deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB') deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB') deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB') deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR')
deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB') deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR')
} }
def sendemails(emailinfo) { def sendemails(emailinfo) {

View file

@ -53,7 +53,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts() def artifactlist = meta.generateartifacts()
archiveArtifacts "summary/**,${artifactlist}" artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,${artifactlist}")
} }
} }
} }

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

@ -1,7 +1,7 @@
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) return meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
} }
def registerPipelineScriptConfiguration(meta) { def registerPipelineScriptConfiguration(meta) {
@ -12,7 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter) def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) return registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
} }
return this return this

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,23 +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: archiveArtifacts artifacts: includes, excludes: excludes
// so
cleanfolders = [
IMPORTS,
'autobuild',
]
cleaner.clean(cleanfolders)
archiveArtifacts 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)
} }
} }
} }
@ -41,7 +44,8 @@ pipeline {
rm -v -rf meta rm -v -rf meta
mv -v "${ESW}"/* . mv -v "${ESW}"/* .
""" """
archiveArtifacts artifactlist artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
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)
} }
} }
} }
@ -48,7 +50,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts(["filtered/**"]) def artifactlist = meta.generateartifacts(["filtered/**"])
archiveArtifacts artifactlist artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive(meta, artifactlist)
} }
} }
} }

View file

@ -13,22 +13,27 @@ pipeline {
stage('Clean exports') { stage('Clean exports') {
steps { steps {
script { script {
env.LOGICDEST = "${WORKSPACE}/logic" LOGICDEST = 'logic'
cleanfolders = [ cleanfolders = [
LOGICDEST, LOGICDEST,
"${WORKSPACE}/embedded_logic", "${WORKSPACE}/embedded_logic",
"${WORKSPACE}/el",
] ]
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,14 +41,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([
archiveArtifacts artifactlist fileCopyOperation(excludes: '',
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: ")
@ -803,8 +803,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin
def earlymeta = meta.importrelated(true, earlymetafolder) def earlymeta = meta.importrelated(true, earlymetafolder)
def latermeta = meta.importrelated(true, latermetafolder) def latermeta = meta.importrelated(true, latermetafolder)
def earlymetaitems = earlymeta.releasewalkerunique(md) def earlymetaitems = earlymeta.releasewalkerunique(md, '', earlymetafolder)
def latermetaitems = latermeta.releasewalkerunique(md) def latermetaitems = latermeta.releasewalkerunique(md, '', latermetafolder)
echo "Early items:" echo "Early items:"
showmetaitems(earlymetaitems) showmetaitems(earlymetaitems)

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)
} }
} }
} }
@ -58,7 +68,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts() def artifactlist = meta.generateartifacts()
archiveArtifacts "summary/**,reports/**,${artifactlist}" artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,reports/**,${artifactlist}")
} }
} }
} }

View file

@ -21,6 +21,8 @@ class ImportOptions {
String m_repo String m_repo
String m_revision String m_revision
boolean m_showdetails
ImportOptions(script, ImportOptions(script,
String sourceselect = 'Jenkins job artifact', String sourceselect = 'Jenkins job artifact',
boolean incrementversionnumber = true, boolean incrementversionnumber = true,
@ -31,7 +33,8 @@ class ImportOptions {
boolean flatten = false, boolean flatten = false,
boolean includemetainfilter = true, boolean includemetainfilter = true,
boolean clean = true, boolean clean = true,
appendtoparentmeta = true) { appendtoparentmeta = true,
showdetails = false) {
m_script = script m_script = script
m_sourceselect = sourceselect.trim() m_sourceselect = sourceselect.trim()
m_incrementversionnumber = incrementversionnumber m_incrementversionnumber = incrementversionnumber
@ -43,6 +46,25 @@ class ImportOptions {
m_includemetainfilter = includemetainfilter m_includemetainfilter = includemetainfilter
m_clean = clean m_clean = clean
m_appendtoparentmeta = appendtoparentmeta m_appendtoparentmeta = appendtoparentmeta
m_showdetails = showdetails
}
String show() {
return """m_incrementversionnumber: ${m_incrementversionnumber}
m_filter: ${m_filter}
m_excludes: ${m_excludes}
m_fingerprint: ${m_fingerprint}
m_nested: ${m_nested}
m_flatten: ${m_flatten}
m_includemetainfilter: ${m_includemetainfilter}
m_clean: ${m_clean}
m_appendtoparentmeta: ${m_appendtoparentmeta}
m_sourceselect: ${m_sourceselect}
m_jobname: ${m_jobname}
m_buildnumberorselector: ${m_buildnumberorselector}
m_repo: ${m_repo}
m_revision: ${m_revision}
"""
} }
void setsourceselect(String sourceselect) { void setsourceselect(String sourceselect) {
@ -56,7 +78,7 @@ class ImportOptions {
m_sourceselect = sourceselect m_sourceselect = sourceselect
break break
default: default:
error("Unknown type of artifact source select: ${m_sourceselect}") m_script.error("Unknown type of artifact source select: ${sourceselect}")
} }
} }
@ -96,7 +118,7 @@ class ImportOptions {
m_appendtoparentmeta = appendtoparentmeta m_appendtoparentmeta = appendtoparentmeta
} }
void jenkinsjob(String jobname, buildnumberorselector) { void jenkinsjob(String jobname, String buildnumberorselector) {
m_jobname = jobname.trim() m_jobname = jobname.trim()
m_buildnumberorselector = [ m_buildnumberorselector = [
$class: 'ParameterizedBuildSelector', $class: 'ParameterizedBuildSelector',
@ -109,7 +131,7 @@ class ImportOptions {
m_jobname = jobname.trim() m_jobname = jobname.trim()
m_buildnumberorselector = [ m_buildnumberorselector = [
$class: 'ParameterizedBuildSelector', $class: 'ParameterizedBuildSelector',
parameterName: "<SpecificBuildSelector plugin='copyartifact@1.41'><buildNumber>${buildnumberorselector}</buildNumber></SpecificBuildSelector>" parameterName: "<SpecificBuildSelector plugin='copyartifact@1.46.2'><buildNumber>${buildnumberorselector}</buildNumber></SpecificBuildSelector>"
] ]
setsourceselect('Jenkins job artifact') setsourceselect('Jenkins job artifact')
} }
@ -125,6 +147,10 @@ class ImportOptions {
releaserepo(repo, revision) releaserepo(repo, revision)
setsourceselect(sourceselect) setsourceselect(sourceselect)
} }
void showdetails(boolean showdetails) {
m_showdetails = showdetails
}
} }
ImportOptions getNewImportOptions() { ImportOptions getNewImportOptions() {
@ -151,7 +177,7 @@ def conditionalClean(ImportOptions importoptions, String destpath) {
} }
} }
def artifactimportfrombuildjob(meta, importoptions, String destpath) { def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Jenkins job artifact') { if (importoptions.m_sourceselect != 'Jenkins job artifact') {
error("Import options settings have not been set for: Jenkins job artifact") error("Import options settings have not been set for: Jenkins job artifact")
return return
@ -183,7 +209,7 @@ def rewritemetafileasreleased(meta, String filepath) {
meta.saveJsonSerialised(filepath) meta.saveJsonSerialised(filepath)
} }
def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Release repository') { if (importoptions.m_sourceselect != 'Release repository') {
error("Import options settings have not been set for: Release repository") error("Import options settings have not been set for: Release repository")
return return
@ -200,23 +226,31 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
relatedimportinfo = importedmeta.getassociated() echo "Getting associated metadata from path: ${destpath}"
echo "Cloning associated repos" def collectedmetalist = importedmeta.getassociated(destpath)
for(relatedmetainfo in relatedimportinfo) { for(def collectedmeta in collectedmetalist) {
def relatedmeta = relatedmetainfo.meta echo "Collection meta item: ${collectedmeta.metainfo.componentversionuniqueidentifier()} offset path: ${collectedmeta.accumulatedpath}"
def relatedoffsetpath = relatedmetainfo.offsetpath }
echo "Cloning associated repos inside path: ${destpath}"
for(def collectedmeta in collectedmetalist) {
def relatedmeta = collectedmeta.metainfo
def relatedoffsetpath = collectedmeta.accumulatedpath
def cloneurl = relatedmeta.releaseinfo.releaserepoURL def cloneurl = relatedmeta.releaseinfo.releaserepoURL
def clonerevision = "refs/tags/${relatedmeta.releasetag()}" def clonerevision = "refs/tags/${relatedmeta.releasetag()}"
def clonepath = "${destpath}/${relatedoffsetpath}" def clonepath = "${destpath}/${relatedoffsetpath}"
echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" if (relatedmeta.componentidentifier() != '___' &&
relatedmeta.componentidentifier() != '_' &&
gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, []) cloneurl != '') {
echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}"
gh.stripgithistory(clonepath) gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, [])
gh.stripgithistory(clonepath)
def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}" def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}"
echo "Marking related meta as released and rewriting meta file: ${metafilepath}" echo "Marking related meta as released and rewriting meta file: ${metafilepath}"
rewritemetafileasreleased(relatedmeta, metafilepath) rewritemetafileasreleased(relatedmeta, metafilepath)
} else {
echo "Not importing component that would be placed at path: ${clonepath}"
}
} }
gh.stripgithistory(destpath) gh.stripgithistory(destpath)
def metafilepath = "${destpath}/${meta.metafilepath()}" def metafilepath = "${destpath}/${meta.metafilepath()}"
@ -229,7 +263,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
return importedmeta return importedmeta
} }
def artifactimportfromrepo(meta, importoptions, String destpath) { def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_sourceselect != 'Release repository') { if (importoptions.m_sourceselect != 'Release repository') {
error("Import options settings have not been set for: Release repository") error("Import options settings have not been set for: Release repository")
return return
@ -257,7 +291,10 @@ def artifactimportfromrepo(meta, importoptions, String destpath) {
return importedmeta return importedmeta
} }
def artifactimport(meta, importoptions, String destpath) { def artifactimport(meta, ImportOptions importoptions, String destpath) {
if (importoptions.m_showdetails) {
echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}"
}
switch (importoptions.m_sourceselect) { switch (importoptions.m_sourceselect) {
case 'Jenkins job artifact': case 'Jenkins job artifact':
case 'Jenkins job artefact': case 'Jenkins job artefact':
@ -341,4 +378,32 @@ def artifactimport(meta,
return artifactimport(meta, importoptions, destpath) return artifactimport(meta, importoptions, destpath)
} }
// Import the artifacts of a named child component found below parent meta's hierarchy
def artifactimport(meta,
parentmeta,
String parentmetapath,
String childproduct,
String childsubcomponent,
ImportOptions importoptions,
String destinationfolder) {
// Import from parent meta
def childmeta = meta.getNewMetaObject()
def childmeta2
echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}"
echo "From parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}"
def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent)
if (findresults.matchfound) {
childmeta = findresults.matchedmetaitem.metainfo
if (importoptions.m_sourceselect == 'Release repository' || childmeta.releaseinfo.released) {
importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag())
} else {
importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber)
}
childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder)
} else {
error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}")
}
return childmeta2
}
return this; return this;

View file

@ -23,17 +23,32 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin
} }
// Given details about artifacts to import and details of installers to build, import artifacts that are required // Given details about artifacts to import and details of installers to build, import artifacts that are required
def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { def Map artifactsImporter(meta, importer, toBuild, artifactDetails, installerDetails, boolean showdetails = false) {
artifactFetched = [:] artifactFetched = [:]
if (showdetails) {
echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}")
}
def importoptions = importer.getNewImportOptions() def importoptions = importer.getNewImportOptions()
importoptions.showdetails(showdetails)
for (installer in toBuild) { for (installer in toBuild) {
def artifactKeys = installerDetails.get(installer)[1] def installerinfo = installerDetails.get(installer)
if (showdetails) {
echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}")
}
def artifactKeys = installerinfo[1]
if (artifactKeys instanceof java.lang.String) { if (artifactKeys instanceof java.lang.String) {
artifactKeys = [ artifactKeys ] artifactKeys = [ artifactKeys ]
} }
if (showdetails) {
echo ("artifactKeys:\n${artifactKeys}")
}
for (artifactKey in artifactKeys) { for (artifactKey in artifactKeys) {
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) artifactDetail = artifactDetails.get(artifactKey)
if (showdetails) {
echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}")
}
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail
if (artifactFetched.get(artifactKey) == null) { if (artifactFetched.get(artifactKey) == null) {
importoptions.jenkinsjob(sourceProject, sourceselector) importoptions.jenkinsjob(sourceProject, sourceselector)
importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setincrementversionnumber(incrementversionnumber)
@ -45,6 +60,9 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) {
} }
} }
} }
if (showdetails) {
echo ("artifactFetched:\n${artifactFetched}")
}
return artifactFetched return artifactFetched
} }
@ -93,6 +111,7 @@ def checkISMfilebackend(String xml) {
def checkISMfile(String ISMfile) { def checkISMfile(String ISMfile) {
echo "Checking ISM file: ${ISMfile}" echo "Checking ISM file: ${ISMfile}"
def xml = readFile(ISMfile) def xml = readFile(ISMfile)
//echo "ISM file xml: ${xml}"
(exitcode, message) = checkISMfilebackend(xml) (exitcode, message) = checkISMfilebackend(xml)
echo message echo message
if (exitcode > 0) { if (exitcode > 0) {

View file

@ -20,15 +20,19 @@ 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
private String uniqueid
ProductInfo(script, productname = "", subcomponentname = "", variant = "") { ProductInfo(script, String productname = '', String subcomponentname = '', String 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
this.uniqueid = UUID.randomUUID().toString()
} }
void set(String productname, String subcomponentname, String variant = '') { void set(String productname, String subcomponentname, String variant = '') {
@ -74,33 +78,40 @@ class ProductInfo extends GISJsonSerialised {
this.productname = otherinfo.productname this.productname = otherinfo.productname
this.subcomponentname = otherinfo.subcomponentname this.subcomponentname = otherinfo.subcomponentname
this.variant = otherinfo.variant this.variant = otherinfo.variant
this.uniqueid = otherinfo.uniqueid
} }
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'] ?: ''
uniqueid = rawmeta['uniqueid'] ?: uniqueid
} }
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'productname' : productname, 'productname' : productname,
'subcomponentname' : subcomponentname, 'subcomponentname' : subcomponentname,
'variant' : variant, 'variant' : variant,
'uniqueid': uniqueid,
] ]
return data return data
} }
} }
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
private String remoteurl private String remoteurl
private String remoteinfo private String remoteinfo
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 +145,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 +155,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 +201,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 +243,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 +269,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 +282,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
@ -293,6 +312,20 @@ class BuildStampInfo extends GISJsonSerialised {
set(other.buildstampprefix, other.revision, other.buildstamp) set(other.buildstampprefix, other.revision, other.buildstamp)
} }
// Override the buildstamp
void override(String buildstamp) {
this.buildstamp = buildstamp
script.echo("Build stamp overridden to: ${this.buildstamp}")
def s = this.buildstamp.split('\\.')
if (s.size() != 4) {
script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4")
}
this.buildstampprefix = "${s[0]}.${s[1]}.${s[2]}"
script.echo("Stamp prefix overridden to: ${this.buildstampprefix}")
this.revision = s[3].toInteger()
script.echo("Revision overridden to: ${this.revision}")
}
String buildstampcommasep() { String buildstampcommasep() {
def String buildstampcommasep = buildstamp.replace(".", ",") def String buildstampcommasep = buildstamp.replace(".", ",")
return buildstampcommasep return buildstampcommasep
@ -319,6 +352,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']
@ -326,6 +360,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,
@ -335,18 +370,20 @@ 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
} }
void set(String releaserepoURL = "") { void set(String releaserepoURL = '') {
this.releaserepoURL = releaserepoURL this.releaserepoURL = releaserepoURL
} }
@ -368,6 +405,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']) {
@ -378,6 +416,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
@ -392,7 +431,7 @@ class ConfigurationInfo extends GISJsonSerialised {
private String configurationversion private String configurationversion
private String configurationSHA private String configurationSHA
ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { ConfigurationInfo(script, configurationname = '', configurationURL = '', configurationversion = '', configurationSHA = '') {
super(script) super(script)
this.configurationname = configurationname this.configurationname = configurationname
this.configurationURL = configurationURL this.configurationURL = configurationURL
@ -422,7 +461,7 @@ class ChecksumPair extends GISJsonSerialised {
private String filepath private String filepath
private String sum private String sum
ChecksumPair(script, String filepath = "", String sum = "") { ChecksumPair(script, String filepath = '', String sum = '') {
super(script) super(script)
this.filepath = filepath this.filepath = filepath
this.sum = sum this.sum = sum
@ -443,11 +482,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>()
} }
@ -467,6 +508,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']) {
@ -478,6 +520,7 @@ class ChecksumSet extends GISJsonSerialised {
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'artifactpath' : artifactpath, 'artifactpath' : artifactpath,
'checksumpairs' : checksumpairsserialised(), 'checksumpairs' : checksumpairsserialised(),
] ]
@ -525,19 +568,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
@ -545,43 +592,105 @@ 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 { abstract class RelatedMetaInfo extends GISJsonSerialised {
String offsetpath String format
MetaInfo meta
RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { RelatedMetaInfo(script, format) {
super(script) super(script)
this.format = format
}
abstract void deserialiseJson(rawmeta)
abstract LinkedHashMap serialisationdata()
abstract String getrelatedid()
abstract void markreleased()
}
class RelatedMetaInfo_v0_1 extends RelatedMetaInfo {
private MetaInfo meta
private String offsetpath
private String uniqueid
RelatedMetaInfo_v0_1(script, String offsetpath = '', MetaInfo meta = null, String uniqueid = UUID.randomUUID().toString()) {
super(script, '0.1')
this.offsetpath = offsetpath this.offsetpath = offsetpath
this.uniqueid = uniqueid
this.meta = meta this.meta = meta
} }
void deserialiseJson(rawmeta) { void deserialiseJson(rawmeta) {
offsetpath = rawmeta['offsetpath'] offsetpath = rawmeta['offsetpath']
uniqueid = rawmeta['uniqueid'] ?: uniqueid
meta = new MetaInfo(script) meta = new MetaInfo(script)
meta.deserialiseJson(rawmeta['meta']) meta.deserialiseJson(rawmeta['meta'])
} }
LinkedHashMap serialisationdata() { LinkedHashMap serialisationdata() {
def data = [ def data = [
'format' : format,
'offsetpath' : offsetpath, 'offsetpath' : offsetpath,
'uniqueid' : uniqueid,
'meta' : meta.serialisationdata(), 'meta' : meta.serialisationdata(),
] ]
return data return data
} }
String getrelatedid() {
return uniqueid
}
void markreleased() {
meta.releaseinfo.markreleased()
}
} }
private String format = FORMAT class RelatedMetaInfo_v0_2 extends RelatedMetaInfo {
ProductInfo productinfo private String importpath
GitInfo gitinfo private String offsetpath
JenkinsBuildInfo jenkinsbuildinfo private String uniqueid
BuildStampInfo buildstampinfo
ReleaseInfo releaseinfo RelatedMetaInfo_v0_2(script, String importpath = '', String offsetpath = '', String uniqueid = UUID.randomUUID().toString()) {
ChecksumInfo checksuminfo super(script, '0.2')
this.importpath = importpath
this.offsetpath = offsetpath
this.uniqueid = uniqueid
}
void deserialiseJson(rawmeta) {
//format = rawmeta['format']
offsetpath = rawmeta['offsetpath']
uniqueid = rawmeta['uniqueid']
}
LinkedHashMap serialisationdata() {
def data = [
'format' : format,
'offsetpath' : offsetpath,
'uniqueid' : uniqueid
]
return data
}
String getrelatedid() {
return uniqueid
}
void markreleased() {
// Do nothing
}
}
private ProductInfo productinfo
private GitInfo gitinfo
private JenkinsBuildInfo jenkinsbuildinfo
private BuildStampInfo buildstampinfo
private ReleaseInfo releaseinfo
private ChecksumInfo checksuminfo
private ArrayList<ConfigurationInfo> configurationinfo private ArrayList<ConfigurationInfo> configurationinfo
private ArrayList<PublishableInfo> publishableinfo private ArrayList<PublishableInfo> publishableinfo
private LinkedHashMap<String, String> custominfo private LinkedHashMap<String, String> custominfo
@ -601,15 +710,11 @@ class MetaInfo extends GISJsonSerialised {
associatedmeta = new ArrayList<RelatedMetaInfo>() associatedmeta = new ArrayList<RelatedMetaInfo>()
} }
List getassociated() {
return associatedmeta
}
void markreleased() { void markreleased() {
script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released")
releaseinfo.markreleased() releaseinfo.markreleased()
for (associated in associatedmeta) { for (associated in associatedmeta) {
associated.meta.releaseinfo.markreleased() associated.markreleased()
} }
} }
@ -631,6 +736,7 @@ class MetaInfo extends GISJsonSerialised {
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}") script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
configurationinfo.add(ci) configurationinfo.add(ci)
return ci
} }
void addCustomInfo(String customId, String customValue) { void addCustomInfo(String customId, String customValue) {
@ -662,8 +768,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'])
@ -684,9 +790,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)
}
} }
} }
@ -733,20 +845,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, mi.productinfo.uniqueid)
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,
@ -768,10 +893,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) {
@ -785,31 +910,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
} }
@ -830,78 +930,235 @@ 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 {
private MetaInfo metainfo
private String accumulatedpath
private String accumulatedmetapath
CollectedMeta(MetaInfo metainfo, String accumulatedpath = '', String accumulatedmetapath = '') {
this.metainfo = metainfo
this.accumulatedpath = accumulatedpath
this.accumulatedmetapath = accumulatedmetapath
}
}
class IterationInfo {
private ArrayList<CollectedMeta> metacollection
private Map<String, CollectedMeta> metamap
private String comment
private int level
private String gatheredpath
private String gatheredmetapath
private boolean limiteddepth
private int maxdepth
IterationInfo(ArrayList<CollectedMeta> metacollection,
Map<String, CollectedMeta> metamap,
String comment = '',
int level = 0,
String gatheredpath = '',
String gatheredmetapath = '',
boolean limiteddepth = false,
int maxdepth = 0) {
this.metacollection = metacollection
this.metamap = metamap
this.comment = comment
this.level = level
this.gatheredpath = gatheredpath
this.gatheredmetapath = gatheredmetapath
this.limiteddepth = limiteddepth
this.maxdepth = maxdepth
}
String show() {
return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}"
}
void add(CollectedMeta item) {
metacollection.add(item)
metamap.put(item.metainfo.productinfo.uniqueid, item)
}
}
def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) {
def MetaInfo mi = new MetaInfo(script)
def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}"
def boolean imported
// If this has already been read in from a file
if (relatedmetainfo.getrelatedid() in ii.metamap) {
//script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it")
mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo
imported = true
} else if (script.fileExists(importedmetafile)) {
mi.deserialiseJson(importedmetafile)
imported = true
} else {
script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist")
imported = false
}
def childmetainfo = [
'imported': imported,
'nextgatheredpath': nextgatheredpath,
'nextgatheredmetapath': nextgatheredmetapath,
'childmeta': mi
]
return childmetainfo
}
def walkrelated_v0_1(IterationInfo ii) {
//script.echo("Walk related v0.1: ${ii.show()}")
if (!ii.limiteddepth || ii.maxdepth > 0) {
ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath))
ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
nextgatheredpath,
nextgatheredmetapath,
ii.limiteddepth,
ii.maxdepth - 1)
def results = othermeta.walkrelated_v0_1(nextii)
ii.metacollection = results.metacollection
ii.metamap = results.metamap
ii.comment = results.comment
} else {
script.error("There is non v0.1 format related meta info under v0.1 related meta info")
}
}
}
return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ]
}
def walkrelated(IterationInfo ii) {
//script.echo("Walk related: ${ii.show()}")
if (!ii.limiteddepth || ii.maxdepth > 0) {
ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath))
ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
//script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}")
if (relatedmetainfo.format == '0.2') {
def childmetainfo = openchildmeta(ii, relatedmetainfo)
if (childmetainfo.imported) {
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
childmetainfo.nextgatheredpath,
childmetainfo.nextgatheredmetapath,
ii.limiteddepth,
ii.maxdepth - 1)
def results = childmetainfo.childmeta.walkrelated(nextii)
ii.metacollection = results.metacollection
ii.metamap = results.metamap
ii.comment = results.comment
}
} else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
nextgatheredpath,
nextgatheredmetapath,
ii.limiteddepth,
ii.maxdepth - 1)
def results = othermeta.walkrelated_v0_1(nextii)
ii.metacollection = results.metacollection
ii.metamap = results.metamap
ii.comment = results.comment
}
}
}
return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ]
}
// Walks all layers of associated data only
def allrelatedmeta(String metapath = '') {
def ArrayList<CollectedMeta> metacollection = new ArrayList<CollectedMeta>()
def Map<String, CollectedMeta> metamap = new LinkedHashMap<String, CollectedMeta>()
return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath))
}
ArrayList<CollectedMeta> releasewalker(int maxdepth, String startpath = '', String startmetapath = '') {
def ArrayList<CollectedMeta> metacollection = new ArrayList<CollectedMeta>()
def Map<String, CollectedMeta> metamap = new LinkedHashMap<String, CollectedMeta>()
def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth)
script.echo("Release walker iteration info at start:\n${ii.show()}")
def results = walkrelated(ii)
return results.metacollection
}
// Walks 1 layer of associated data only
def getassociated(String rootpath) {
return releasewalker(2, '', "${rootpath}/${METAFOLDERNAME}") // Max depth 2 (including itself)
}
Map<String, CollectedMeta> putwithshortestoffsetpath(Map<String, CollectedMeta> releasemetacollection, String uniquestring, CollectedMeta metaitem) {
if (releasemetacollection.containsKey(uniquestring)) { if (releasemetacollection.containsKey(uniquestring)) {
def existingentry = releasemetacollection[uniquestring] def existingentry = releasemetacollection[uniquestring]
if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { def existingentrypathlength = existingentry.accumulatedpath.split('/').size()
releasemetacollection.put(uniquestring, relatedmetainfo) def newentrypathlength = metaitem.accumulatedpath.split('/').size()
if (existingentrypathlength > newentrypathlength) {
releasemetacollection.put(uniquestring, metaitem)
} }
} else { } else {
releasemetacollection.put(uniquestring, relatedmetainfo) releasemetacollection.put(uniquestring, metaitem)
} }
return releasemetacollection return releasemetacollection
} }
Map<String, RelatedMetaInfo> releasewalkerunique(int maxdepth, String startpath = "") { Map<String, CollectedMeta> releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') {
def ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>() def ArrayList<CollectedMeta> metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
def Map<String, RelatedMetaInfo> releasemetauniquecollection = new LinkedHashMap<String, RelatedMetaInfo>() def Map<String, CollectedMeta> versionuniquecollection = new LinkedHashMap<String, CollectedMeta>()
for (relatedmetainfo in releasemetacollection) { for (metaitem in metacollection) {
def String uniquestring = relatedmetainfo.meta.componentidentifier() def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier()
releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem)
} }
return releasemetauniquecollection return versionuniquecollection
} }
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") { Map<String, MetaInfo> releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') {
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>() def ArrayList<CollectedMeta> metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}")
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>() def Map<String, CollectedMeta> uniquecollection = new LinkedHashMap<String, CollectedMeta>()
for (relatedmetainfo in releasemetacollection) { for (metaitem in metacollection) {
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() def String uniquestring = metaitem.metainfo.componentidentifier()
releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem)
} }
return releasemetaversionuniquecollection return uniquecollection
}
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
def results = [
'metacollection' : metacollection,
'comment': comment
]
results.metacollection.add(this)
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
MetaInfo othermeta = relatedmetainfo.meta
results = othermeta.walkrelated(results.metacollection, results.comment, level + 1)
}
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
}
def allrelatedmeta() {
ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>()
return walkrelated(metacollection)
} }
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
} }
@ -911,9 +1168,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()
} }
@ -921,13 +1178,13 @@ MetaInfo metareset(script) {
return mi return mi
} }
MetaInfo metafromfolder(String folder = "") { MetaInfo metafromfolder(String folder = '') {
MetaInfo buildmeta = new MetaInfo(this) MetaInfo buildmeta = new MetaInfo(this)
buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}")
return buildmeta return buildmeta
} }
MetaInfo metafromfolderSlurper(String folder = "") { MetaInfo metafromfolderSlurper(String folder = '') {
MetaInfo buildmeta = new MetaInfo(this) MetaInfo buildmeta = new MetaInfo(this)
buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}") buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}")
return buildmeta return buildmeta

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}: ")
@ -140,14 +140,14 @@ def convertitemstopublish(String itemstopublishstring) {
// Publish selected items from a release to the customer folder on the ftp site // Publish selected items from a release to the customer folder on the ftp site
// itemstopublishstring is a comma-seperated set of strings in this format <ProductName>#<ComponentName>#<PathToPublishableItem> // itemstopublishstring is a comma-seperated set of strings in this format <ProductName>#<ComponentName>#<PathToPublishableItem>
def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
int md = maxdepth.toInteger() int md = maxdepth.toInteger()
resetfolders() resetfolders()
preconditions() preconditions()
def productline = releasemeta.productinfo.productname def productline = releasemeta.productinfo.productname
// Walk the meta information to a max depth, looking for artifacts to publish // Walk the meta information to a max depth, looking for artifacts to publish
def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md, '', releasemetapath)
echo "Version unique components:" echo "Version unique components:"
def String versionuniquecomponent = "" def String versionuniquecomponent = ""
@ -167,8 +167,8 @@ def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring
return [summarystring, markunstable, unstablereason] return [summarystring, markunstable, unstablereason]
} }
def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, String customer, String softwarerelease, String maxdepth) {
return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) return publishhierarchy(hostedftpsiteinfo, releasemeta, releasemetapath, '', customer, softwarerelease, maxdepth)
} }
return this; return this;

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

@ -114,6 +114,7 @@ pipeline {
'Select software items', 'Select software items',
'Software items', 'Software items',
releasemeta, releasemeta,
SOURCEDIR,
ITEMSDEFAULTLIST, ITEMSDEFAULTLIST,
MAX_META_DEPTH, MAX_META_DEPTH,
'20', '20',
@ -135,7 +136,7 @@ pipeline {
script { script {
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH) (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, SOURCEDIR, selecteditems, customer, release, MAX_META_DEPTH)
if (markunstable) { if (markunstable) {
env.unstablereason = unstablereason env.unstablereason = unstablereason
currentBuild.result = 'UNSTABLE' currentBuild.result = 'UNSTABLE'
@ -147,7 +148,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts() def artifactlist = meta.generateartifacts()
archiveArtifacts "summary/**,${artifactlist}" artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,${artifactlist}")
} }
} }
} }

View file

@ -58,7 +58,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts() def artifactlist = meta.generateartifacts()
archiveArtifacts "summary/**,${artifactlist}" artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,${artifactlist}")
} }
} }
} }

View file

@ -18,6 +18,7 @@ class PublishableItemsSelection {
String name, String name,
String description, String description,
releasemeta, releasemeta,
String releasemetapath,
String preselectedext, String preselectedext,
String metalevelsstringext, String metalevelsstringext,
String visibleItemCountExt, String visibleItemCountExt,
@ -25,7 +26,7 @@ class PublishableItemsSelection {
outputSelectionfromPreselect(preselectedmenuitems, preselectedext) outputSelectionfromPreselect(preselectedmenuitems, preselectedext)
def Integer metalevelsext = metalevelsstringext.toInteger() def Integer metalevelsext = metalevelsstringext.toInteger()
def Integer visibleItemCount = visibleItemCountExt.toInteger() def Integer visibleItemCount = visibleItemCountExt.toInteger()
def metaitems = releasemeta.releasewalkerunique(metalevelsext) def metaitems = releasemeta.releasewalkerunique(metalevelsext, '', releasemetapath)
for (key in metaitems.keySet()) { for (key in metaitems.keySet()) {
def releaseinfo = metaitems[key] def releaseinfo = metaitems[key]
outputDescription(menuitemdescriptions, releaseinfo) outputDescription(menuitemdescriptions, releaseinfo)
@ -89,7 +90,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 +98,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}")
@ -113,13 +114,14 @@ PublishableItemsSelection createItemSelector(
String name, String name,
String description, String description,
releasemeta, releasemeta,
String releasemetapath,
String preselectedext, String preselectedext,
String metalevelsstringext, String metalevelsstringext,
String visibleItemCountExt = '20', String visibleItemCountExt = '20',
String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT" String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT"
PublishableItemsSelection pis = new PublishableItemsSelection(this) PublishableItemsSelection pis = new PublishableItemsSelection(this)
pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) pis.init(name, description, releasemeta, releasemetapath, preselectedext, metalevelsstringext, visibleItemCountExt, type)
return pis return pis
} }

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)"
} }
} }
@ -436,8 +441,11 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
// For each component // For each component
for (key in componentReleaseInfo.keySet()) { for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key] def buildinfo = componentReleaseInfo[key]
if (toplevelid != key) { echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}"
releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) if (buildinfo.metainfo.componentidentifier() != '___' && buildinfo.metainfo.componentidentifier() != '_') {
if (toplevelid != key) {
releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush)
}
} }
} }
// Do the top level last // Do the top level last

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'
@ -56,7 +54,8 @@ pipeline {
steps { steps {
script { script {
def artifactlist = meta.generateartifacts() def artifactlist = meta.generateartifacts()
archiveArtifacts "summary/**,${artifactlist}" artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,${artifactlist}")
} }
} }
} }

View file

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

View file

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

View file

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

View file

@ -98,6 +98,9 @@ def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) {
def integerstrings = sourcebranch.findAll(/\d+/) def integerstrings = sourcebranch.findAll(/\d+/)
def integers = [] def integers = []
for (integerstring in integerstrings) { for (integerstring in integerstrings) {
if (integerstring.length() > 6) {
integerstring = integerstring.substring(0, 5)
}
int integer = integerstring.toInteger() int integer = integerstring.toInteger()
integer = integer % (maxversionnumber() + 1) integer = integer % (maxversionnumber() + 1)
integers.add(integer) integers.add(integer)
@ -154,6 +157,13 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum
return buildstamp return buildstamp
} }
String pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) {
generate(meta, sourcerevision, sourcepath, basebuildnumber)
meta.buildstampinfo.override(pregeneratedbuildstamp)
return pregeneratedbuildstamp
}
String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) {
def int bbn = basebuildnumber.trim().toInteger() def int bbn = basebuildnumber.trim().toInteger()
return generate(meta, sourcerevision, sourcepath, bbn) return generate(meta, sourcerevision, sourcepath, bbn)