platform-eol-check.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ---
  2. # Auto-generate issues for EOL of platforms that are approaching their EOL date.
  3. # Uses https://endoflife.date and their new API to check for EOL dates.
  4. #
  5. # Issues are created when the EOL date is within the next 30 days.
  6. name: Check Platform EOL
  7. on: # Run weekly and whenever manually triggered
  8. schedule:
  9. - cron: '0 3 * * 1'
  10. workflow_dispatch: null
  11. concurrency: # Simple single-instance concurrency.
  12. group: eol-check-${{ github.repository }}
  13. cancel-in-progress: true
  14. jobs:
  15. # Prepare the build matrix.
  16. # This uses output from .github/scripts/gen-matrix-eol-check.py
  17. matrix:
  18. name: Prepare Build Matrix
  19. runs-on: ubuntu-latest
  20. outputs:
  21. matrix: ${{ steps.set-matrix.outputs.matrix }}
  22. steps:
  23. - name: Checkout
  24. id: checkout
  25. uses: actions/checkout@v4
  26. - name: Prepare tools
  27. id: prepare
  28. run: |
  29. sudo apt-get update || true
  30. sudo apt-get install -y python3-ruamel.yaml
  31. - name: Read build matrix
  32. id: set-matrix
  33. run: |
  34. matrix="$(.github/scripts/gen-matrix-eol-check.py)"
  35. echo "Generated matrix: ${matrix}"
  36. echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
  37. - name: Failure Notification
  38. uses: rtCamp/action-slack-notify@v2
  39. env:
  40. SLACK_COLOR: 'danger'
  41. SLACK_FOOTER: ''
  42. SLACK_ICON_EMOJI: ':github-actions:'
  43. SLACK_TITLE: 'Failed to generate build matrix for platform EOL checks:'
  44. SLACK_USERNAME: 'GitHub Actions'
  45. SLACK_MESSAGE: |-
  46. ${{ github.repository }}: Build matrix generation for scheduled platform EOL check has failed:
  47. Checkout: ${{ steps.checkout.outcome }}
  48. Prepare Tools: ${{ steps.prepare.outcome }}
  49. Read Build Matrix: ${{ steps.set-matrix.outcome }}
  50. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  51. if: >-
  52. ${{
  53. failure()
  54. && github.event_name == 'schedule'
  55. && github.repository == 'netdata/netdata'
  56. }}
  57. eol-check:
  58. name: EOL Check
  59. runs-on: ubuntu-latest
  60. needs:
  61. - matrix
  62. strategy:
  63. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  64. fail-fast: false # We want to check everything, so don’t bail on the first failure.
  65. max-parallel: 2 # Cap of two jobs at a time to limit impact on other CI.
  66. steps:
  67. - name: Checkout
  68. id: checkout
  69. uses: actions/checkout@v4
  70. # Actually check the EOL date for the platform.
  71. - name: Check EOL Date
  72. id: check
  73. shell: sh {0}
  74. run: |
  75. d="$(.github/scripts/platform-impending-eol.py ${{ matrix.distro }} ${{ matrix.release }} ${{ matrix.lts }})"
  76. case $? in
  77. 0) echo "pending=false" >> "${GITHUB_OUTPUT}" ;;
  78. 1)
  79. echo "pending=true" >> "${GITHUB_OUTPUT}"
  80. echo "date=${d}" >> "${GITHUB_OUTPUT}"
  81. ;;
  82. 2)
  83. echo "pending=false" >> "${GITHUB_OUTPUT}"
  84. echo "::info::No EOL information found for ${{ matrix.full_name }}"
  85. ;;
  86. *)
  87. echo "::error::Failed to check EOL date for ${{ matrix.full_name }}"
  88. exit 1
  89. ;;
  90. esac
  91. # Figure out the issue title.
  92. # This is it’s own step so we only have to set it in one place.
  93. - name: Determine Issue Title
  94. id: title
  95. if: steps.check.outputs.pending == 'true'
  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.
  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'
  105. env:
  106. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  107. run: |
  108. set -e
  109. count=$(gh issue list -R netdata/netdata -s all -S '${{ steps.title.outputs.title }} in:title' --json 'id' -q '. | length')
  110. if [ "${count}" -ge 1 ]; then
  111. echo 'exists=true' >> "${GITHUB_OUTPUT}"
  112. else
  113. echo 'exists=false' >> "${GITHUB_OUTPUT}"
  114. fi
  115. # If the platform is near EOL and there is no existing issue, create one.
  116. - name: Create EOL Issue
  117. id: create-issue
  118. if: steps.check.outputs.pending == 'true' && steps.existing.outputs.exists == 'false'
  119. uses: imjohnbo/issue-bot@v3
  120. with:
  121. assignees: Ferroin
  122. labels: area/packaging, needs triage
  123. title: ${{ steps.title.outputs.title }}
  124. body: |
  125. Based on information from https://endoflife.date/${{ matrix.distro }}, upstream support for ${{ matrix.full_name }} will be ending on ${{ steps.check.outputs.date }}. A PR should be created to remove this platform from our platform support document, CI, and packaging code.
  126. - [ ] Remove platform from `packaging/PLATFORM_SUPPORT.md`
  127. - [ ] Remove platform from `.github/data/distros.yml`
  128. - [ ] Remove platform package builder from helper-images repo (if applicable).
  129. - [ ] Verify any other platform support code that needs to be cleaned up.
  130. # Send a notification to Slack if a job failed.
  131. - name: Failure Notification
  132. uses: rtCamp/action-slack-notify@v2
  133. env:
  134. SLACK_COLOR: 'danger'
  135. SLACK_FOOTER: ''
  136. SLACK_ICON_EMOJI: ':github-actions:'
  137. SLACK_TITLE: 'Platform EOL check failed:'
  138. SLACK_USERNAME: 'GitHub Actions'
  139. SLACK_MESSAGE: |-
  140. ${{ github.repository }}: A scheduled check for the EOL status of ${{ matrix.full_name }} has failed.
  141. Checkout: ${{ steps.checkout.outcome }}
  142. Check EOL Status: ${{ steps.check.outcome }}
  143. Generate Issue Title: ${{ steps.title.outcome }}
  144. Check for Existing Issue: ${{ steps.existing.outcome }}
  145. Create Issue: ${{ steps.create-issue.outcome }}
  146. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  147. if: >-
  148. ${{
  149. failure()
  150. && github.event_name == 'schedule'
  151. && github.repository == 'netdata/netdata'
  152. }}