Tag associated source repos

This commit is contained in:
Dan Hawkins 2018-12-01 13:25:00 +00:00
commit 995062473d

View file

@ -121,13 +121,13 @@ def releasegitcommit(String buildstamp) {
}
// Determine if there has been a change by comparing the sha code in previous release meta and the build meta
def checkforchange(buildmeta, previousreleasemeta) {
def boolean checkforchange(buildmeta, previousreleasemeta) {
String buildsha = buildmeta.gitinfo.gitrevision
String previoussha = previousreleasemeta.gitinfo.gitrevision
def boolean changed = (buildsha != previoussha)
echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}"
return [changed, buildsha]
return changed
}
def ArrayList<String> maketaglist(String buildstamp, String otherreleasetags) {
@ -196,17 +196,17 @@ def boolean sourcegittag(String shacode, String tag) {
}
else { // If tag does not exist already
// Tag
sh("git tag \"${tag}\"")
sh("git tag \"${tag}\" ${shacode}")
summaryappend("(${tag})")
tagadded = true
}
return tagadded
}
def sourcegittags(buildsha, taglist) {
def sourcegittags(String buildsha, List taglist) {
boolean tagadded = false
summaryappend("Src Tag ")
summaryappend(",Src Tag ")
for (tag in taglist) {
if (sourcegittag(buildsha, tag)) {
tagadded = true
@ -243,18 +243,14 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
summaryappend(" Git operations: ")
def String buildstamp = buildmeta.buildstampinfo.buildstamp
ArrayList<String> taglist = maketaglist(buildstamp, otherreleasetags)
def boolean changed = false
def String buildsha = ""
def boolean tagadded = false
dir(releaserepo) {
def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim()
echo "Pre commit sha code: ${precommitshacode}"
releasegitadd()
(changed, buildsha)= checkforchange(buildmeta, previousreleasemeta)
def boolean changed = checkforchange(buildmeta, previousreleasemeta)
if (changed) {
releasegitcommit(buildstamp)
}
@ -266,14 +262,19 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim()
echo "Post commit sha code: ${postcommitshacode}"
tagadded = releasegittags(postcommitshacode, taglist)
ArrayList<String> taglist = maketaglist(buildstamp, otherreleasetags)
def tagadded = releasegittags(postcommitshacode, taglist)
if (changed || tagadded) {
releasegitpush(dryrunpush)
}
}
dir(sourcerepo) {
tagadded = sourcegittags(buildsha, taglist)
def String srcbuildstamp = "${buildmeta.productinfo.productname}_${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)
}
@ -306,7 +307,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
// Walk the meta information to a max depth, looking for artifacts to import for release
componentReleaseInfo = buildmeta.releasewalkerunique(md)
// For each component
for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key]