master
yml 125 lines 5.02 KB
Raw
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/crates/**/metadata.yaml'
11 - 'src/go/plugin/**/metadata.yaml'
12 - '**/taxonomy.yaml'
13 - 'src/exporting/**/metadata.yaml'
14 - 'src/health/notifications/**/metadata.yaml'
15 - 'integrations/taxonomy/**'
16 - 'integrations/templates/**'
17 - 'integrations/schemas/**'
18 - 'integrations/categories.yaml'
19 - 'integrations/deploy.yaml'
20 - 'integrations/cloud-notifications/metadata.yaml'
21 - 'integrations/cloud-authentication/metadata.yaml'
22 - 'integrations/_common.py'
23 - 'integrations/gen_integrations.py'
24 - 'integrations/gen_taxonomy.py'
25 - 'integrations/gen_taxonomy_seed.py'
26 - 'integrations/check_collector_taxonomy.py'
27 - 'integrations/tests/**'
28 - 'integrations/gen_docs_integrations.py'
29 - 'integrations/gen_doc_collector_page.py'
30 - 'integrations/gen_doc_secrets_page.py'
31 workflow_dispatch: null
32 concurrency: # This keeps multiple instances of the job from running concurrently for the same ref.
33 group: integrations-${{ github.ref }}
34 cancel-in-progress: true
35 jobs:
36 generate-integrations:
37 name: Generate Integrations
38 runs-on: ubuntu-latest
39 if: github.repository == 'netdata/netdata'
40 steps:
41 - name: Checkout Agent
42 id: checkout-agent
43 uses: actions/checkout@v6
44 with:
45 fetch-depth: 1
46 submodules: recursive
47 - name: Prepare Dependencies
48 id: prep-deps
49 run: |
50 sudo apt-get install python3-venv
51 python3 -m venv ./virtualenv
52 source ./virtualenv/bin/activate
53 ./integrations/pip.sh
54 - name: Generate Integrations
55 id: generate
56 run: |
57 source ./virtualenv/bin/activate
58 python3 integrations/gen_integrations.py
59 - name: Generate Collector Taxonomy
60 id: generate-taxonomy
61 run: |
62 source ./virtualenv/bin/activate
63 python3 integrations/gen_taxonomy.py
64 - name: Test Collector Taxonomy Tooling
65 id: test-taxonomy
66 run: |
67 source ./virtualenv/bin/activate
68 python3 -m unittest integrations.tests.test_taxonomy
69 - name: Generate Integrations Documentation
70 id: generate-integrations-documentation
71 run: |
72 python3 integrations/gen_docs_integrations.py
73 - name: Generate src/collectors/COLLECTORS.md
74 id: generate-collectors-md
75 run: |
76 python3 integrations/gen_doc_collector_page.py
77 - name: Generate src/collectors/SECRETS.md
78 id: generate-secrets-md
79 run: |
80 python3 integrations/gen_doc_secrets_page.py
81 - name: Clean Up Temporary Data
82 id: clean
83 run: rm -rf go.d.plugin virtualenv integrations/integrations.js integrations/integrations.json integrations/taxonomy.json
84 - name: Create PR
85 id: create-pr
86 uses: peter-evans/create-pull-request@v8
87 with:
88 token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
89 commit-message: Regenerate integrations docs
90 branch: integrations-regen
91 title: Regenerate integrations docs
92 labels: integrations-update
93 body: |
94 Regenerate the integrations docs based on the
95 latest metadata yaml code.
96
97 This PR was auto-generated by
98 `.github/workflows/generate-integrations.yml`.
99 - name: Failure Notification
100 uses: rtCamp/action-slack-notify@v2
101 env:
102 SLACK_COLOR: 'danger'
103 SLACK_FOOTER: ''
104 SLACK_ICON_EMOJI: ':github-actions:'
105 SLACK_TITLE: 'Integrations regeneration failed:'
106 SLACK_USERNAME: 'GitHub Actions'
107 SLACK_MESSAGE: |-
108 ${{ github.repository }}: Failed to create PR rebuilding integrations.js
109 Checkout Agent: ${{ steps.checkout-agent.outcome }}
110 Prep python env and deps: ${{ steps.prep-deps.outcome }}
111 Generate Integrations: ${{ steps.generate.outcome }}
112 Generate Collector Taxonomy: ${{ steps.generate-taxonomy.outcome }}
113 Test Collector Taxonomy Tooling: ${{ steps.test-taxonomy.outcome }}
114 Generate Integrations Documentation: ${{ steps.generate-integrations-documentation.outcome }}
115 Generate src/collectors/COLLECTORS.md: ${{ steps.generate-collectors-md.outcome }}
116 Generate src/collectors/SECRETS.md: ${{ steps.generate-secrets-md.outcome }}
117 Clean Up Temporary Data: ${{ steps.clean.outcome }}
118 Create PR: ${{ steps.create-pr.outcome }}
119 SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
120 if: >-
121 ${{
122 failure()
123 && startsWith(github.ref, 'refs/heads/master')
124 && github.repository == 'netdata/netdata'
125 }}