generate-integrations.yml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. pip install jsonschema referencing jinja2 ruamel.yaml
  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
  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.js
  64. branch: integrations-regen
  65. title: Regenerate integrations.js
  66. body: |
  67. Regenerate `integrations/integrations.js`, and documentation based on the
  68. latest code.
  69. This PR was auto-generated by
  70. `.github/workflows/generate-integrations.yml`.
  71. - name: Failure Notification
  72. uses: rtCamp/action-slack-notify@v2
  73. env:
  74. SLACK_COLOR: 'danger'
  75. SLACK_FOOTER: ''
  76. SLACK_ICON_EMOJI: ':github-actions:'
  77. SLACK_TITLE: 'Integrations regeneration failed:'
  78. SLACK_USERNAME: 'GitHub Actions'
  79. SLACK_MESSAGE: |-
  80. ${{ github.repository }}: Failed to create PR rebuilding integrations.js
  81. Checkout Agent: ${{ steps.checkout-agent.outcome }}
  82. Prep python env and deps: ${{ steps.prep-deps.outcome }}
  83. Generate Integrations: ${{ steps.generate.outcome }}
  84. Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }}
  85. Generate src/collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }}
  86. Clean Up Temporary Data: ${{ steps.clean.outcome }}
  87. Create PR: ${{ steps.create-pr.outcome }}
  88. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  89. if: >-
  90. ${{
  91. failure()
  92. && startsWith(github.ref, 'refs/heads/master')
  93. && github.repository == 'netdata/netdata'
  94. }}