Check for more than one commit associated with source git urls

This commit is contained in:
Dan Hawkins 2021-11-14 18:51:50 +00:00
commit ee2348896d

View file

@ -62,7 +62,7 @@ def check(buildmeta) {
// Show what was collected
echo prettyPrint(toJson(releasegiturls))
// Look for product components with more than one build stamp
// Look for release git urls being used by more than one product component
for (rgu in releasegiturls.keySet()) {
def cis = releasegiturls[rgu]
if (cis.size() > 1) {
@ -74,6 +74,39 @@ def check(buildmeta) {
}
}
// Store git commit shas associated with each source git url
def sourcegiturls = [:]
for (meta in allmeta.metacollection) {
def String key = meta.gitinfo.remoteurl
if (key) {
if (!sourcegiturls.containsKey(key)) {
sourcegiturls[key] = [:]
}
def commitsha = meta.gitinfo.gitrevision
if (!sourcegiturls[key].containsKey(commitsha)) {
sourcegiturls[key][commitsha] = 1
} else {
sourcegiturls[key][commitsha] += 1
}
}
}
// Show what was collected
echo prettyPrint(toJson(sourcegiturls))
// Look for source git urls associated with more than one sha code
for (sgu in sourcegiturls.keySet()) {
def cs = sourcegiturls[sgu]
if (cs.size() > 1) {
results.good = false
results.comment += "There is more than one source commit sha associated with a source git url: ${sgu} being used in this build:\n"
for (c in cs.keySet()) {
results.comment += "${c}\n"
}
}
}
return results
}