keptn-sandbox / keptn-azure-devops-extension

Azure DevOps Extension for integrating Keptn with your Azure DevOps Pipelines
Apache License 2.0
6 stars 4 forks source link

Wait for Keptn Event `delivery` waits on wrong event type #69

Closed pchila closed 1 year ago

pchila commented 2 years ago

Summary WaitForKeptnEvent task used with type delivery waits for sh.keptn.event.delivery.finished instead of waiting for sh.keptn.event.<stage>.delivery.finished so it always times out.

Environment

Affected Component

To Reproduce

Trigger a delivery in the azure pipeline and wait for the event of type delivery to finish.

Expected behavior

Wait Keptn Event detects that delivery finished Current behavior

Wait Keptn Event task times out even if the delivery finishes within the timeout

Screenshots

image image

Additional context

With keptn >= 0.8 and the introduction of sequences the type of event published for delivery changed from sh.keptn.event.delivery.* to sh.keptn.event.<stage>.delivery.*. SendKeptnEvent has been updated (triggering delivery works fine) but the WaitForKeptnEvent delivery hasn't, hence the timeout.

Workaround To work around the issue, it's possible to wait for a generic event specifying <stage>.delivery.finished, so instead of

- task: WaitForKeptnEventTask@2
  inputs:
    keptnApiEndpoint: <some keptn endpoint>
    waitForEventType: 'delivery'
    timeout: '3'
    keptnContextVar: 'keptnContext'

we can use

- task: WaitForKeptnEventTask@2
  inputs:
    keptnApiEndpoint: <some keptn endpoint>
    waitForEventType: 'generic'
    sequence: '<stage>.delivery'
    timeout: '3'
    keptnContextVar: 'keptnContext'