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:
parent
06df2d4463
commit
fe2e4e7757
@ -91,7 +91,7 @@ def call(Map parameters) {
|
|||||||
goals: ['checkstyle:checkstyle'],
|
goals: ['checkstyle:checkstyle'],
|
||||||
)
|
)
|
||||||
|
|
||||||
recordIssues blameDisabled: true,
|
recordIssues skipBlames: true,
|
||||||
enabledForFailure: true,
|
enabledForFailure: true,
|
||||||
aggregatingResults: false,
|
aggregatingResults: false,
|
||||||
tool: checkStyle()
|
tool: checkStyle()
|
||||||
|
@ -415,7 +415,7 @@ steps:
|
|||||||
parserPattern: '\[(INFO|WARNING|ERROR)\] (.*) \(([^) ]*)\/([^) ]*)\)'
|
parserPattern: '\[(INFO|WARNING|ERROR)\] (.*) \(([^) ]*)\/([^) ]*)\)'
|
||||||
parserScript: 'return builder.guessSeverity(matcher.group(1)).setMessage(matcher.group(2)).setModuleName(matcher.group(3)).setType(matcher.group(4)).buildOptional()'
|
parserScript: 'return builder.guessSeverity(matcher.group(1)).setMessage(matcher.group(2)).setModuleName(matcher.group(3)).setType(matcher.group(4)).buildOptional()'
|
||||||
recordIssuesSettings:
|
recordIssuesSettings:
|
||||||
blameDisabled: true
|
skipBlames: true
|
||||||
enabledForFailure: true
|
enabledForFailure: true
|
||||||
seleniumExecuteTests:
|
seleniumExecuteTests:
|
||||||
buildTool: 'npm'
|
buildTool: 'npm'
|
||||||
|
@ -85,7 +85,7 @@ class PiperPublishWarningsTest extends BasePiperTest {
|
|||||||
assertThat(warningsParserSettings, hasKey('script'))
|
assertThat(warningsParserSettings, hasKey('script'))
|
||||||
assertThat(warningsPluginOptions, allOf(
|
assertThat(warningsPluginOptions, allOf(
|
||||||
hasEntry('enabledForFailure', true),
|
hasEntry('enabledForFailure', true),
|
||||||
hasEntry('blameDisabled', true)
|
hasEntry('skipBlames', true)
|
||||||
))
|
))
|
||||||
assertThat(warningsPluginOptions, hasKey('tools'))
|
assertThat(warningsPluginOptions, hasKey('tools'))
|
||||||
|
|
||||||
|
@ -133,8 +133,13 @@ void call(Map parameters = [:]) {
|
|||||||
def report(tool, settings, doArchive){
|
def report(tool, settings, doArchive){
|
||||||
def options = createOptions(settings).plus([tools: [tool]])
|
def options = createOptions(settings).plus([tools: [tool]])
|
||||||
echo "recordIssues OPTIONS: ${options}"
|
echo "recordIssues OPTIONS: ${options}"
|
||||||
|
try {
|
||||||
// publish
|
// publish
|
||||||
recordIssues(options)
|
recordIssues(options)
|
||||||
|
} catch (e) {
|
||||||
|
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
// archive check results
|
// archive check results
|
||||||
archiveResults(doArchive && settings.get('archive'), settings.get('pattern'), true)
|
archiveResults(doArchive && settings.get('archive'), settings.get('pattern'), true)
|
||||||
}
|
}
|
||||||
@ -149,7 +154,7 @@ def archiveResults(archive, pattern, allowEmpty){
|
|||||||
@NonCPS
|
@NonCPS
|
||||||
def createOptions(settings){
|
def createOptions(settings){
|
||||||
Map result = [:]
|
Map result = [:]
|
||||||
result.put('blameDisabled', true)
|
result.put('skipBlames', true)
|
||||||
result.put('enabledForFailure', true)
|
result.put('enabledForFailure', true)
|
||||||
result.put('aggregatingResults', false)
|
result.put('aggregatingResults', false)
|
||||||
|
|
||||||
|
@ -40,8 +40,9 @@ def issuesWrapper(Map parameters = [:], Script script, Closure body){
|
|||||||
try {
|
try {
|
||||||
body()
|
body()
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
recordIssues(
|
recordIssues(
|
||||||
blameDisabled: true,
|
skipBlames: true,
|
||||||
enabledForFailure: true,
|
enabledForFailure: true,
|
||||||
aggregatingResults: false,
|
aggregatingResults: false,
|
||||||
qualityGates: config.qualityGates,
|
qualityGates: config.qualityGates,
|
||||||
@ -51,5 +52,9 @@ def issuesWrapper(Map parameters = [:], Script script, Closure body){
|
|||||||
pattern: config.reportFile
|
pattern: config.reportFile
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
} catch (e) {
|
||||||
|
echo "recordIssues has failed. Possibly due to an outdated version of the warnings-ng plugin."
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,18 +29,27 @@ private showIssues(Script script) {
|
|||||||
Map configuration = ConfigurationLoader.stepConfiguration(script, STEP_NAME)
|
Map configuration = ConfigurationLoader.stepConfiguration(script, STEP_NAME)
|
||||||
// Every check is executed by default. Only if configured with `false` the check won't be executed
|
// Every check is executed by default. Only if configured with `false` the check won't be executed
|
||||||
if (!(configuration.spotBugs == false)) {
|
if (!(configuration.spotBugs == false)) {
|
||||||
recordIssues(blameDisabled: true,
|
try {
|
||||||
|
recordIssues(skipBlames: true,
|
||||||
enabledForFailure: true,
|
enabledForFailure: true,
|
||||||
aggregatingResults: false,
|
aggregatingResults: false,
|
||||||
tool: spotBugs(pattern: '**/target/spotbugsXml.xml'))
|
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)
|
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.FindbugsCheck)
|
||||||
}
|
}
|
||||||
if (!(configuration.pmd == false)) {
|
if (!(configuration.pmd == false)) {
|
||||||
recordIssues(blameDisabled: true,
|
try {
|
||||||
|
recordIssues(skipBlames: true,
|
||||||
enabledForFailure: true,
|
enabledForFailure: true,
|
||||||
aggregatingResults: false,
|
aggregatingResults: false,
|
||||||
tool: pmdParser(pattern: '**/target/pmd.xml'))
|
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)
|
ReportAggregator.instance.reportStaticCodeExecution(QualityCheck.PmdCheck)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,13 @@ void call(Map parameters = [:]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private visualizeLintingResults(Script script) {
|
private visualizeLintingResults(Script script) {
|
||||||
recordIssues blameDisabled: true,
|
try {
|
||||||
|
recordIssues skipBlames: true,
|
||||||
enabledForFailure: true,
|
enabledForFailure: true,
|
||||||
aggregatingResults: false,
|
aggregatingResults: false,
|
||||||
tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml")
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user