generate-integrations.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ---
  2. # CI workflow used to regenerate `integrations/integrations.js` and accompanying documentation when relevant source files are changed.
  3. name: Generate Integrations
  4. on:
  5. push:
  6. branches:
  7. - master
  8. paths: # If any of these files change, we need to regenerate integrations.js.
  9. - 'src/collectors/**/metadata.yaml'
  10. - 'src/go/plugin/**/metadata.yaml'
  11. - 'src/exporting/**/metadata.yaml'
  12. - 'src/health/notifications/**/metadata.yaml'
  13. - 'integrations/templates/**'
  14. - 'integrations/categories.yaml'
  15. - 'integrations/deploy.yaml'
  16. - 'integrations/cloud-notifications/metadata.yaml'
  17. - 'integrations/cloud-authentication/metadata.yaml'
  18. - 'integrations/gen_integrations.py'
  19. workflow_dispatch: null
  20. concurrency: # This keeps multiple instances of the job from running concurrently for the same ref.
  21. group: integrations-${{ github.ref }}
  22. cancel-in-progress: true
  23. jobs:
  24. generate-integrations:
  25. name: Generate Integrations
  26. runs-on: ubuntu-latest
  27. if: github.repository == 'netdata/netdata'
  28. steps:
  29. - name: Checkout Agent
  30. id: checkout-agent
  31. uses: actions/checkout@v4
  32. with:
  33. fetch-depth: 1
  34. submodules: recursive
  35. - name: Prepare Dependencies
  36. id: prep-deps
  37. run: |
  38. sudo apt-get install python3-venv
  39. python3 -m venv ./virtualenv
  40. source ./virtualenv/bin/activate
  41. ./integrations/pip.sh
  42. - name: Generate Integrations
  43. id: generate
  44. run: |
  45. source ./virtualenv/bin/activate
  46. python3 integrations/gen_integrations.py
  47. - name: Generate Integrations Documentation
  48. id: generate-integrations-documentation
  49. run: |
  50. python3 integrations/gen_docs_integrations.py
  51. - name: Generate src/collectors/COLLECTORS.md
  52. id: generate-collectors-md
  53. run: |
  54. python3 integrations/gen_doc_collector_page.py
  55. - name: Clean Up Temporary Data
  56. id: clean
  57. run: rm -rf go.d.plugin virtualenv integrations/integrations.js integrations/integrations.json
  58. - name: Create PR
  59. id: create-pr
  60. uses: peter-evans/create-pull-request@v7
  61. with:
  62. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  63. commit-message: Regenerate integrations docs
  64. branch: integrations-regen
  65. title: Regenerate integrations docs
  66. labels: integrations-update
  67. body: |
  68. Regenerate the integrations docs based on the
  69. latest metadata yaml code.
  70. This PR was auto-generated by
  71. `.github/workflows/generate-integrations.yml`.
  72. - name: Failure Notification
  73. uses: rtCamp/action-slack-notify@v2
  74. env:
  75. SLACK_COLOR: 'danger'
  76. SLACK_FOOTER: ''
  77. SLACK_ICON_EMOJI: ':github-actions:'
  78. SLACK_TITLE: 'Integrations regeneration failed:'
  79. SLACK_USERNAME: 'GitHub Actions'
  80. SLACK_MESSAGE: |-
  81. ${{ github.repository }}: Failed to create PR rebuilding integrations.js
  82. Checkout Agent: ${{ steps.checkout-agent.outcome }}
  83. Prep python env and deps: ${{ steps.prep-deps.outcome }}
  84. Generate Integrations: ${{ steps.generate.outcome }}
  85. Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }}
  86. Generate src/collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }}
  87. Clean Up Temporary Data: ${{ steps.clean.outcome }}
  88. Create PR: ${{ steps.create-pr.outcome }}
  89. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  90. if: >-
  91. ${{
  92. failure()
  93. && startsWith(github.ref, 'refs/heads/master')
  94. && github.repository == 'netdata/netdata'
  95. }}