Assorted improvements for our platform EOL check code. (#14768)
* Fix typos in EOL check matrix generation. * Allow specifying a different name for distro for EOL check. If the `eol_check` property of a distro entry is a string, use that as the product name when querying https://endoflife.date/api * Add failure notifications for scheduled runs of EOL check workflow.
Austin S. Hemmelgarn committed
Mar 21, 2023 at 07:10 UTC
c0719b9f3a16091f4a48971bc16c0e63d0aab946
3 files changed
+56
-8
.github/data/distros.yml
+1
-1
@@ -76,7 +76,7 @@ include:
76
77
- distro: amazonlinux
78
version: "2"
79
- eol_check: false
79
+ eol_check: 'amazon-linux'
80
packages:
81
type: rpm
82
repo_distro: amazonlinux/2
.github/scripts/gen-matrix-eol-check.py
+7
-2
@@ -13,10 +13,15 @@ with open('.github/data/distros.yml') as f:
13
14
for item in data['include']:
15
if 'eol_check' in item and item['eol_check']:
16
+ if isinstance(item['eol_check'], str):
17
+ distro = item['eol_check']
18
+ else:
19
+ distro = item['distro']
20
+
21
entries.append({
17
- 'distro': item['distro'],
22
+ 'distro': distro,
23
'release': item['version'],
19
- 'full_name': f'{ item['distro'] } { item['version'] }'
24
+ 'full_name': f'{ item["distro"] } { item["version"] }'
25
})
26
27
entries.sort(key=lambda k: (k['distro'], k['release']))
.github/workflows/platform-eol-check.yml
+48
-5
@@ -33,6 +33,26 @@ jobs:
33
matrix="$(.github/scripts/gen-matrix-eol-check.py)"
34
echo "Generated matrix: ${matrix}"
35
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
36
+ - name: Failure Notification
37
+ uses: rtCamp/action-slack-notify@v2
38
+ env:
39
+ SLACK_COLOR: 'danger'
40
+ SLACK_FOOTER: ''
41
+ SLACK_ICON_EMOJI: ':github-actions:'
42
+ SLACK_TITLE: 'Failed to generate build matrix for platform EOL checks:'
43
+ SLACK_USERNAME: 'GitHub Actions'
44
+ SLACK_MESSAGE: |-
45
+ ${{ github.repository }}: Build matrix generation for scheduled platform EOL check has failed:
46
+ Checkout: ${{ steps.checkout.outcome }}
47
+ Prepare Tools: ${{ steps.prepare.outcome }}
48
+ Read Build Matrix: ${{ steps.set-matrix.outcome }}
49
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
50
+ if: >-
51
+ ${{
52
+ failure()
53
+ && github.event_name == 'schedule'
54
+ && github.repository == 'netdata/netdata'
55
+ }}
56
57
eol-check:
58
name: EOL Check
@@ -61,10 +81,10 @@ jobs:
81
;;
82
2)
83
echo "pending=false" >> "${GITHUB_OUTPUT}"
64
- echo "::info::No EOL information found for ${{ matrix.distro }} ${{ matrix.release }}"
84
+ echo "::info::No EOL information found for ${{ matrix.full_name }}"
85
;;
86
*)
67
- echo "::error::Failed to check EOL date for ${{ matrix.distro }} ${{ matrix.release }}"
87
+ echo "::error::Failed to check EOL date for ${{ matrix.full_name }}"
88
exit 1
89
;;
90
esac
@@ -76,9 +96,9 @@ jobs:
96
run: |
97
echo "title=[Platform EOL]: ${{ matrix.full_name }} will be EOL soon." >> "${GITHUB_OUTPUT}"
98
# Check if there is an existing issue in the repo for the platform EOL.
79
- # The actual command line to make the check is unfortunately complicated because
80
- # GitHub think that it’s sensible to exit with a status of 0 if there no results
81
- # for a search.
99
+ # The actual command line to make the check is unfortunately
100
+ # complicated because GitHub thinks that it’s sensible to exit
101
+ # with a status of 0 if there are no results for a search.
102
- name: Check for Existing Issue
103
id: existing
104
if: steps.check.outputs.pending == 'true'
@@ -108,3 +128,26 @@ jobs:
128
- [ ] Remove platform from `.github/data/distros.yml`
129
- [ ] Remove platform package builder from helper-images repo (if applicable).
130
- [ ] Verify any other platform support code that needs to be cleaned up.
131
+ # Send a notification to Slack if a job failed.
132
+ - name: Failure Notification
133
+ uses: rtCamp/action-slack-notify@v2
134
+ env:
135
+ SLACK_COLOR: 'danger'
136
+ SLACK_FOOTER: ''
137
+ SLACK_ICON_EMOJI: ':github-actions:'
138
+ SLACK_TITLE: 'Platform EOL check failed:'
139
+ SLACK_USERNAME: 'GitHub Actions'
140
+ SLACK_MESSAGE: |-
141
+ ${{ github.repository }}: A scheduled check for the EOL status of ${{ matrix.full_name }} has failed.
142
+ Checkout: ${{ steps.checkout.outcome }}
143
+ Check EOL Status: ${{ steps.check.outcome }}
144
+ Generate Issue Title: ${{ steps.title.outcome }}
145
+ Check for Existing Issue: ${{ steps.existing.outcome }}
146
+ Create Issue: ${{ steps.create-issue.outcome }}
147
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
148
+ if: >-
149
+ ${{
150
+ failure()
151
+ && github.event_name == 'schedule'
152
+ && github.repository == 'netdata/netdata'
153
+ }}