generate-integrations.yml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/collectors/**/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/gen_integrations.py'
  18. workflow_dispatch: null
  19. concurrency: # This keeps multiple instances of the job from running concurrently for the same ref.
  20. group: integrations-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. generate-integrations:
  24. name: Generate Integrations
  25. runs-on: ubuntu-latest
  26. if: github.repository == 'netdata/netdata'
  27. steps:
  28. - name: Checkout Agent
  29. id: checkout-agent
  30. uses: actions/checkout@v4
  31. with:
  32. fetch-depth: 1
  33. submodules: recursive
  34. - name: Prepare Dependencies
  35. id: prep-deps
  36. run: |
  37. sudo apt-get install python3-venv
  38. python3 -m venv ./virtualenv
  39. source ./virtualenv/bin/activate
  40. pip install jsonschema referencing jinja2 ruamel.yaml
  41. - name: Generate Integrations
  42. id: generate
  43. run: |
  44. source ./virtualenv/bin/activate
  45. python3 integrations/gen_integrations.py
  46. - name: Generate Integrations Documentation
  47. id: generate-integrations-documentation
  48. run: |
  49. python3 integrations/gen_docs_integrations.py
  50. - name: Generate src/collectors/COLLECTORS.md
  51. id: generate-collectors-md
  52. run: |
  53. python3 integrations/gen_doc_collector_page.py
  54. - name: Clean Up Temporary Data
  55. id: clean
  56. run: rm -rf go.d.plugin virtualenv
  57. - name: Create PR
  58. id: create-pr
  59. uses: peter-evans/create-pull-request@v6
  60. with:
  61. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  62. commit-message: Regenerate integrations.js
  63. branch: integrations-regen
  64. title: Regenerate integrations.js
  65. body: |
  66. Regenerate `integrations/integrations.js`, and documentation based on the
  67. latest code.
  68. This PR was auto-generated by
  69. `.github/workflows/generate-integrations.yml`.
  70. - name: Failure Notification
  71. uses: rtCamp/action-slack-notify@v2
  72. env:
  73. SLACK_COLOR: 'danger'
  74. SLACK_FOOTER: ''
  75. SLACK_ICON_EMOJI: ':github-actions:'
  76. SLACK_TITLE: 'Integrations regeneration failed:'
  77. SLACK_USERNAME: 'GitHub Actions'
  78. SLACK_MESSAGE: |-
  79. ${{ github.repository }}: Failed to create PR rebuilding integrations.js
  80. Checkout Agent: ${{ steps.checkout-agent.outcome }}
  81. Prep python env and deps: ${{ steps.prep-deps.outcome }}
  82. Generate Integrations: ${{ steps.generate.outcome }}
  83. Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }}
  84. Generate src/collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }}
  85. Clean Up Temporary Data: ${{ steps.clean.outcome }}
  86. Create PR: ${{ steps.create-pr.outcome }}
  87. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  88. if: >-
  89. ${{
  90. failure()
  91. && startsWith(github.ref, 'refs/heads/master')
  92. && github.repository == 'netdata/netdata'
  93. }}