From 456172b52d41fb7e014a8ac7344d9476687bbe27 Mon Sep 17 00:00:00 2001 From: Mark Vulfson Date: Mon, 24 Jun 2019 16:39:45 -0700 Subject: [PATCH] fix(webhooks): addresses issue 3450 - introduce a delay before polling webhook (#7144) * fix(webhooks): addresses issue 3450 - introduce a delay before polling webhook Add additional parameters to the monitored webhook to allow: * waiting some number of seconds before polling starts * retrying on specific HTTP status codes see #3450 orca counterpart (https://github.com/spinnaker/orca/pull/2984) --- .../modules/core/src/help/help.contents.ts | 4 ++++ .../config/stages/webhook/webhookStage.html | 19 +++++++++++++++++++ .../config/stages/webhook/webhookStage.ts | 9 +++++++++ 3 files changed, 32 insertions(+) diff --git a/app/scripts/modules/core/src/help/help.contents.ts b/app/scripts/modules/core/src/help/help.contents.ts index 74d8b685439..1cfe8626777 100644 --- a/app/scripts/modules/core/src/help/help.contents.ts +++ b/app/scripts/modules/core/src/help/help.contents.ts @@ -412,6 +412,10 @@ const helpContents: { [key: string]: string } = { "Pick the status url from the JSON returned by the webhook's response call.", 'pipeline.config.webhook.statusUrlJsonPath': "JSON path to the status url in the webhook's response JSON. (i.e. $.buildInfo.url)", + 'pipeline.config.webhook.retryStatusCodes': + 'Normally, webhook stages only retry on 429 and 5xx status codes.
You can specify additional status codes here that will cause the monitor to retry (e.g. 404, 418)', + 'pipeline.config.webhook.waitBeforeMonitor': + 'Optional delay (in seconds) to wait before starting to poll the endpoint for monitoring status', 'pipeline.config.webhook.statusJsonPath': "JSON path to the status information in the webhook's response JSON. (e.g. $.buildInfo.status)", 'pipeline.config.webhook.progressJsonPath': diff --git a/app/scripts/modules/core/src/pipeline/config/stages/webhook/webhookStage.html b/app/scripts/modules/core/src/pipeline/config/stages/webhook/webhookStage.html index 056501a9b71..09e17427792 100644 --- a/app/scripts/modules/core/src/pipeline/config/stages/webhook/webhookStage.html +++ b/app/scripts/modules/core/src/pipeline/config/stages/webhook/webhookStage.html @@ -157,6 +157,25 @@ + + + + + + parseInt(x, 10)).filter(x => !isNaN(x)); } + public retryCodesChanged(): void { + const retryCodes = this.viewState.retryStatusCodes.split(',').map(x => x.trim()); + + this.stage.retryStatusCodes = retryCodes.map(x => parseInt(x, 10)).filter(x => !isNaN(x)); + } + public customHeaderCount(): number { return this.stage.customHeaders ? Object.keys(this.stage.customHeaders).length : 0; }