1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-19 21:18:27 +02:00

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 <srinikitha.kondreddy@sap.com>

---------

Co-authored-by: Srinikitha Kondreddy <srinikitha.kondreddy@sap.com>
This commit is contained in:
Oliver Feldmann 2024-06-28 13:17:21 +02:00 committed by GitHub
parent 06df2d4463
commit fe2e4e7757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 53 additions and 29 deletions

View File

@ -91,7 +91,7 @@ def call(Map parameters) {
goals: ['checkstyle:checkstyle'],
)
recordIssues blameDisabled: true,
recordIssues skipBlames: true,
enabledForFailure: true,
aggregatingResults: false,
tool: checkStyle()

View File

@ -415,7 +415,7 @@ steps:
parserPattern: '\[(INFO|WARNING|ERROR)\] (.*) \(([^) ]*)\/([^) ]*)\)'
parserScript: 'return builder.guessSeverity(matcher.group(1)).setMessage(matcher.group(2)).setModuleName(matcher.group(3)).setType(matcher.group(4)).buildOptional()'
recordIssuesSettings:
blameDisabled: true
skipBlames: true
enabledForFailure: true
seleniumExecuteTests:
buildTool: 'npm'

View File

@ -85,7 +85,7 @@ class PiperPublishWarningsTest extends BasePiperTest {
assertThat(warningsParserSettings, hasKey('script'))
assertThat(warningsPluginOptions, allOf(
hasEntry('enabledForFailure', true),
hasEntry('blameDisabled', true)
hasEntry('skipBlames', true)
))
assertThat(warningsPluginOptions, hasKey('tools'))

View File

@ -133,8 +133,13 @@ void call(Map parameters = [:]) {
def report(tool, settings, doArchive){
def options = createOptions(settings).plus([tools: [tool]])
echo "recordIssues OPTIONS: ${options}"
try {
// publish
recordIssues(options)
} catch (e) {
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
e.printStackTrace()
}
// archive check results
archiveResults(doArchive && settings.get('archive'), settings.get('pattern'), true)
}
@ -149,7 +154,7 @@ def archiveResults(archive, pattern, allowEmpty){
@NonCPS
def createOptions(settings){
Map result = [:]
result.put('blameDisabled', true)
result.put('skipBlames', true)
result.put('enabledForFailure', true)
result.put('aggregatingResults', false)

View File

@ -40,8 +40,9 @@ def issuesWrapper(Map parameters = [:], Script script, Closure body){
try {
body()
} finally {
try {
recordIssues(
blameDisabled: true,
skipBlames: true,
enabledForFailure: true,
aggregatingResults: false,
qualityGates: config.qualityGates,
@ -51,5 +52,9 @@ def issuesWrapper(Map parameters = [:], Script script, Closure body){
pattern: config.reportFile
)
)
} catch (e) {
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
e.printStackTrace()
}
}
}

View File

@ -29,18 +29,27 @@ private showIssues(Script script) {
Map configuration = ConfigurationLoader.stepConfiguration(script, STEP_NAME)
// Every check is executed by default. Only if configured with `false` the check won't be executed
if (!(configuration.spotBugs == false)) {
recordIssues(blameDisabled: true,
try {
recordIssues(skipBlames: true,
enabledForFailure: true,
aggregatingResults: false,
tool: spotBugs(pattern: '**/target/spotbugsXml.xml'))
} catch (e) {
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
e.printStackTrace()
}
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.FindbugsCheck)
}
if (!(configuration.pmd == false)) {
recordIssues(blameDisabled: true,
try {
recordIssues(skipBlames: true,
enabledForFailure: true,
aggregatingResults: false,
tool: pmdParser(pattern: '**/target/pmd.xml'))
} catch (e) {
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
e.printStackTrace()
}
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.PmdCheck)
}
}

View File

@ -25,8 +25,13 @@ void call(Map parameters = [:]) {
}
private visualizeLintingResults(Script script) {
recordIssues blameDisabled: true,
try {
recordIssues skipBlames: true,
enabledForFailure: true,
aggregatingResults: false,
tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml")
} catch (e) {
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
e.printStackTrace()
}
}