From ee2348896d154396249528fe697bbeb6e5caeb78 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 14 Nov 2021 18:51:50 +0000 Subject: [PATCH] Check for more than one commit associated with source git urls --- build/integrity.groovy | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 51370e4..e93c00f 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -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 }