check_cirrus_cron #666
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Format Ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions | |
# Required to un-FUBAR default ${{github.workflow}} value | |
name: check_cirrus_cron | |
on: | |
# Note: This only applies to the main branch. | |
schedule: | |
# N/B: This should correspond to a period slightly after | |
# the last job finishes running. See job defs. at: | |
# https://cirrus-ci.com/settings/repository/6707778565701632 | |
- cron: '03 03 * * 1-5' | |
# Debug: Allow triggering job manually in github-actions WebUI | |
workflow_dispatch: {} | |
# Allow re-use of this workflow by other repositories | |
# Ref: https://docs.github.com/en/actions/using-workflows/reusing-workflows | |
workflow_call: | |
secrets: | |
SECRET_CIRRUS_API_KEY: | |
required : true | |
ACTION_MAIL_SERVER: | |
required: true | |
ACTION_MAIL_USERNAME: | |
required: true | |
ACTION_MAIL_PASSWORD: | |
required: true | |
ACTION_MAIL_SENDER: | |
required: true | |
env: | |
# CSV listing of e-mail addresses for delivery failure or error notices | |
RCPTCSV: rh.container.bot@gmail.com,podman-monitor@lists.podman.io | |
# Filename for table of cron-name to build-id data | |
# (must be in $GITHUB_WORKSPACE/artifacts/) | |
NAME_ID_FILEPATH: './artifacts/name_id.txt' | |
permissions: | |
contents: read | |
jobs: | |
cron_failures: | |
runs-on: ubuntu-latest | |
steps: | |
# This is where the scripts live | |
- uses: actions/checkout@v3 | |
with: | |
repository: containers/podman | |
ref: 'main' | |
persist-credentials: false | |
- name: Get failed cron names and Build IDs | |
id: cron | |
run: './.github/actions/check_cirrus_cron/cron_failures.sh' | |
- if: steps.cron.outputs.failures > 0 | |
shell: bash | |
run: './.github/actions/check_cirrus_cron/make_email_body.sh' | |
- if: steps.cron.outputs.failures > 0 | |
name: Send failure notification e-mail | |
# Ref: https://github.com/dawidd6/action-send-mail | |
uses: dawidd6/action-send-mail@v3.7.2 | |
with: | |
server_address: ${{secrets.ACTION_MAIL_SERVER}} | |
server_port: 465 | |
username: ${{secrets.ACTION_MAIL_USERNAME}} | |
password: ${{secrets.ACTION_MAIL_PASSWORD}} | |
subject: Cirrus-CI cron build failures on ${{github.repository}} | |
to: ${{env.RCPTCSV}} | |
from: ${{secrets.ACTION_MAIL_SENDER}} | |
body: file://./artifacts/email_body.txt | |
- if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}_artifacts | |
path: artifacts/* | |
- if: failure() | |
name: Send error notification e-mail | |
uses: dawidd6/action-send-mail@v3.7.2 | |
with: | |
server_address: ${{secrets.ACTION_MAIL_SERVER}} | |
server_port: 465 | |
username: ${{secrets.ACTION_MAIL_USERNAME}} | |
password: ${{secrets.ACTION_MAIL_PASSWORD}} | |
subject: Github workflow error on ${{github.repository}} | |
to: ${{env.RCPTCSV}} | |
from: ${{secrets.ACTION_MAIL_SENDER}} | |
body: "Job failed: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |