This commit is contained in:
Dan Hawkins 2019-01-06 16:03:40 +00:00
commit 65f36a268f
3 changed files with 42 additions and 21 deletions

View file

@ -161,7 +161,7 @@ class BuildStampInfo extends GISJsonSerialised {
int revision
String buildstamp
BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "") {
BuildStampInfo(script, buildstampprefix = "1.30000.0.", revision = 0, buildstamp = "1.30000.0.0") {
super(script)
this.buildstampprefix = buildstampprefix
this.revision = revision
@ -188,6 +188,17 @@ class BuildStampInfo extends GISJsonSerialised {
script.echo("Build stamp now ${buildstamp}")
}
void set(String buildstampprefix, int revision) {
buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.'
this.buildstampprefix = buildstampprefix
this.buildstamp = buildstampprefix + "0"
changerevision(revision)
}
void set(String buildstampprefix, String revision) {
set(buildstampprefix, revision.toInteger())
}
void deserialiseJson(rawmeta) {
buildstampprefix = rawmeta['buildstampprefix']
revision = rawmeta['revision']

View file

@ -68,23 +68,25 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) {
def checkoutsourcerepo(buildmeta, String checkoutfolder) {
def String sourcerepo = buildmeta.gitinfo.remoteurl
// Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component
if (fileExists(checkoutfolder)) {
dir(checkoutfolder) {
sh("""
git reset --hard
git clean -fdx
git pull
# Remove all tags that are not already on the remote
git tag -l | xargs git tag -d >/dev/null
git fetch -t >/dev/null
"""
)
if (sourcerepo) {
// Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component
if (fileExists(checkoutfolder)) {
dir(checkoutfolder) {
sh("""
git reset --hard
git clean -fdx
git pull
# Remove all tags that are not already on the remote
git tag -l | xargs git tag -d >/dev/null
git fetch -t >/dev/null
"""
)
}
}
}
else {
dir(sourcerepofolder) {
sh("git clone ${sourcerepo} ${checkoutfolder}")
else {
dir(sourcerepofolder) {
sh("git clone ${sourcerepo} ${checkoutfolder}")
}
}
}
}
@ -297,10 +299,15 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}"
def String buildsha = buildmeta.gitinfo.gitrevision
def ArrayList<String> srctaglist = maketaglist(srcbuildstamp, otherreleasetags)
def tagadded = sourcegittags(buildsha, srctaglist)
if (tagadded) {
sourcegitpush(dryrunpush)
if (buildsha) {
def ArrayList<String> srctaglist = maketaglist(srcbuildstamp, otherreleasetags)
def tagadded = sourcegittags(buildsha, srctaglist)
if (tagadded) {
sourcegitpush(dryrunpush)
}
}
else {
summaryappend(",No Src ")
}
}
}

View file

@ -42,6 +42,9 @@ pipeline {
steps {
script {
def releaser = load("${autobuilder.commonscripts()}/release/do.groovy")
// Place the top level build stamp on all
def topleveltag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}"
OTHER_RELEASE_TAGS = "${topleveltag},${OTHER_RELEASE_TAGS}"
(summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH)
if (markunstable) {
env.unstablereason = unstablereason