Skip to content

Commit fe2e4e7

Browse files
chore: switch to new parameter name (#4968)
* chore: switch to new parameter name Since warnings-ng plugin version 11 the blameDisabled parameter has been replaced by skipBlames. To be compatible with Jenkinsfile Runner we put the recordIssues step into a try/catch, so no exception is thrown and the build fails. * docs: improve wording Co-authored-by: Srinikitha Kondreddy <[email protected]> --------- Co-authored-by: Srinikitha Kondreddy <[email protected]>
1 parent 06df2d4 commit fe2e4e7

7 files changed

+53
-29
lines changed

documentation/docs/extensibility.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def call(Map parameters) {
9191
goals: ['checkstyle:checkstyle'],
9292
)
9393
94-
recordIssues blameDisabled: true,
94+
recordIssues skipBlames: true,
9595
enabledForFailure: true,
9696
aggregatingResults: false,
9797
tool: checkStyle()

resources/default_pipeline_environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ steps:
415415
parserPattern: '\[(INFO|WARNING|ERROR)\] (.*) \(([^) ]*)\/([^) ]*)\)'
416416
parserScript: 'return builder.guessSeverity(matcher.group(1)).setMessage(matcher.group(2)).setModuleName(matcher.group(3)).setType(matcher.group(4)).buildOptional()'
417417
recordIssuesSettings:
418-
blameDisabled: true
418+
skipBlames: true
419419
enabledForFailure: true
420420
seleniumExecuteTests:
421421
buildTool: 'npm'

test/groovy/PiperPublishWarningsTest.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class PiperPublishWarningsTest extends BasePiperTest {
8585
assertThat(warningsParserSettings, hasKey('script'))
8686
assertThat(warningsPluginOptions, allOf(
8787
hasEntry('enabledForFailure', true),
88-
hasEntry('blameDisabled', true)
88+
hasEntry('skipBlames', true)
8989
))
9090
assertThat(warningsPluginOptions, hasKey('tools'))
9191

vars/checksPublishResults.groovy

+8-3
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ void call(Map parameters = [:]) {
133133
def report(tool, settings, doArchive){
134134
def options = createOptions(settings).plus([tools: [tool]])
135135
echo "recordIssues OPTIONS: ${options}"
136-
// publish
137-
recordIssues(options)
136+
try {
137+
// publish
138+
recordIssues(options)
139+
} catch (e) {
140+
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
141+
e.printStackTrace()
142+
}
138143
// archive check results
139144
archiveResults(doArchive && settings.get('archive'), settings.get('pattern'), true)
140145
}
@@ -149,7 +154,7 @@ def archiveResults(archive, pattern, allowEmpty){
149154
@NonCPS
150155
def createOptions(settings){
151156
Map result = [:]
152-
result.put('blameDisabled', true)
157+
result.put('skipBlames', true)
153158
result.put('enabledForFailure', true)
154159
result.put('aggregatingResults', false)
155160

vars/hadolintExecute.groovy

+15-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,21 @@ def issuesWrapper(Map parameters = [:], Script script, Closure body){
4040
try {
4141
body()
4242
} finally {
43-
recordIssues(
44-
blameDisabled: true,
45-
enabledForFailure: true,
46-
aggregatingResults: false,
47-
qualityGates: config.qualityGates,
48-
tool: checkStyle(
49-
id: config.reportName,
50-
name: config.reportName,
51-
pattern: config.reportFile
43+
try {
44+
recordIssues(
45+
skipBlames: true,
46+
enabledForFailure: true,
47+
aggregatingResults: false,
48+
qualityGates: config.qualityGates,
49+
tool: checkStyle(
50+
id: config.reportName,
51+
name: config.reportName,
52+
pattern: config.reportFile
53+
)
5254
)
53-
)
55+
} catch (e) {
56+
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
57+
e.printStackTrace()
58+
}
5459
}
5560
}

vars/mavenExecuteStaticCodeChecks.groovy

+18-9
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,27 @@ private showIssues(Script script) {
2929
Map configuration = ConfigurationLoader.stepConfiguration(script, STEP_NAME)
3030
// Every check is executed by default. Only if configured with `false` the check won't be executed
3131
if (!(configuration.spotBugs == false)) {
32-
recordIssues(blameDisabled: true,
33-
enabledForFailure: true,
34-
aggregatingResults: false,
35-
tool: spotBugs(pattern: '**/target/spotbugsXml.xml'))
36-
32+
try {
33+
recordIssues(skipBlames: true,
34+
enabledForFailure: true,
35+
aggregatingResults: false,
36+
tool: spotBugs(pattern: '**/target/spotbugsXml.xml'))
37+
} catch (e) {
38+
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
39+
e.printStackTrace()
40+
}
3741
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.FindbugsCheck)
3842
}
3943
if (!(configuration.pmd == false)) {
40-
recordIssues(blameDisabled: true,
41-
enabledForFailure: true,
42-
aggregatingResults: false,
43-
tool: pmdParser(pattern: '**/target/pmd.xml'))
44+
try {
45+
recordIssues(skipBlames: true,
46+
enabledForFailure: true,
47+
aggregatingResults: false,
48+
tool: pmdParser(pattern: '**/target/pmd.xml'))
49+
} catch (e) {
50+
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
51+
e.printStackTrace()
52+
}
4453
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.PmdCheck)
4554
}
4655
}

vars/npmExecuteLint.groovy

+9-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ void call(Map parameters = [:]) {
2525
}
2626

2727
private visualizeLintingResults(Script script) {
28-
recordIssues blameDisabled: true,
29-
enabledForFailure: true,
30-
aggregatingResults: false,
31-
tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml")
28+
try {
29+
recordIssues skipBlames: true,
30+
enabledForFailure: true,
31+
aggregatingResults: false,
32+
tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml")
33+
} catch (e) {
34+
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
35+
e.printStackTrace()
36+
}
3237
}

0 commit comments

Comments
 (0)