-
Notifications
You must be signed in to change notification settings - Fork 47
119 lines (112 loc) · 4.78 KB
/
crons.yaml
File metadata and controls
119 lines (112 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Start Cron jobs
on:
# NOTE: Schedule is only run on the latest commit of the default branch,
# so we need to schedule Cron Jobs for all branches here
schedule:
# Daily builds, scheduled before nightlies every weekday at 22:00
- cron: "0 22 * * 1-5"
# Run V 0 nightly every weekday at 01:00
- cron: "0 1 * * 1-5"
# Run V -1 nightly every weekday at 02:00
- cron: "0 2 * * 1-5"
# Retry failed nightlies every weekday at 06:00 (4 hours after last nightly)
- cron: "0 6 * * 1-5"
jobs:
crons:
runs-on: ubuntu-24.04
env:
MAX_RETRIES: "2"
strategy:
fail-fast: false
matrix:
include:
# Daily build jobs, needed to make sure we have at least one build
# on latests commits of each branch. It is especially needed because
# artifacts from builds expire after 2 weeks and nightly builds fail
# current=133.0
- name: "Build for MetalK8s 133.0"
cron: "0 22 * * 1-5"
branch: "development/133.0"
workflow: "build.yaml"
# old=132.0
- name: "Build for MetalK8s 132.0"
cron: "0 22 * * 1-5"
branch: "development/132.0"
workflow: "build.yaml"
# Nightly jobs
# these helper comments are needed by the dev branch workflow
# please do not edit them unless you're changing the version as well
# current=133.0
- name: "Nightly for MetalK8s 133.0"
cron: "0 1 * * 1-5"
branch: "development/133.0"
workflow: "nightly.yaml"
# old=132.0
- name: "Nightly for MetalK8s 132.0"
cron: "0 2 * * 1-5"
branch: "development/132.0"
workflow: "nightly.yaml"
# Nightly retry jobs
# current=133.0
- name: "Retry Nightly for MetalK8s 133.0"
cron: "0 6 * * 1-5"
branch: "development/133.0"
workflow: "nightly.yaml"
type: "retry"
# old=132.0
- name: "Retry Nightly for MetalK8s 132.0"
cron: "0 6 * * 1-5"
branch: "development/132.0"
workflow: "nightly.yaml"
type: "retry"
steps:
- name: Checkout
if: github.event.schedule == matrix.cron
uses: actions/checkout@v6
- name: "Smart trigger for ${{ matrix.name }}"
if: github.event.schedule == matrix.cron && matrix.type != 'retry'
uses: scality/actions/actions-nightly-trigger@1.17.0
with:
branch: ${{ matrix.branch }}
workflow: ${{ matrix.workflow }}
access_token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: "Retry workflow for ${{ matrix.name }}"
id: retry
if: github.event.schedule == matrix.cron && matrix.type == 'retry'
uses: scality/actions/action-retry-workflow@1.17.0
with:
branch: ${{ matrix.branch }}
workflow: ${{ matrix.workflow }}
step-name: "Spawn cluster with Terraform"
max-retries: ${{ env.MAX_RETRIES }}
retry-mode: "failed-only"
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Slack on retry triggered
if: matrix.type == 'retry' && steps.retry.outputs.was-retried == 'true'
uses: slackapi/slack-github-action@v3
with:
channel-id: "#squad-metalk8s"
slack-message: |
Nightly retry triggered for ${{ matrix.branch }}
Job: ${{ matrix.name }}
Status: ${{ steps.retry.outputs.status }}
Retries performed: ${{ steps.retry.outputs.retry-count }}
Retried run: https://github.com/${{ github.repository }}/actions/runs/${{ steps.retry.outputs.run-id }}
Cron run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Notify Slack on manual action needed
if: matrix.type == 'retry' && steps.retry.outputs.retry-count != '' && fromJSON(steps.retry.outputs.retry-count) >= fromJSON(env.MAX_RETRIES)
uses: slackapi/slack-github-action@v3
with:
channel-id: "#squad-metalk8s"
slack-message: |
⚠️ MANUAL ACTION REQUIRED ⚠️
Nightly for ${{ matrix.branch }} failed after ${{ steps.retry.outputs.retry-count }} retry attempts
Job: ${{ matrix.name }}
Max retries (${{ env.MAX_RETRIES }}) exhausted - manual intervention needed
Workflow: ${{ matrix.workflow }}
Failed run: https://github.com/${{ github.repository }}/actions/runs/${{ steps.retry.outputs.run-id }}
Cron run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}