From 40fdcba82bc89d3decbbd21ce6922eaa0791cf2f Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Thu, 19 Mar 2026 11:43:47 -0700 Subject: [PATCH] Revert "switch to checking agent job status to dedup code" This reverts commit a54f366b402c668725a91e9876a90c20c84a1ef1. --- .../templates/stages/notify-stage.yml | 25 +++++++++++++++---- tools/notify_mattermost.py | 6 ++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.azure-pipelines/templates/stages/notify-stage.yml b/.azure-pipelines/templates/stages/notify-stage.yml index 2d9c75447..9498901f9 100644 --- a/.azure-pipelines/templates/stages/notify-stage.yml +++ b/.azure-pipelines/templates/stages/notify-stage.yml @@ -1,8 +1,7 @@ stages: - - stage: Notify - condition: succeededOrFailed() + - stage: NotifySuccess jobs: - - job: notify_release_build + - job: notify_release_build_success pool: vmImage: ubuntu-latest steps: @@ -13,5 +12,21 @@ stages: - bash: | set -e AUTHOR_NAME="$(git log -1 --pretty=format:'%an')" - "${BUILD_REPOSITORY_LOCALPATH}/tools/notify_mattermost.py" "${AUTHOR_NAME}" $(webhook_url.secureFilePath) "${AGENT_JOBSTATUS}" - displayName: Send mattermost message + "${BUILD_REPOSITORY_LOCALPATH}/tools/notify_mattermost.py" "${AUTHOR_NAME}" $(webhook_url.secureFilePath) SUCCESS + displayName: Send mattermost success message + - stage: NotifyFailure + condition: failed() + jobs: + - job: notify_release_build_failure + pool: + vmImage: ubuntu-latest + steps: + - task: DownloadSecureFile@1 + name: webhook_url + inputs: + secureFile: mattermost_webhook_url_release_notify + - bash: | + set -e + AUTHOR_NAME="$(git log -1 --pretty=format:'%an')" + "${BUILD_REPOSITORY_LOCALPATH}/tools/notify_mattermost.py" "${AUTHOR_NAME}" $(webhook_url.secureFilePath) FAILURE + displayName: Send mattermost failure message diff --git a/tools/notify_mattermost.py b/tools/notify_mattermost.py index 547af7c8c..275bd1776 100755 --- a/tools/notify_mattermost.py +++ b/tools/notify_mattermost.py @@ -49,12 +49,12 @@ fun_success_messages = [ 'all certbot release systems are set for launch!', ] -if status in ['Succeeded', 'SucceededWithIssues ']: +if status == 'SUCCESS': message = random.choice(fun_success_messages) -elif status == 'Failed': +elif status == 'FAILURE': message = "the release pipeline has failed." else: - raise RuntimeError("Unexpected Azure job status encountered") + raise RuntimeError("STATUS must be either SUCCESS or FAILURE") azure_url = 'https://dev.azure.com/certbot/certbot/_build?definitionId=3'