diff --git a/.azure-pipelines/templates/stages/notify-stage.yml b/.azure-pipelines/templates/stages/notify-stage.yml index 2d9c75447..da94eb3c0 100644 --- a/.azure-pipelines/templates/stages/notify-stage.yml +++ b/.azure-pipelines/templates/stages/notify-stage.yml @@ -1,8 +1,11 @@ stages: - stage: Notify condition: succeededOrFailed() + dependsOn: Deploy jobs: - job: notify_release_build + variables: + STAGE_STATUS: $[stageDependencies.Deploy.succeed_for_status.result] pool: vmImage: ubuntu-latest steps: @@ -13,5 +16,5 @@ 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}" + "${BUILD_REPOSITORY_LOCALPATH}/tools/notify_mattermost.py" "${AUTHOR_NAME}" $(webhook_url.secureFilePath) "$(STAGE_STATUS)" displayName: Send mattermost message diff --git a/.azure-pipelines/templates/stages/release-deploy-stage.yml b/.azure-pipelines/templates/stages/release-deploy-stage.yml index 8bf259446..bb07f1c50 100644 --- a/.azure-pipelines/templates/stages/release-deploy-stage.yml +++ b/.azure-pipelines/templates/stages/release-deploy-stage.yml @@ -25,3 +25,12 @@ stages: releaseNotesFilePath: '$(Pipeline.Workspace)/release_notes.md' assets: '$(Build.SourcesDirectory)/packages/{*.tar.gz,SHA256SUMS*}' addChangeLog: false + - job: succeed_for_status + dependsOn: + - create_github_release + - publish_snap + - publish_docker_by_arch + - publish_docker_multiarch + steps: + - bash: echo "success" + displayName: 'Succeed to grab status for notification' \ No newline at end of file diff --git a/tools/notify_mattermost.py b/tools/notify_mattermost.py index 547af7c8c..b14801ada 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 in ['Succeeded', 'SucceededWithIssues']: message = random.choice(fun_success_messages) -elif status == 'Failed': +elif status in ['Failed', 'Skipped']: message = "the release pipeline has failed." else: - raise RuntimeError("Unexpected Azure job status encountered") + raise RuntimeError("Unexpected Azure job status {0} encountered".format(status)) azure_url = 'https://dev.azure.com/certbot/certbot/_build?definitionId=3'