1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

artifactPrepareVersion: improve error categorization (#1936)

* artifactPrepareVersion: improve error categorization

* Update getConfig.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
This commit is contained in:
Oliver Nocon 2020-08-19 20:20:00 +02:00 committed by GitHub
parent 07b5142417
commit b18bcee533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -336,6 +336,10 @@ func pushChanges(config *artifactPrepareVersionOptions, newVersion string, repos
log.SetErrorCategory(log.ErrorConfiguration)
case strings.Contains(errText, "Permission"):
log.SetErrorCategory(log.ErrorConfiguration)
case strings.Contains(errText, "authorization failed"):
log.SetErrorCategory(log.ErrorConfiguration)
case strings.Contains(errText, "authentication required"):
log.SetErrorCategory(log.ErrorConfiguration)
case strings.Contains(errText, "knownhosts: illegal base64"):
err = errors.Wrap(err, "known_hosts file seems invalid")
log.SetErrorCategory(log.ErrorConfiguration)

View File

@ -38,7 +38,8 @@ func ConfigCommand() *cobra.Command {
Run: func(cmd *cobra.Command, _ []string) {
err := generateConfig()
if err != nil {
log.Entry().WithField("category", "config").WithError(err).Fatal("failed to retrieve configuration")
log.SetErrorCategory(log.ErrorConfiguration)
log.Entry().WithError(err).Fatal("failed to retrieve configuration")
}
},
}