Perform installer file (ISM) checking

This commit is contained in:
Dan Hawkins 2019-04-08 18:30:16 +01:00
commit 865deaecf8

View file

@ -33,7 +33,8 @@ def placeBinaries(artifactDetails, installerDetails) {
@NonCPS
def checkISMfile(String ISMfile) {
def xml = readFile(ISMfile)
echo "Checking ISM file: ${ISMfile}"
def parsedxml = new XmlParser(true, true, true).parseText(xml)
def pathvariableinfo = [:]
def exitcode = 0
@ -53,24 +54,26 @@ def checkISMfile(String ISMfile) {
}
// Check that each path variable is defined beginning with a path variable or the WORKSPACE one
pathvariableinfo.each{ pair ->
println "pair key: ${pair.key} value: ${pair.value}"
echo "pair key: ${pair.key} value: ${pair.value}"
def path = pair.value
def pathvarmatcher = path =~ /<(.*)>.*/
if (pathvarmatcher.matches()) {
def pathvarfound = pathvarmatcher.group(1)
if (pathvarfound != 'WORKSPACE') {
if (!pathvariableinfo.containsKey(pathvarfound)) {
println "Undefined path variable ${pathvarfound} found"
echo "Undefined path variable ${pathvarfound} found"
exitcode = 1
}
}
} else {
println "Path: ${path} does not begin with a path variable"
echo "Path: ${path} does not begin with a path variable"
exitcode = 1
}
}
if (exitcode > 0) {
error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition"
} else {
echo "ISM file: ${ISMfile} - ok"
}
}