Squashed 'Common_scripts/' changes from 0326879..b70fe5f
b70fe5fRemove debug release filtering3730461Debug release filteringdb92ee3Debug release filtering2393146Use releasetag script54bf29fAttempt to separate dependent products and sub-components3c4de23Debugging scriptd93f942Debugging scriptcaf71e3Debugging scriptc993eccDebugging script2e5b6b2Debugging script0ad763cDebugging scriptd5a178bDebugging script01d91a7Debugging scriptd2a22dbDebugging script30ac58dDebugging script490b37bDebugging script2939eafDebugging script35d3862Debugging scriptdefc807Debugging scriptf2e3e52Debugging scriptb5e2894Debugging scriptc2faf8aDebugging scriptfa199ebDebugging scriptd418e5aDebugging scriptf34fb2eDebugging script04e947cDebugging script48d7b0fDebugging script38b562bDebugging scriptac5e7cdDebugging script1d3f184Debugging scriptb187d23Debugging script1131865Debugging script68cbc00Debugging script5771490Debugginged17de0Debuggingb1bc540Debugginge6c6fcfDebugging57eeaf4Comment out code to debug latera576d64Script reorg32a3aedSupply release tag processing01ce780Supply release tag processingaf3e22dSupply release tag processingb7c5a66Supply release tag processing4fbe1d9Supply release tag processing44b1e13Supply release tag processingaf3c041Supply release tag processing8b361deSupply release tag processing89736f0Supply release tag processing70d569cSupply release tag processingd2b8d1bSupply release tag processingce33f59Supply release tag processing88cba3bSupply release tag processing80bc64eSupply release tag processing6488203Supply release tag processingc2b27a8Merge commit 'cd98f833a8db023604d045d9343f18f3a423da5c'704e499Start adding dependencies940a8d5Start adding dependencies4a46b8fBuild up a tag map0ca7886Build up a tag map3dbdf85Build up a tag mapfb72031Build up a tag mapbe599cbBuild up a tag map462b177Build up a tag map453a14aBuild up a tag mapc5f01d0Build up a tag map11826a4Get list of tags for each product release repo3981eceFilter long name releases from version selectioncad2d4eFilter long name releases from version selection8bd075fFilter long name releases from version selection20c5648Merge commit '6633e04d0257e6d52427b2ff761c8a5625196346' as 'Common_scripts'9a31bebRemove folder2767e8aRename foldera5ee31dNew files2c6a90dNew filese5d8c38Merge commit 'c1344e9084' as 'Commons_scripts'c1344e9Squashed 'Commons_scripts/' content from commit03268799171d4dInitial commite5bca0dInitial commit git-subtree-dir: Common_scripts git-subtree-split:b70fe5f7bd
This commit is contained in:
parent
d1a56a994c
commit
ab3516d23d
5 changed files with 305 additions and 16 deletions
|
|
@ -913,6 +913,14 @@ class MetaInfo extends GISJsonSerialised {
|
|||
String componentidentifier() {
|
||||
return productinfo.productname + "_" + productinfo.subcomponentname
|
||||
}
|
||||
|
||||
String productvariant() {
|
||||
if (!productinfo.variant) {
|
||||
return productinfo.productname
|
||||
} else {
|
||||
return productinfo.productname + "_" + productinfo.variant
|
||||
}
|
||||
}
|
||||
|
||||
String componentversionuniqueidentifier() {
|
||||
return componentidentifier() + "_" + buildstampinfo.buildstamp
|
||||
|
|
|
|||
217
product/info.groovy
Normal file
217
product/info.groovy
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
rt = load("${autobuilder.commonscripts()}/release/tag.groovy")
|
||||
|
||||
class ProductDependency {
|
||||
private script
|
||||
private rtscript
|
||||
private String productvariant
|
||||
private String releaserepo
|
||||
private String presplitreleasetag
|
||||
private String releasetag
|
||||
private String releasestate
|
||||
|
||||
def ProductDependency(script,
|
||||
rtscript,
|
||||
String productvariant,
|
||||
String presplitreleasetag,
|
||||
String releaserepo) {
|
||||
this.script = script
|
||||
this.rtscript = rtscript
|
||||
this.productvariant = productvariant
|
||||
this.releaserepo = releaserepo
|
||||
this.presplitreleasetag = presplitreleasetag
|
||||
this.releasetag = ''
|
||||
this.releasestate = ''
|
||||
}
|
||||
|
||||
def setreleasestate() {
|
||||
def LinkedHashMap results = rtscript.startswithspecialprefix(presplitreleasetag)
|
||||
script.echo("results is: ${results.dump()}")
|
||||
if (results.hasspecialprefix) {
|
||||
releasetag = results.tagwithoutprefix
|
||||
releasestate = results.prefixfound
|
||||
} else {
|
||||
releasetag = results.tagwithoutprefix
|
||||
releasestate = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ProductComponent {
|
||||
private String componentname
|
||||
private String releaserepo
|
||||
private String releasetag
|
||||
|
||||
def ProductComponent(String componentname, String releasetag, String releaserepo) {
|
||||
this.componentname = componentname
|
||||
this.releaserepo = releaserepo
|
||||
this.releasetag = releasetag
|
||||
}
|
||||
}
|
||||
|
||||
class ProductRelease {
|
||||
private String sha
|
||||
private String builddate
|
||||
private ArrayList<String> tags
|
||||
private ArrayList<ProductDependency> productdependencies
|
||||
private ArrayList<ProductComponent> productcomponents
|
||||
|
||||
def ProductRelease(String sha, String builddate, ArrayList<String> tags) {
|
||||
this.sha = sha
|
||||
this.builddate = builddate
|
||||
this.tags = tags
|
||||
this.productdependencies = new ArrayList<ProductDependency>()
|
||||
this.productcomponents = new ArrayList<ProductComponent>()
|
||||
}
|
||||
|
||||
def addProductDependency(ProductDependency dependency) {
|
||||
productdependencies.add(dependency)
|
||||
}
|
||||
|
||||
def addProductComponent(ProductComponent component) {
|
||||
productcomponents.add(component)
|
||||
}
|
||||
}
|
||||
|
||||
class ProductParsed {
|
||||
enum State {
|
||||
UNPARSED,
|
||||
PARSED,
|
||||
}
|
||||
private State scanstate
|
||||
private String productvariant
|
||||
private ArrayList<ProductRelease> releases
|
||||
|
||||
def ProductParsed(String productvariant) {
|
||||
scanstate = State.UNPARSED
|
||||
this.productvariant = productvariant
|
||||
this.releases = new ArrayList<ProductRelease>()
|
||||
}
|
||||
|
||||
def markparsed() {
|
||||
scanstate = State.PARSED
|
||||
}
|
||||
|
||||
def boolean parsed() {
|
||||
return (scanstate == State.PARSED)
|
||||
}
|
||||
|
||||
def addProductRelease(ProductRelease productrelease) {
|
||||
releases.add(productrelease)
|
||||
}
|
||||
}
|
||||
|
||||
def addProductEntry(LinkedHashMap<String, ProductParsed> products,
|
||||
String productvariant,
|
||||
String releaserepo) {
|
||||
def productparsed
|
||||
if (products.get(releaserepo) == null) { // Use the first entry name only
|
||||
productparsed = new ProductParsed(productvariant)
|
||||
products.put(releaserepo, productparsed)
|
||||
} else {
|
||||
productparsed = products.get(releaserepo)
|
||||
}
|
||||
return productparsed
|
||||
}
|
||||
|
||||
def parseproductdependencies(LinkedHashMap<String, ProductParsed> products,
|
||||
productreleasemeta,
|
||||
String productreleasefolder,
|
||||
String containingproductvariant,
|
||||
ProductRelease productrelease) {
|
||||
def dependentmeta = productreleasemeta.getassociated(productreleasefolder)
|
||||
|
||||
for (meta in dependentmeta) {
|
||||
def pd = new ProductDependency(this,
|
||||
rt,
|
||||
meta.productvariant(),
|
||||
meta.releasetag(),
|
||||
meta.releaseinfo.releaserepoURL)
|
||||
pd.setreleasestate()
|
||||
if (meta.productinfo.subcomponentname == 'WHOLE') {
|
||||
if (meta.productvariant() != containingproductvariant) { // Don't add myself
|
||||
addProductEntry(products,
|
||||
meta.productvariant(),
|
||||
meta.releaseinfo.releaserepoURL)
|
||||
productrelease.addProductDependency(pd)
|
||||
}
|
||||
} else if (meta.productvariant() != containingproductvariant) {
|
||||
addProductEntry(products,
|
||||
meta.productvariant(),
|
||||
meta.releaseinfo.releaserepoURL)
|
||||
productrelease.addProductDependency(pd)
|
||||
} else {
|
||||
def pc = new ProductComponent(meta.productinfo.subcomponentname,
|
||||
meta.releasetag(),
|
||||
meta.releaseinfo.releaserepoURL)
|
||||
productrelease.addProductComponent(pc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def parseproductrepo(LinkedHashMap<String, ProductParsed> products,
|
||||
String productrepo,
|
||||
String productreleasefolder) {
|
||||
def LinkedHashMap<String, ArrayList<String>> shatagmap = gh.getremoteshatagmap(productrepo)
|
||||
def String productvariant
|
||||
def ProductParsed pp
|
||||
|
||||
def ArrayList<ProductRelease> productreleases = new ArrayList<ProductRelease>()
|
||||
shatagmap.each { sha, tags ->
|
||||
def importoptions = importer.getNewImportOptions()
|
||||
importoptions.releaserepo(productrepo, sha)
|
||||
importoptions.setfilter('meta/**')
|
||||
def productreleasemeta = importer.artifactimport(meta,
|
||||
importoptions,
|
||||
productreleasefolder)
|
||||
|
||||
if (!productvariant) {
|
||||
productvariant = productreleasemeta.productvariant()
|
||||
pp = addProductEntry(products,
|
||||
productvariant, productrepo)
|
||||
}
|
||||
|
||||
def productrelease = new ProductRelease(sha,
|
||||
productreleasemeta.jenkinsbuildinfo.builddate,
|
||||
tags)
|
||||
parseproductdependencies(products,
|
||||
productreleasemeta,
|
||||
productreleasefolder,
|
||||
productvariant,
|
||||
productrelease)
|
||||
pp.addProductRelease(productrelease)
|
||||
}
|
||||
pp.markparsed()
|
||||
}
|
||||
|
||||
def iterateinitialproductrepos(initialproductcollection,
|
||||
LinkedHashMap<String, ProductParsed> productcollection,
|
||||
String productreleasefolder) {
|
||||
for (productrepo in initialproductcollection.ProductReleaseRepos) {
|
||||
echo "Querying ${productrepo}"
|
||||
parseproductrepo(productcollection,
|
||||
productrepo,
|
||||
productreleasefolder)
|
||||
}
|
||||
while( true ) {
|
||||
boolean allparsed = true
|
||||
productcollection.each { releaserepo, productparsed ->
|
||||
if (!productparsed.parsed()) {
|
||||
allparsed = false
|
||||
parseproductrepo(productcollection,
|
||||
releaserepo,
|
||||
productreleasefolder)
|
||||
}
|
||||
}
|
||||
if (allparsed) break
|
||||
}
|
||||
}
|
||||
|
||||
def LinkedHashMap<String, ProductParsed> getNewProductCollection() {
|
||||
return new LinkedHashMap<String, ProductParsed>()
|
||||
}
|
||||
|
||||
|
||||
return this
|
||||
|
|
@ -52,27 +52,29 @@ pipeline {
|
|||
stage('Identify software release to publish') {
|
||||
steps {
|
||||
script {
|
||||
rt = load("${autobuilder.commonscripts()}/release/tag.groovy")
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
def allreleases = gh.gettaglist(SOURCEDIR)
|
||||
def releases = new ArrayList<String>()
|
||||
if (FILTER_REDUNDANT_RELEASES == 'false') {
|
||||
echo("Showing all releases")
|
||||
releases = allreleases
|
||||
} else {
|
||||
echo("Showing filtered releases")
|
||||
for (release in allreleases) {
|
||||
if (!release.toLowerCase().startsWith("superceded") &&
|
||||
!release.toLowerCase().startsWith("superseded") &&
|
||||
!release.toLowerCase().startsWith("erroneous") &&
|
||||
!release.toLowerCase().startsWith("faulty") &&
|
||||
!release.toLowerCase().startsWith("ignore") &&
|
||||
!release.toLowerCase().startsWith("inmainline")) {
|
||||
echo("Showing release: ${release}")
|
||||
releases.add(release)
|
||||
} else {
|
||||
echo("Not showing release: ${release}")
|
||||
for (release in allreleases) {
|
||||
def boolean canadd = true
|
||||
if (FILTER_REDUNDANT_RELEASES == 'true') {
|
||||
def results = rt.startswithspecialprefix(release)
|
||||
if (results.prefixfound) {
|
||||
canadd = false
|
||||
}
|
||||
}
|
||||
if (FILTER_LONGNAME_RELEASES == 'true') {
|
||||
if (release.findAll(/[a-zA-Z]/)) {
|
||||
canadd = false
|
||||
}
|
||||
}
|
||||
if (canadd) {
|
||||
echo("Showing release: ${release}")
|
||||
releases.add(release)
|
||||
} else {
|
||||
echo("Not showing release: ${release}")
|
||||
}
|
||||
}
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
release = input(
|
||||
|
|
|
|||
39
release/tag.groovy
Normal file
39
release/tag.groovy
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
def startswithspecialprefix(String releasetag) {
|
||||
def RELEASETAG_PREFIXES = [
|
||||
'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix',
|
||||
'superseded' : 'Indicates a later release has superseded the release with this prefix',
|
||||
'erroneous' : 'The release was released unintentionally',
|
||||
'faulty' : 'The release was found to have a serious fault',
|
||||
'ignore' : 'The release should be ignored',
|
||||
'inmainline' : 'This release was associated with development branch which has now been merged into mainline',
|
||||
]
|
||||
|
||||
def RELEASETAG_PREFIX_SEPERATOR = '_'
|
||||
|
||||
def boolean hasspecialprefix = false
|
||||
def String releasetagprefix = ''
|
||||
def String prefixfound = ''
|
||||
def String prefixmeaning = ''
|
||||
def String tagwithoutprefix = releasetag
|
||||
|
||||
for (def prefix in RELEASETAG_PREFIXES.keySet()) {
|
||||
def meaning = RELEASETAG_PREFIXES.get(prefix)
|
||||
if (releasetag.toLowerCase().startsWith(prefix)) {
|
||||
prefixfound = prefix
|
||||
hasspecialprefix = true
|
||||
prefixmeaning = meaning
|
||||
tagwithoutprefix = releasetag[(prefix.size() + 1)..-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
def results = [ 'hasspecialprefix' : hasspecialprefix,
|
||||
'prefixfound' : prefixfound,
|
||||
'tagwithoutprefix' : tagwithoutprefix,
|
||||
'meaning' : prefixmeaning,
|
||||
]
|
||||
return results
|
||||
}
|
||||
|
||||
return this
|
||||
|
|
@ -34,6 +34,29 @@ ArrayList<String> gettaglist(String workingSetRootPath) {
|
|||
return taglist
|
||||
}
|
||||
|
||||
LinkedHashMap<String, ArrayList<String>> getremoteshatagmap(String repositoryURL) {
|
||||
def shatagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}")
|
||||
def shataglist = shatagliststring.split('\\n')
|
||||
|
||||
LinkedHashMap<String, ArrayList<String>> shatagmap = new LinkedHashMap<String, ArrayList<String>>()
|
||||
for (shatag in shataglist) {
|
||||
def shatagfields = shatag.split('\\t')
|
||||
def sha = shatagfields[0].trim()
|
||||
def tag = shatagfields[1].trim()
|
||||
echo "sha: ${sha} tag: ${tag}"
|
||||
if (shatagmap.get(sha) == null) {
|
||||
def ArrayList<String> taglist = new ArrayList<String>()
|
||||
taglist.add(tag)
|
||||
shatagmap.put(sha, taglist)
|
||||
} else {
|
||||
def taglist = shatagmap.get(sha)
|
||||
taglist.add(tag)
|
||||
shatagmap.put(sha, taglist)
|
||||
}
|
||||
}
|
||||
return shatagmap
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def ArrayList<SparseCheckoutPath> sparsecheckoutconfig(ArrayList<String> paths) {
|
||||
ArrayList<SparseCheckoutPath> sparsecheckoutpaths = new ArrayList<SparseCheckoutPath>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue