-
Notifications
You must be signed in to change notification settings - Fork 302
242 lines (214 loc) · 8.13 KB
/
generic-plugins.yml
File metadata and controls
242 lines (214 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Generic Plugins
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- 'rust-plugins/**'
push:
branches:
- develop
- master
paths:
- 'rust-plugins/**'
jobs:
dependency-scan:
uses: centreon/security-tools/.github/workflows/dependency-analysis.yml@main
get-environment:
needs: [dependency-scan]
uses: ./.github/workflows/get-environment.yml
with:
version_file: rust-plugins/Cargo.toml
build:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable' &&
! cancelled()
runs-on: ubuntu-24.04
name: "Build the generic plugins"
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Unit tests
run: |
cd rust-plugins
cargo test
shell: bash
- name: Build optimized binary
run: |
cd rust-plugins
cargo build --release
shell: bash
- name: Save binary to cache
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: rust-plugins/target/release/
key: ${{ github.sha }}-${{ github.run_id }}-build-generic-plugins
package:
needs: [get-environment, build]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable' &&
! cancelled()
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- package_extension: rpm
image: packaging-plugins-alma8
distrib: el8
arch: x86_64
- package_extension: rpm
image: packaging-plugins-alma9
distrib: el9
arch: x86_64
- package_extension: rpm
image: packaging-plugins-alma10
distrib: el10
arch: x86_64
- package_extension: deb
image: packaging-plugins-bullseye
distrib: bullseye
arch: amd64
- package_extension: deb
image: packaging-plugins-bookworm
distrib: bookworm
arch: amd64
- package_extension: deb
image: packaging-plugins-trixie
distrib: trixie
arch: amd64
- package_extension: deb
image: packaging-plugins-jammy
distrib: jammy
arch: amd64
- package_extension: deb
image: packaging-plugins-noble
distrib: noble
arch: amd64
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: Package ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Restore binary from cache
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: rust-plugins/target/release/
key: ${{ github.sha }}-${{ github.run_id }}-build-generic-plugins
fail-on-cache-miss: true
- name: Build package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "rust-plugins/packaging/centreon-generic-plugins.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
version: ${{ needs.get-environment.outputs.version }}
release: 1
arch: ${{ matrix.arch }}
commit_hash: ${{ github.sha }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-generic-plugins-${{ matrix.distrib }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
- name: Save to cache
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ./*.${{ matrix.package_extension }}
key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
test-generic-plugins:
needs: [get-environment, build]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable' &&
! cancelled()
runs-on: ubuntu-24.04
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/testing-plugins-bookworm
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
name: Run robot tests
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Restore binary from cache
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: rust-plugins/target/release/
key: ${{ github.sha }}-${{ github.run_id }}-build-generic-plugins
fail-on-cache-miss: true
- name: Setup SNMP simulator and run robot tests
run: |
mkdir -p /var/lib/snmp/cert_indexes/
useradd snmp || true
snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests' &
sleep 2
robot --include centreon-generic-snmp --exclude notauto --outputdir /tmp/robot-tests ./tests/os/linux/snmp/
shell: bash
- name: Upload logs as artifacts if tests failed
if: failure()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-generic-plugins-log
path: /tmp/robot-tests
retention-days: 1
deliver-packages:
needs: [get-environment, build, package, test-generic-plugins]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
(contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- distrib: el8
package_extension: rpm
- distrib: el9
package_extension: rpm
- distrib: el10
package_extension: rpm
- distrib: bullseye
package_extension: deb
- distrib: bookworm
package_extension: deb
- distrib: trixie
package_extension: deb
- distrib: jammy
package_extension: deb
- distrib: noble
package_extension: deb
name: deliver ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Delivery
uses: ./.github/actions/package-delivery
with:
module_name: generic-plugins
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
set-skip-label:
needs: [get-environment, deliver-packages]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml