-
Notifications
You must be signed in to change notification settings - Fork 542
440 lines (408 loc) · 16.8 KB
/
Copy pathsystem-tests.yml
File metadata and controls
440 lines (408 loc) · 16.8 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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
name: System Tests
on:
workflow_call: # allows to reuse this workflow
inputs:
branch_ref:
description: 'The branch to run the workflow on'
required: true
type: string
push:
branches:
- release-v*
- mq-working-branch-**
tags-ignore:
- 'contrib/**'
- 'instrumentation/**'
- 'internal/**'
- 'orchestrion/**'
- 'scripts/**'
pull_request:
workflow_dispatch:
inputs:
ref:
description: 'System Tests ref/tag/branch'
required: true
default: main
type: string
schedule:
- cron: '00 04 * * *'
permissions:
id-token: write
contents: read
packages: write
jobs:
warm-repo-cache:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.pin.outputs.sha }}
steps:
- name: Checkout system-tests
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: 'DataDog/system-tests'
ref: ${{ inputs.ref }}
- name: Pin exact commit SHA for system-tests
id: pin
run: |
echo "sha=$(git rev-parse FETCH_HEAD)" >> "$GITHUB_OUTPUT"
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .git
key: gitdb-system-tests-${{ steps.pin.outputs.sha }}
build-weblog-images:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
runs-on: ubuntu-latest
needs:
- warm-repo-cache
strategy:
fail-fast: false
matrix:
weblog-variant:
- net-http
- echo
- chi
- gin
- uds-echo
- graph-gophers
- graphql-go
- gqlgen
- net-http-orchestrion
name: Build weblog (${{ matrix.weblog-variant }})
steps:
- name: Restore repo cache
id: restore-repo-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .git
key: gitdb-system-tests-${{ needs.warm-repo-cache.outputs.sha }}
- name: Checkout system tests (using cache)
if: steps.restore-repo-cache.outcome == 'success' && steps.restore-repo-cache.outputs.cache-hit == 'true'
shell: bash
run: |
git config safe.directory "$GITHUB_WORKSPACE"
git checkout -f ${{ needs.warm-repo-cache.outputs.sha }}
# Fall back in case of a cache miss, which can occur when retrying old runs.
- name: Checkout system tests (cache miss)
if: steps.restore-repo-cache.outcome == 'failure' || steps.restore-repo-cache.outputs.cache-hit != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: 'DataDog/system-tests'
ref: ${{ inputs.ref }}
- name: Checkout dd-trace-go
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.branch_ref || github.ref }}
path: 'binaries/dd-trace-go'
- name: Build and save weblog image
run: ./build.sh golang -i weblog -w ${{ matrix.weblog-variant }} --save-to-binaries
- name: Upload weblog image artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: weblog-image-${{ matrix.weblog-variant }}
path: binaries/golang-${{ matrix.weblog-variant }}-weblog.tar.zst
retention-days: 1
system-tests:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
# Note: Not using large runners because the jobs spawned by this pipeline
# don't seem to get a noticable speedup from using larger runners.
runs-on: ubuntu-latest
needs:
- warm-repo-cache
- build-weblog-images
- build-service-extensions-callout
- build-haproxy
strategy:
matrix:
weblog-variant:
- net-http
- echo
- chi
- gin
- uds-echo
scenario:
- DEFAULT
- INTEGRATIONS
- CROSSED_TRACING_LIBRARIES
- APPSEC_DISABLED
- APPSEC_BLOCKING
- APPSEC_BLOCKING_FULL_DENYLIST
- APPSEC_API_SECURITY
- APPSEC_RASP
- APPSEC_RASP_NON_BLOCKING
- APPSEC_RUNTIME_ACTIVATION
- APM_TRACING_E2E_SINGLE_SPAN
- APM_TRACING_E2E_OTEL
- TRACING_CONFIG_SCENARIOS
include:
- weblog-variant: net-http
scenario: REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
- weblog-variant: net-http
scenario: REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
- weblog-variant: net-http
scenario: REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
# AppSec scenarios that don't depend on the integrations, so we just run on the net/http variant
- weblog-variant: net-http
scenario: APPSEC_RATE_LIMITER
- weblog-variant: net-http
scenario: APPSEC_CUSTOM_RULES
- weblog-variant: net-http
scenario: APPSEC_MISSING_RULES
- weblog-variant: net-http
scenario: APPSEC_CORRUPTED_RULES
- weblog-variant: net-http
scenario: APPSEC_LOW_WAF_TIMEOUT
- weblog-variant: net-http
scenario: APPSEC_STANDALONE
- weblog-variant: net-http
scenario: APPSEC_STANDALONE_V2
- weblog-variant: net-http
scenario: APPSEC_META_STRUCT_DISABLED
- weblog-variant: net-http
scenario: APPSEC_CUSTOM_OBFUSCATION
- weblog-variant: net-http
scenario: APPSEC_WAF_TELEMETRY
# APM scenarios requiring specific environment settings
- scenario: APM_TRACING_E2E_SINGLE_SPAN
env:
DD_API_KEY=$DD_API_KEY
DD_APPLICATION_KEY=$DD_APP_KEY
DD_SITE="datadoghq.com"
- scenario: APM_TRACING_E2E_OTEL
env:
DD_API_KEY=$DD_API_KEY
DD_APPLICATION_KEY=$DD_APP_KEY
DD_SITE="datadoghq.com"
# GraphQL System Tests
- scenario: GRAPHQL_APPSEC
weblog-variant: graph-gophers
- scenario: GRAPHQL_APPSEC
weblog-variant: graphql-go
- scenario: GRAPHQL_APPSEC
weblog-variant: gqlgen
# Telemetry
- weblog-variant: net-http
scenario: TELEMETRY_APP_STARTED_PRODUCTS_DISABLED
- weblog-variant: net-http
scenario: TELEMETRY_LOG_GENERATION_DISABLED
- weblog-variant: net-http
# TELEMETRY_METRIC_GENERATION_ENABLED scenario merged into AGENT_SUPPORTING_SPAN_EVENTS
scenario: AGENT_SUPPORTING_SPAN_EVENTS
- weblog-variant: net-http
scenario: TELEMETRY_METRIC_GENERATION_DISABLED
- weblog-variant: net-http
scenario: APM_TRACING_EFFICIENT_PAYLOAD
- weblog-variant: net-http
scenario: FEATURE_FLAGGING_AND_EXPERIMENTATION
# Client-side stats — run across all weblogs, plus the client_drop_p0s variant on net-http
- weblog-variant: net-http
scenario: TRACE_STATS_COMPUTATION
- weblog-variant: echo
scenario: TRACE_STATS_COMPUTATION
- weblog-variant: chi
scenario: TRACE_STATS_COMPUTATION
- weblog-variant: gin
scenario: TRACE_STATS_COMPUTATION
- weblog-variant: uds-echo
scenario: TRACE_STATS_COMPUTATION
- weblog-variant: net-http
scenario: TRACE_STATS_COMPUTATION_CLIENT_DROP_P0S_FALSE
# RASP scenarios run on net-http-orchestrion because LFI and CMDi detection require orchestrion
- weblog-variant: net-http-orchestrion
scenario: APPSEC_RASP
- weblog-variant: net-http-orchestrion
scenario: APPSEC_RASP_NON_BLOCKING
- weblog-variant: net-http-orchestrion
scenario: REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
- weblog-variant: envoy
scenario: DEFAULT
image_artifact: service-extensions-image-linux-amd64
image_name: service-extensions-callout
- weblog-variant: envoy
scenario: APPSEC_BLOCKING
image_artifact: service-extensions-image-linux-amd64
image_name: service-extensions-callout
- weblog-variant: haproxy
scenario: DEFAULT
image_artifact: haproxy-spoa-image-linux-amd64
image_name: haproxy-spoa
- weblog-variant: haproxy
scenario: APPSEC_BLOCKING
image_artifact: haproxy-spoa-image-linux-amd64
image_name: haproxy-spoa
fail-fast: false
env:
SYSTEM_TESTS_WEBLOG: ${{ matrix.weblog-variant }}
name: Test (${{ matrix.weblog-variant }}, ${{ matrix.scenario }})
steps:
- name: Restore repo cache
id: restore-repo-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .git
key: gitdb-system-tests-${{ needs.warm-repo-cache.outputs.sha }}
- name: Checkout system tests (using cache)
if: steps.restore-repo-cache.outcome == 'success' && steps.restore-repo-cache.outputs.cache-hit == 'true'
shell: bash
run: |
git config safe.directory "$GITHUB_WORKSPACE"
git checkout -f ${{ needs.warm-repo-cache.outputs.sha }}
# Fall back in case of a cache miss, which can occur when retrying old runs.
- name: Checkout system tests (cache miss)
if: steps.restore-repo-cache.outcome == 'failure' || steps.restore-repo-cache.outputs.cache-hit != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: 'DataDog/system-tests'
ref: ${{ inputs.ref }}
- name: Checkout dd-trace-go
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ inputs.branch_ref || github.ref }}
path: 'binaries/dd-trace-go'
# Use the app key policy to obtain DD_APP_KEY
- name: Get Datadog credentials
id: dd-sts
uses: DataDog/dd-sts-action@639d841c72f15e4e77747bd726ef8105ce971da2
with:
policy: dd-trace-go-app-key
- name: Set credentials
run: |
echo "DD_API_KEY=${{ steps.dd-sts.outputs.api_key }}" >> "$GITHUB_ENV"
echo "DD_APP_KEY=${{ steps.dd-sts.outputs.app_key }}" >> "$GITHUB_ENV"
- name: Cache npm packages for datadog-ci
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.npm
key: npm-datadog-ci-${{ runner.os }}-v1
restore-keys: |
npm-datadog-ci-${{ runner.os }}-
# Pre-install datadog-ci early so the action's npm install is instant.
# continue-on-error: the action has its own retry; this is best-effort.
- name: Pre-install datadog-ci
continue-on-error: true
run: npm install -g @datadog/datadog-ci
- name: Download pre-built weblog image
if: ${{ matrix.weblog-variant != 'envoy' && matrix.weblog-variant != 'haproxy' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: weblog-image-${{ matrix.weblog-variant }}
path: binaries/
- name: Display the content of binaries folder
run: ls -la binaries
- name: Build weblog
if: ${{ matrix.weblog-variant != 'envoy' && matrix.weblog-variant != 'haproxy' }}
run: ./build.sh golang -i weblog -w ${{ matrix.weblog-variant }}
- name: Download ${{ matrix.weblog-variant }} artifacts
if: ${{ github.ref != 'refs/heads/main' && (matrix.weblog-variant == 'envoy' || matrix.weblog-variant == 'haproxy') }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ matrix.image_artifact }}
- name: Load ${{ matrix.weblog-variant }} image
if: ${{ github.ref != 'refs/heads/main' && (matrix.weblog-variant == 'envoy' || matrix.weblog-variant == 'haproxy') }}
run: docker load -i ${{ matrix.image_artifact }}.tar
- name: Set ${{ matrix.image_name }} image name
if: ${{ matrix.weblog-variant == 'envoy' || matrix.weblog-variant == 'haproxy' }}
run: echo "ghcr.io/datadog/dd-trace-go/${{ matrix.image_name }}:dev" > binaries/golang-${{ matrix.image_name }}-image
- name: Build runner
uses: ./.github/actions/install_runner
- name: Run
shell: bash
run: |
env ${{ matrix.env }} ./run.sh ${{ matrix.scenario }}
- name: Upload test results to Test Optimization
if: ${{ always() }}
uses: DataDog/system-tests/.github/actions/push_to_test_optim@6fa83580dfdb27e6932c7498d0dbda7b9363ed62
- name: Compress artifact
if: ${{ always() }}
run: |
if compgen -G "logs*/" > /dev/null; then
tar -czvf artifact.tar.gz logs*/
else
echo "No logs*/ found; skipping tar."
fi
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ always() }}
with:
name: logs_${{ matrix.weblog-variant }}_${{ matrix.scenario }}
path: artifact.tar.gz
# Pushing an image tagged with "dev" only on commit to main,
# otherwise build and use the image from the artifact.
build-service-extensions-callout:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
uses: ./.github/workflows/docker-build-and-push.yml
with:
image: ghcr.io/datadog/dd-trace-go/service-extensions-callout
dockerfile: ./contrib/envoyproxy/go-control-plane/cmd/serviceextensions/Dockerfile
artifact_prefix: service-extensions-image
commit_sha: ${{ github.sha }}
tags: >-
dev
push: ${{ github.ref == 'refs/heads/main' }}
platforms: '["linux/amd64"]'
# Pushing an image tagged with "dev" only on commit to main,
# otherwise build and use the image from the artifact.
build-haproxy:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
uses: ./.github/workflows/docker-build-and-push.yml
with:
image: ghcr.io/datadog/dd-trace-go/haproxy-spoa
dockerfile: ./contrib/haproxy/stream-processing-offload/cmd/spoa/Dockerfile
artifact_prefix: haproxy-spoa-image
commit_sha: ${{ github.sha }}
tags: >-
dev
push: ${{ github.ref == 'refs/heads/main' }}
platforms: '["linux/amd64"]'
# Pushing an image tagged with "dev" only on commit to main,
# otherwise build and use the image from the artifact.
build-apim-callout:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'DataDog/dd-trace-go')
uses: ./.github/workflows/docker-build-and-push.yml
with:
image: ghcr.io/datadog/dd-trace-go/apim-callout
dockerfile: ./contrib/azure/apim-callout/cmd/apim-callout/Dockerfile
artifact_prefix: apim-callout-image
commit_sha: ${{ github.sha }}
tags: >-
dev
push: ${{ github.ref == 'refs/heads/main' }}
platforms: '["linux/amd64"]'
tracer-release:
if: github.event_name == 'schedule'
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main
permissions:
contents: read
id-token: write
with:
library: golang
scenarios_groups: tracer-release
_system_tests_dev_mode: true
push_to_test_optimization: true
desired_execution_time: 300
system-tests-done:
name: System Tests
needs:
- build-weblog-images
- system-tests
- tracer-release
runs-on: ubuntu-latest
if: '!cancelled()'
steps:
- name: Success
if: |
needs.build-weblog-images.result == 'success'
&& needs.system-tests.result == 'success'
&& (needs.tracer-release.result == 'success' || needs.tracer-release.result == 'skipped')
run: echo "Success!"
- name: Failure
if: |
needs.build-weblog-images.result != 'success'
|| needs.system-tests.result != 'success'
|| (needs.tracer-release.result != 'success' && needs.tracer-release.result != 'skipped')
run: echo "Failure!" && exit 1