Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the CodeReview script - Correct processing of the XML and CSV files #140

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions Pipeline/RunIDZCodeReview/RunCodeReview.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,33 @@ else
// Ok, the string can be splitted because it contains the keyword CC : Splitting by CC the second record contains the actual RC
rc = jobRcStringArray[1].toInteger()
// manage processing the RC, up to your logic. You might want to flag the build as failed.
if (rc <= codeReview_maxRC){
println "** Job '${codeRev.submittedJobId}' completed with RC=$rc "}
else {
if (rc <= codeReview_maxRC) {
println "** Job '${codeRev.submittedJobId}' completed with RC=$rc "
} else {
println "** Job '${codeRev.submittedJobId}' failed with RC=$rc "
}

println "** Saving spool output to ${props.workDir}"
def logFile = new File("${props.workDir}/CodeReviewSpool-${codeRev.getSubmittedJobId()}.txt")
codeRev.saveOutput(logFile, props.logEncoding)

codeRev.getAllDDNames().each({ ddName ->
if (ddName == 'XML') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.xml")
saveJobOutput(codeRev, ddName, ddfile, false)
}
if (ddName == 'JUNIT') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.xml")
saveJobOutput(codeRev, ddName, ddfile, false)
}
if (ddName == 'CSV') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.csv")
saveJobOutput(codeRev, ddName, ddfile, false)
}
})


if (rc > codeReview_maxRC) {
System.exit(1)
}
}
Expand All @@ -145,34 +168,15 @@ else
println "*** Job ${codeRev.submittedJobId} failed with ${codeRev.maxRC}"
System.exit(1)
}

println "** Saving spool output to ${props.workDir}"
def logFile = new File("${props.workDir}/CodeReviewSpool-${codeRev.getSubmittedJobId()}.txt")
codeRev.saveOutput(logFile, props.logEncoding)

codeRev.getAllDDNames().each({ ddName ->
if (ddName == 'XML') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.xml")
saveJobOutput(codeRev, ddName, ddfile)
}
if (ddName == 'JUNIT') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.xml")
saveJobOutput(codeRev, ddName, ddfile)
}
if (ddName == 'CSV') {
def ddfile = new File("${props.workDir}/CodeReview${ddName}.csv")
saveJobOutput(codeRev, ddName, ddfile)
}
})
}
}

/*
* Ensures backward compatibility
*/
def saveJobOutput ( JCLExec codeRev, String ddName, File file) {
def saveJobOutput ( JCLExec codeRev, String ddName, File file, boolean removeASA) {
try {
codeRev.saveOutput(ddName, file, props.logEncoding, true)
codeRev.saveOutput(ddName, file, props.logEncoding, removeASA)
} catch ( Exception ex ) {
println "*? Warning the output file $file\n*? will have an extra space at the beginning of each line.\n*? Updating DBB to the latest PTF with ASA control characters API for JCLExec is highly recommended."
codeRev.saveOutput(ddName, file, props.logEncoding)
Expand Down