Skip to content

Commit

Permalink
fix(webhooks) use error field consistently (spinnaker#2614)
Browse files Browse the repository at this point in the history
Always use `error` (never `errorMessage`) to report errors from webhooks stage
This is what UI looks for (improvements in that area will be PR'd shortly)
  • Loading branch information
marchello2000 authored and ajordens committed Jan 22, 2019
1 parent 07943c6 commit 231ce15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CreateWebhookTask implements RetryableTask {
if ((stageData.failFastStatusCodes != null) &&
(stageData.failFastStatusCodes.contains(statusCode.value()))) {
String webhookMessage = "Received a status code configured to fail fast, terminating stage."
outputs.webhook << [errorMessage: webhookMessage]
outputs.webhook << [error: webhookMessage]

return new TaskResult(ExecutionStatus.TERMINAL, outputs)
}
Expand All @@ -76,7 +76,7 @@ class CreateWebhookTask implements RetryableTask {
String errorMessage = "error submitting webhook for pipeline ${stage.execution.id} to ${stageData.url}, will retry."
log.warn(errorMessage, e)

outputs.webhook << [errorMessage: errorMessage]
outputs.webhook << [error: errorMessage]

return new TaskResult(ExecutionStatus.RUNNING, outputs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class CreateWebhookTaskSpec extends Specification {
webhook: [
statusCode: HttpStatus.TOO_MANY_REQUESTS,
statusCodeValue: HttpStatus.TOO_MANY_REQUESTS.value(),
errorMessage: errorMessage
error: errorMessage
]
]
}
Expand Down Expand Up @@ -214,7 +214,7 @@ class CreateWebhookTaskSpec extends Specification {
result.status == ExecutionStatus.TERMINAL
result.context as Map == [
webhook: [
errorMessage: "Received a status code configured to fail fast, terminating stage.",
error: "Received a status code configured to fail fast, terminating stage.",
statusCode: HttpStatus.SERVICE_UNAVAILABLE,
statusCodeValue: HttpStatus.SERVICE_UNAVAILABLE.value(),
body: bodyString
Expand Down

0 comments on commit 231ce15

Please sign in to comment.