-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
396 lines (358 loc) · 9.93 KB
/
.gitlab-ci.yml
File metadata and controls
396 lines (358 loc) · 9.93 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
image: ${REGISTRY_DOCKER_URL}/stackstate/stackstate-agent-integrations-runner:20241120-py311
stages:
- build
- test
- publish
variables:
CONDA_ENV: "stackstate-agent-integrations-py-3"
PYTHON_VERSION: 3.11.14
.rules:
- &pull_requests
if: $CI_EXTERNAL_PULL_REQUEST_IID
- &base_changes
if: $CI_EXTERNAL_PULL_REQUEST_IID
changes:
- stackstate_checks_base/*
- stackstate_checks_base/**/*
- stackstate_checks_dev/*
- stackstate_checks_dev/**/*
- stackstate_checks_tests_helper/*
- stackstate_checks_tests_helper/**/*
- .gitlab-ci.yml
- $CHECK/*
- $CHECK/**/*
- &master_branch
if: '$CI_COMMIT_BRANCH == "stackstate-7.51.1"'
- &release_branch
if: $CI_COMMIT_TAG
- &base_manual_changes
if: $CI_EXTERNAL_PULL_REQUEST_IID
changes:
- stackstate_checks_base/*
- stackstate_checks_base/**/*
- stackstate_checks_dev/*
- stackstate_checks_dev/**/*
- stackstate_checks_tests_helper/*
- stackstate_checks_tests_helper/**/*
- .gitlab-ci.yml
- $CHECK/*
- $CHECK/**/*
when: manual
allow_failure: true
- &splunk_base_build_rule
if: $CI_EXTERNAL_PULL_REQUEST_IID
changes:
- splunk_base/*
- splunk_base/**/*
- &master_manual_branch
if: '$CI_COMMIT_BRANCH == "stackstate-7.51.1"'
when: manual
allow_failure: true
- &release_manual_branch
if: $CI_COMMIT_TAG
when: manual
allow_failure: true
.base_integration_rules:
&base_integration_rules
rules:
- <<: *base_changes
- <<: *master_branch
- <<: *release_branch
.base_splunk_integration_rules:
&base_splunk_integration_rules
rules:
- <<: *base_changes
- <<: *master_branch
- <<: *release_branch
- <<: *splunk_base_build_rule
.base_integration_manual_rules:
&base_integration_manual_rules
rules:
- <<: *base_manual_changes
- <<: *master_manual_branch
- <<: *release_manual_branch
.base_job_rules:
&base_job_rules
rules:
- <<: *pull_requests
- <<: *master_branch
- <<: *release_branch
.manual_job_rules:
&manual_job_rules
rules:
- <<: *pull_requests
when: manual
allow_failure: true
- <<: *master_branch
when: manual
allow_failure: true
- <<: *release_branch
when: manual
allow_failure: true
.linux_env: &linux_env
before_script:
- source .setup-scripts/setup_env.sh
.windows_env: &windows_env
tags:
- windows_agent7_ps1
before_script:
- Import-Module C:\tools\miniconda3\shell\condabin\conda-hook.ps1
- ./.setup-scripts/conda_env.ps1 $CONDA_ENV $PYTHON_VERSION
- conda activate $CONDA_ENV
- python -m pip install .\stackstate_checks_dev[cli]
print_env:
<<: *linux_env
<<: *manual_job_rules
stage: build
script:
- printenv
interruptible: true
docker:
<<: *manual_job_rules
image: ${REGISTRY_DOCKER_URL}/library/docker:20-git
stage: build
script:
- echo "${docker_password}" | docker login --username=${docker_user} --password-stdin docker.io
- echo "${quay_password}" | docker login --username=${quay_user} --password-stdin quay.io
- echo "${REGISTRY_PASSWORD}" | docker login --username=${REGISTRY_USER} --password-stdin ${REGISTRY_HOST}
- apk add make
- cd .setup-scripts/image
- make build
- make push
- if [ "${CI_COMMIT_REF_NAME}" = "stackstate-7.51.1" ]; then make tag_latest; make push_latest; fi
services:
- alias: docker
command:
- --experimental
- --tls=false
name: ${REGISTRY_DOCKER_URL}/library/docker:20-dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
linux_deps:
<<: *linux_env
<<: *base_job_rules
stage: build
interruptible: true
script:
- source .setup-scripts/load_deps.sh
artifacts:
paths:
- venv/
expire_in: 1 week
.linux_test: &linux_test
<<: *linux_env
<<: *base_integration_rules
stage: test
needs:
- linux_deps
services:
- alias: docker
command:
- --experimental
- --tls=false
name: ${REGISTRY_DOCKER_URL}/library/docker:24-dind
script:
- .setup-scripts/setup_vsphere_artifactory_publishing.sh
- .setup-scripts/setup_artifactory_docker.sh
- export COMPOSE_HTTP_TIMEOUT=300 # Increase timeout in case containers are slow to start up.
- checksdev test --cov ${CHECK}
- checksdev test ${CHECK} --bench || true
# [BS] we skip this until https://github.com/PyCQA/pylint/pull/2681/commits/253e5d05e3943d3bc8e4470804a138cb20049548 lands in pylint stable version
# - if [ -n "$PYTHON3" ]; then checksdev validate py3 ${CHECK}; fi
interruptible: true
.linux_splunk_test: &linux_splunk_test
<<: *linux_test
<<: *base_splunk_integration_rules
script:
- .setup-scripts/setup_vsphere_artifactory_publishing.sh
- .setup-scripts/setup_artifactory_docker.sh
- docker pull registry.tooling.stackstate.io/docker/splunk/splunk:latest # Pull splunk to aovid pulling during compose, which breaks in python
- export COMPOSE_HTTP_TIMEOUT=300 # Increase timeout in case splunk is slow to start up.
- checksdev test --cov ${CHECK}
- checksdev test ${CHECK} --bench || true
# [BS] we skip this until https://github.com/PyCQA/pylint/pull/2681/commits/253e5d05e3943d3bc8e4470804a138cb20049548 lands in pylint stable version
# - if [ -n "$PYTHON3" ]; then checksdev validate py3 ${CHECK}; fi
test_stackstate_checks_base:
<<: *linux_test
variables:
CHECK: "stackstate_checks_base"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
script:
- checksdev validate config
- checksdev validate dep
- checksdev validate manifest --include-extras
- checksdev validate metadata
- checksdev validate service-checks
- checksdev test --cov ${CHECK}
- checksdev test ${CHECK} --bench || true
test_stackstate_checks_dev:
<<: *linux_test
variables:
CHECK: "stackstate_checks_dev"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_dynatrace_base:
<<: *linux_test
variables:
CHECK: "dynatrace_base"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_dynatrace_topology:
<<: *linux_test
variables:
CHECK: "dynatrace_topology"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_dynatrace_health:
<<: *linux_test
variables:
CHECK: "dynatrace_health"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_kubelet:
<<: *linux_test
variables:
CHECK: "kubelet"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_openmetrics:
<<: *linux_test
variables:
CHECK: "openmetrics"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_postgres:
<<: *linux_test
variables:
CHECK: "postgres"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_splunk_topology:
<<: *linux_splunk_test
variables:
CHECK: "splunk_topology"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_splunk_health:
<<: *linux_splunk_test
variables:
CHECK: "splunk_health"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_splunk_metric:
<<: *linux_splunk_test
variables:
CHECK: "splunk_metric"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_agent_integration_sample:
<<: *linux_test
variables:
CHECK: "agent_integration_sample"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_agent_v2_integration_sample:
<<: *linux_test
variables:
CHECK: "agent_v2_integration_sample"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_agent_v2_integration_stateful_sample:
<<: *linux_test
variables:
CHECK: "agent_v2_integration_stateful_sample"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_agent_v2_integration_transactional_sample:
<<: *linux_test
variables:
CHECK: "agent_v2_integration_transactional_sample"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_vsphere:
<<: *linux_test
variables:
CHECK: "vsphere"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_zabbix:
<<: *linux_test
variables:
CHECK: "zabbix"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_splunk_base:
<<: *linux_splunk_test
variables:
CHECK: "splunk_base"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
tags:
- sts-k8s-xl-no-docker-runner
test_servicenow:
<<: *linux_test
variables:
CHECK: "servicenow"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_static_topology:
<<: *linux_test
variables:
CHECK: "static_topology"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
test_static_health:
<<: *linux_test
variables:
CHECK: "static_health"
PYTHON3: "true"
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
publish-checks-dev:
stage: publish
interruptible: true
script:
- source .setup-scripts/setup_artifactory_publishing.sh
- export VERSION=`./.setup-scripts/version.sh`
- echo "__version__ = \"$VERSION\"" > stackstate_checks_dev/stackstate_checks/dev/__about__.py
- cd stackstate_checks_dev && python setup.py sdist bdist_wheel upload -r gitlab
<<: *manual_job_rules