platform-eol-check.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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@v3
  26. - name: Prepare tools
  27. id: prepare
  28. run: |
  29. sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
  30. - name: Read build matrix
  31. id: set-matrix
  32. run: |
  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. eol-check:
  57. name: EOL Check
  58. runs-on: ubuntu-latest
  59. needs:
  60. - matrix
  61. strategy:
  62. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  63. fail-fast: false # We want to check everything, so don’t bail on the first failure.
  64. max-parallel: 2 # Cap of two jobs at a time to limit impact on other CI.
  65. steps:
  66. - name: Checkout
  67. id: checkout
  68. uses: actions/checkout@v3
  69. # Actually check the EOL date for the platform.
  70. - name: Check EOL Date
  71. id: check
  72. shell: sh {0}
  73. run: |
  74. d="$(.github/scripts/platform-impending-eol.py ${{ matrix.distro }} ${{ matrix.release }})"
  75. case $? in
  76. 0) echo "pending=false" >> "${GITHUB_OUTPUT}" ;;
  77. 1)
  78. echo "pending=true" >> "${GITHUB_OUTPUT}"
  79. echo "date=${d}" >> "${GITHUB_OUTPUT}"
  80. ;;
  81. 2)
  82. echo "pending=false" >> "${GITHUB_OUTPUT}"
  83. echo "::info::No EOL information found for ${{ matrix.full_name }}"
  84. ;;
  85. *)
  86. echo "::error::Failed to check EOL date for ${{ matrix.full_name }}"
  87. exit 1
  88. ;;
  89. esac
  90. # Figure out the issue title.
  91. # This is it’s own step so we only have to set it in one place.
  92. - name: Determine Issue Title
  93. id: title
  94. if: steps.check.outputs.pending == 'true'
  95. run: |
  96. echo "title=[Platform EOL]: ${{ matrix.full_name }} will be EOL soon." >> "${GITHUB_OUTPUT}"
  97. # Check if there is an existing issue in the repo for the platform EOL.
  98. # The actual command line to make the check is unfortunately
  99. # complicated because GitHub thinks that it’s sensible to exit
  100. # with a status of 0 if there are no results for a search.
  101. - name: Check for Existing Issue
  102. id: existing
  103. if: steps.check.outputs.pending == 'true'
  104. env:
  105. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  106. run: |
  107. set -e
  108. count=$(gh issue list -R netdata/netdata -s all -S '${{ steps.title.outputs.title }} in:title' --json 'id' -q '. | length')
  109. if [ "${count}" -ge 1 ]; then
  110. echo 'exists=true' >> "${GITHUB_OUTPUT}"
  111. else
  112. echo 'exists=false' >> "${GITHUB_OUTPUT}"
  113. fi
  114. # If the platform is near EOL and there is no existing issue, create one.
  115. - name: Create EOL Issue
  116. id: create-issue
  117. if: steps.check.outputs.pending == 'true' && steps.existing.outputs.exists == 'false'
  118. uses: imjohnbo/issue-bot@v3
  119. with:
  120. assignees: Ferroin, tkatsoulas
  121. labels: area/packaging, needs triage
  122. title: ${{ steps.title.outputs.title }}
  123. body: |
  124. 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.
  125. - [ ] Remove platform from `packaging/PLATFORM_SUPPORT.md`
  126. - [ ] Remove platform from `.github/data/distros.yml`
  127. - [ ] Remove platform package builder from helper-images repo (if applicable).
  128. - [ ] Verify any other platform support code that needs to be cleaned up.
  129. # Send a notification to Slack if a job failed.
  130. - name: Failure Notification
  131. uses: rtCamp/action-slack-notify@v2
  132. env:
  133. SLACK_COLOR: 'danger'
  134. SLACK_FOOTER: ''
  135. SLACK_ICON_EMOJI: ':github-actions:'
  136. SLACK_TITLE: 'Platform EOL check failed:'
  137. SLACK_USERNAME: 'GitHub Actions'
  138. SLACK_MESSAGE: |-
  139. ${{ github.repository }}: A scheduled check for the EOL status of ${{ matrix.full_name }} has failed.
  140. Checkout: ${{ steps.checkout.outcome }}
  141. Check EOL Status: ${{ steps.check.outcome }}
  142. Generate Issue Title: ${{ steps.title.outcome }}
  143. Check for Existing Issue: ${{ steps.existing.outcome }}
  144. Create Issue: ${{ steps.create-issue.outcome }}
  145. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  146. if: >-
  147. ${{
  148. failure()
  149. && github.event_name == 'schedule'
  150. && github.repository == 'netdata/netdata'
  151. }}