1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-06 04:13:55 +02:00

Improve error message for legacy cloud sdk config (#2348)

This commit is contained in:
Florian Wilhelm 2020-11-11 14:47:55 +01:00 committed by GitHub
parent 56586cae1b
commit 0356f13853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 18 deletions

View File

@ -333,9 +333,9 @@ class CheckForLegacyConfigurationTest extends BasePiperTest {
] ]
] ]
String exception = "Failing pipeline due to configuration errors. Please see log output above." String exception = "Your pipeline configuration contains the configuration key oldConfigKey for the step someStep. This configuration option was removed. test\n" +
String output = "Your pipeline configuration contains the configuration key oldConfigKey for the step someStep. " + "Failing pipeline due to configuration errors. Please see log output above."
"This configuration option was removed. test" String output = ""
assertExceptionAndOutput(exception, output) { assertExceptionAndOutput(exception, output) {
stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges) stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges)
@ -354,9 +354,9 @@ class CheckForLegacyConfigurationTest extends BasePiperTest {
] ]
] ]
String exception = "Failing pipeline due to configuration errors. Please see log output above." String exception = "Your pipeline configuration contains configuration for the step oldStep. This step has been removed. Please configure the step newStep instead. test\n" +
String output = "Your pipeline configuration contains configuration for the step oldStep. " + "Failing pipeline due to configuration errors. Please see log output above."
"This step has been removed. Please configure the step newStep instead. test" String output = ""
assertExceptionAndOutput(exception, output) { assertExceptionAndOutput(exception, output) {
stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges) stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges)
@ -372,9 +372,9 @@ class CheckForLegacyConfigurationTest extends BasePiperTest {
] ]
] ]
String exception = "Failing pipeline due to configuration errors. Please see log output above." String exception = "Your pipeline configuration contains configuration for the stage oldStage. This stage has been removed. \n" +
String output = "Your pipeline configuration contains configuration for the stage oldStage. " + "Failing pipeline due to configuration errors. Please see log output above."
"This stage has been removed. " String output = ""
assertExceptionAndOutput(exception, output) { assertExceptionAndOutput(exception, output) {
stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges) stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges)
@ -394,9 +394,9 @@ class CheckForLegacyConfigurationTest extends BasePiperTest {
] ]
] ]
String exception = "Failing pipeline due to configuration errors. Please see log output above." String exception = "Your pipeline configuration contains the configuration key configKeyOldType for the step testStep. The type of this configuration parameter was changed from String to List. test\n" +
String output = "Your pipeline configuration contains the configuration key configKeyOldType for the step testStep. " + "Failing pipeline due to configuration errors. Please see log output above."
"The type of this configuration parameter was changed from String to List. test" String output = ""
assertExceptionAndOutput(exception, output) { assertExceptionAndOutput(exception, output) {
stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges) stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges)
@ -413,9 +413,9 @@ class CheckForLegacyConfigurationTest extends BasePiperTest {
] ]
] ]
String exception = "Failing pipeline due to configuration errors. Please see log output above." String exception = "Your package.json file package.json contains an npm script using the deprecated name oldNpmScriptName. Please rename the script to newNpmScriptName, since the script oldNpmScriptName will not be executed by the pipeline anymore. test\n" +
String output = "Your package.json file package.json contains an npm script using the deprecated name oldNpmScriptName. " + "Failing pipeline due to configuration errors. Please see log output above."
"Please rename the script to newNpmScriptName, since the script oldNpmScriptName will not be executed by the pipeline anymore. test" String output = ""
assertExceptionAndOutput(exception, output) { assertExceptionAndOutput(exception, output) {
stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges) stepRule.step.checkForLegacyConfiguration(script: nullScript, legacyConfigSettings: configChanges)

View File

@ -40,13 +40,16 @@ void call(Map parameters = [:]) {
} }
if (errors) { if (errors) {
String message = ""
if (errors.size() > 1) { if (errors.size() > 1) {
script.echo("Your pipeline configuration file contains the following errors:") message += "Your pipeline configuration file contains the following errors:\n"
} }
for (error in errors) { for (error in errors) {
script.echo(error) message += error
message += "\n"
} }
script.error("Failing pipeline due to configuration errors. Please see log output above.") message += "Failing pipeline due to configuration errors. Please see log output above."
script.error(message)
} }
} }