Grab status from job in previous stage that depends on all other jobs

This commit is contained in:
Erica Portnoy
2026-03-18 19:29:07 -07:00
parent a54f366b40
commit 0674e1f445
3 changed files with 16 additions and 4 deletions
@@ -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
@@ -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'
+3 -3
View File
@@ -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'