generate-integrations.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. - 'collectors/**/metadata.yaml'
  10. - 'exporting/**/metadata.yaml'
  11. - 'health/notifications/**/metadata.yaml'
  12. - 'integrations/templates/**'
  13. - 'integrations/categories.yaml'
  14. - 'integrations/deploy.yaml'
  15. - 'integrations/cloud-notifications/metadata.yaml'
  16. - 'integrations/gen_integrations.py'
  17. - 'packaging/go.d.version'
  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: Get Go Ref
  35. id: get-go-ref
  36. run: echo "go_ref=$(cat packaging/go.d.version)" >> "${GITHUB_ENV}"
  37. - name: Checkout Go
  38. id: checkout-go
  39. uses: actions/checkout@v4
  40. with:
  41. fetch-depth: 1
  42. path: go.d.plugin
  43. repository: netdata/go.d.plugin
  44. ref: ${{ env.go_ref }}
  45. - name: Prepare Dependencies
  46. id: prep-deps
  47. run: |
  48. sudo apt-get install python3-venv
  49. python3 -m venv ./virtualenv
  50. source ./virtualenv/bin/activate
  51. pip install jsonschema referencing jinja2 ruamel.yaml
  52. - name: Generate Integrations
  53. id: generate
  54. run: |
  55. source ./virtualenv/bin/activate
  56. python3 integrations/gen_integrations.py
  57. - name: Generate Integrations Documentation
  58. id: generate-integrations-documentation
  59. run: |
  60. python3 integrations/gen_docs_integrations.py
  61. - name: Generate collectors/COLLECTORS.md
  62. id: generate-collectors-md
  63. run: |
  64. python3 integrations/gen_doc_collector_page.py
  65. - name: Clean Up Temporary Data
  66. id: clean
  67. run: rm -rf go.d.plugin virtualenv
  68. - name: Create PR
  69. id: create-pr
  70. uses: peter-evans/create-pull-request@v5
  71. with:
  72. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  73. commit-message: Regenerate integrations.js
  74. branch: integrations-regen
  75. title: Regenerate integrations.js
  76. body: |
  77. Regenerate `integrations/integrations.js`, and documentation based on the
  78. latest code.
  79. This PR was auto-generated by
  80. `.github/workflows/generate-integrations.yml`.
  81. - name: Failure Notification
  82. uses: rtCamp/action-slack-notify@v2
  83. env:
  84. SLACK_COLOR: 'danger'
  85. SLACK_FOOTER: ''
  86. SLACK_ICON_EMOJI: ':github-actions:'
  87. SLACK_TITLE: 'Integrations regeneration failed:'
  88. SLACK_USERNAME: 'GitHub Actions'
  89. SLACK_MESSAGE: |-
  90. ${{ github.repository }}: Failed to create PR rebuilding integrations.js
  91. Checkout Agent: ${{ steps.checkout-agent.outcome }}
  92. Get Go Ref: ${{ steps.get-go-ref.outcome }}
  93. Checkout Go: ${{ steps.checkout-go.outcome }}
  94. Prepare Dependencies: ${{ steps.prep-deps.outcome }}
  95. Generate Integrations: ${{ steps.generate.outcome }}
  96. Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }}
  97. Generate collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }}
  98. Clean Up Temporary Data: ${{ steps.clean.outcome }}
  99. Create PR: ${{ steps.create-pr.outcome }}
  100. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  101. if: >-
  102. ${{
  103. failure()
  104. && startsWith(github.ref, 'refs/heads/master')
  105. && github.repository == 'netdata/netdata'
  106. }}