Просмотр исходного кода

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 2 лет назад
Родитель
Сommit
c0719b9f3a

+ 1 - 1
.github/data/distros.yml

@@ -76,7 +76,7 @@ include:
 
 
   - distro: amazonlinux
   - distro: amazonlinux
     version: "2"
     version: "2"
-    eol_check: false
+    eol_check: 'amazon-linux'
     packages:
     packages:
       type: rpm
       type: rpm
       repo_distro: amazonlinux/2
       repo_distro: amazonlinux/2

+ 7 - 2
.github/scripts/gen-matrix-eol-check.py

@@ -13,10 +13,15 @@ with open('.github/data/distros.yml') as f:
 
 
 for item in data['include']:
 for item in data['include']:
     if 'eol_check' in item and item['eol_check']:
     if 'eol_check' in item and item['eol_check']:
+        if isinstance(item['eol_check'], str):
+            distro = item['eol_check']
+        else:
+            distro = item['distro']
+
         entries.append({
         entries.append({
-            'distro': item['distro'],
+            'distro': distro,
             'release': item['version'],
             'release': item['version'],
-            'full_name': f'{ item['distro'] } { item['version'] }'
+            'full_name': f'{ item["distro"] } { item["version"] }'
         })
         })
 
 
 entries.sort(key=lambda k: (k['distro'], k['release']))
 entries.sort(key=lambda k: (k['distro'], k['release']))

+ 48 - 5
.github/workflows/platform-eol-check.yml

@@ -33,6 +33,26 @@ jobs:
           matrix="$(.github/scripts/gen-matrix-eol-check.py)"
           matrix="$(.github/scripts/gen-matrix-eol-check.py)"
           echo "Generated matrix: ${matrix}"
           echo "Generated matrix: ${matrix}"
           echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
           echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
+      - name: Failure Notification
+        uses: rtCamp/action-slack-notify@v2
+        env:
+          SLACK_COLOR: 'danger'
+          SLACK_FOOTER: ''
+          SLACK_ICON_EMOJI: ':github-actions:'
+          SLACK_TITLE: 'Failed to generate build matrix for platform EOL checks:'
+          SLACK_USERNAME: 'GitHub Actions'
+          SLACK_MESSAGE: |-
+              ${{ github.repository }}: Build matrix generation for scheduled platform EOL check has failed:
+              Checkout: ${{ steps.checkout.outcome }}
+              Prepare Tools: ${{ steps.prepare.outcome }}
+              Read Build Matrix: ${{ steps.set-matrix.outcome }}
+          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+        if: >-
+          ${{
+            failure()
+            && github.event_name == 'schedule'
+            && github.repository == 'netdata/netdata'
+          }}
 
 
   eol-check:
   eol-check:
     name: EOL Check
     name: EOL Check
@@ -61,10 +81,10 @@ jobs:
               ;;
               ;;
             2)
             2)
               echo "pending=false" >> "${GITHUB_OUTPUT}"
               echo "pending=false" >> "${GITHUB_OUTPUT}"
-              echo "::info::No EOL information found for ${{ matrix.distro }} ${{ matrix.release }}"
+              echo "::info::No EOL information found for ${{ matrix.full_name }}"
               ;;
               ;;
             *)
             *)
-              echo "::error::Failed to check EOL date for ${{ matrix.distro }} ${{ matrix.release }}"
+              echo "::error::Failed to check EOL date for ${{ matrix.full_name }}"
               exit 1
               exit 1
               ;;
               ;;
           esac
           esac
@@ -76,9 +96,9 @@ jobs:
         run: |
         run: |
           echo "title=[Platform EOL]: ${{ matrix.full_name }} will be EOL soon." >> "${GITHUB_OUTPUT}"
           echo "title=[Platform EOL]: ${{ matrix.full_name }} will be EOL soon." >> "${GITHUB_OUTPUT}"
       # Check if there is an existing issue in the repo for the platform EOL.
       # Check if there is an existing issue in the repo for the platform EOL.
-      # The actual command line to make the check is unfortunately complicated because
-      # GitHub think that it’s sensible to exit with a status of 0 if there no results
-      # for a search.
+      # The actual command line to make the check is unfortunately
+      # complicated because GitHub thinks that it’s sensible to exit
+      # with a status of 0 if there are no results for a search.
       - name: Check for Existing Issue
       - name: Check for Existing Issue
         id: existing
         id: existing
         if: steps.check.outputs.pending == 'true'
         if: steps.check.outputs.pending == 'true'
@@ -108,3 +128,26 @@ jobs:
             - [ ] Remove platform from `.github/data/distros.yml`
             - [ ] Remove platform from `.github/data/distros.yml`
             - [ ] Remove platform package builder from helper-images repo (if applicable).
             - [ ] Remove platform package builder from helper-images repo (if applicable).
             - [ ] Verify any other platform support code that needs to be cleaned up.
             - [ ] Verify any other platform support code that needs to be cleaned up.
+      # Send a notification to Slack if a job failed.
+      - name: Failure Notification
+        uses: rtCamp/action-slack-notify@v2
+        env:
+          SLACK_COLOR: 'danger'
+          SLACK_FOOTER: ''
+          SLACK_ICON_EMOJI: ':github-actions:'
+          SLACK_TITLE: 'Platform EOL check failed:'
+          SLACK_USERNAME: 'GitHub Actions'
+          SLACK_MESSAGE: |-
+              ${{ github.repository }}: A scheduled check for the EOL status of ${{ matrix.full_name }} has failed.
+              Checkout: ${{ steps.checkout.outcome }}
+              Check EOL Status: ${{ steps.check.outcome }}
+              Generate Issue Title: ${{ steps.title.outcome }}
+              Check for Existing Issue: ${{ steps.existing.outcome }}
+              Create Issue: ${{ steps.create-issue.outcome }}
+          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+        if: >-
+          ${{
+            failure()
+            && github.event_name == 'schedule'
+            && github.repository == 'netdata/netdata'
+          }}