Check for changes occurring

This commit is contained in:
Dan Hawkins 2018-11-30 16:38:43 +00:00
commit 476c771144

View file

@ -129,14 +129,26 @@ def ArrayList<String> maketaglist(String buildstamp, String otherreleasetags) {
}
def boolean releasegittag(String postcommitshacode, String tag) {
def boolean tagadded = false
// Check if tag exists already
def retvalue = sh(script: "git rev-parse ${tag} >2 /dev/null", returnStdout: true, returnStatus: true)
echo "retvalue: ${retvalue} class: ${retvalue.getClass()}"
// Tag
sh("git tag ${tag}")
summaryappend("(${tag}),")
def existingshacode = sh(script: "git rev-parse ${tag}", returnStdout: true).trim()
if (existingshacode?.trim()) { // If tag/sha code does exist
if (existingshacode != postcommitshacode) { // If the existing tag is not associated with HEAD
// This is a problem - The tag is already at another position in git repo
setunstable("The tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it")
summaryappend("(${tag} - Could not add!),")
}
else {
summaryappend("(${tag} - Already added),")
}
}
else { // If sha code does not exist already
// Tag
sh("git tag ${tag}")
summaryappend("(${tag}),")
tagadded = true
}
return tagadded
}
def boolean releasegittags(String postcommitshacode, ArrayList<String> taglist) {