diff --git a/build/integrity.groovy b/build/integrity.groovy index 73d5d46..7c0f66f 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -10,6 +10,7 @@ def check(buildmeta) { def allmeta = buildmeta.allrelatedmeta() echo "All meta:\n${allmeta.comment}" + // Store build stamps associated with each product component; Store a counter against each product component version def productcomponents = [:] for (meta in allmeta.metacollection) { def key = meta.componentidentifier() @@ -24,9 +25,13 @@ def check(buildmeta) { productcomponents[key][buildstampnumber] += 1 } } + + // Show what was collected echo prettyPrint(toJson(productcomponents)) + + // Look for product components with more than one build stamp for (pc in productcomponents.keySet()) { - bsns = productcomponents[pc] + def bsns = productcomponents[pc] if (bsns.size() > 1) { results.good = false results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" @@ -35,6 +40,38 @@ def check(buildmeta) { } } } + + // Store product components associated with each release git url + def releasegiturls = [:] + for (meta in allmeta.metacollection) { + def key = meta.gitinfo.remoteurl + + if (!releasegiturls.containsKey(key)) { + releasegiturls[key] = [:] + } + def componentidentifier = meta.componentidentifier() + if (!releasegiturls[key].containsKey(componentidentifier)) { + releasegiturls[key][componentidentifier] = 1 + } else { + releasegiturls[key][componentidentifier] += 1 + } + } + + // Show what was collected + echo prettyPrint(toJson(releasegiturls)) + + // Look for product components with more than one build stamp + for (rgu in releasegiturls.keySet()) { + def cis = releasegiturls[rgu] + if (cis.size() > 1) { + results.good = false + results.comment += "There is more than one product component associated with a release git url: ${rgu} being used in this build:\n" + for (ci in cis.keySet()) { + results.comment += "${ci}\n" + } + } + } + return results }