-
Notifications
You must be signed in to change notification settings - Fork 10
248 lines (220 loc) · 9.35 KB
/
run-lib-injection.yml
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
name: Lib-injection tests
on:
workflow_call:
inputs:
build_lib_injection_app_images:
description: "Shall we build python base images for tests on python tracer"
default: false
required: false
type: boolean
library:
description: "Library to test"
required: true
type: string
env:
REGISTRY: ghcr.io
jobs:
compute-matrix:
name: Get weblogs for Lib-Injection tests
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.compute-matrix.outputs.matrix }}
matrix_not_supported: ${{ steps.compute-matrix.outputs.matrix_not_supported }}
init_image: ${{ steps.compute-matrix.outputs.init_image }}
steps:
- name: Compute matrix
id: compute-matrix
shell: python
run: |
import json
import os
weblogs={
"cpp": [],
"dotnet": ["dd-lib-dotnet-init-test-app"],
"golang": [],
"java": ["dd-lib-java-init-test-app"],
"nodejs": ["sample-app"],
"php": [],
"python": ["dd-lib-python-init-test-django", "dd-lib-python-init-test-django-gunicorn", "dd-lib-python-init-test-django-uvicorn"],
"ruby": ["dd-lib-ruby-init-test-rails", "dd-lib-ruby-init-test-rails-explicit", "dd-lib-ruby-init-test-rails-gemsrb"]
}
#Lang version not supported for these weblogs
not_supported_weblogs={
"cpp": [],
"dotnet": [],
"golang": [],
"java": ["jdk7-app"],
"nodejs": [],
"php": [],
"python": [],
"ruby": []
}
init_images={
"cpp": [],
"dotnet": ["gcr.io/datadoghq/dd-lib-dotnet-init:latest","ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:latest_snapshot"],
"golang": [],
"java": ["gcr.io/datadoghq/dd-lib-java-init:latest","ghcr.io/datadog/dd-trace-java/dd-lib-java-init:latest_snapshot"],
"nodejs": ["gcr.io/datadoghq/dd-lib-js-init:latest","ghcr.io/datadog/dd-trace-js/dd-lib-js-init:latest_snapshot"],
"php": [],
"python": ["gcr.io/datadoghq/dd-lib-python-init:latest","ghcr.io/datadog/dd-trace-py/dd-lib-python-init:latest_snapshot"],
"ruby": ["gcr.io/datadoghq/dd-lib-ruby-init:latest","ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:latest_snapshot"],
}
result = weblogs["${{ inputs.library }}"]
result_not_supported = not_supported_weblogs["${{ inputs.library }}"]
result_init_image = init_images["${{ inputs.library }}"]
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'matrix={json.dumps(result)}', file=fh)
print(f'init_image={json.dumps(result_init_image)}', file=fh)
print(f'matrix_not_supported={json.dumps(result_not_supported)}', file=fh)
print(json.dumps(result, indent=2))
print(json.dumps(result_init_image, indent=2))
print(json.dumps(result_not_supported, indent=2))
lib-injection-init-image-validator:
if: inputs.library == 'dotnet' || inputs.library == 'java' || inputs.library == 'python' || inputs.library == 'ruby' || inputs.library == 'nodejs'
runs-on:
group: "APM Larger Runners"
permissions:
contents: read
packages: read
needs:
- compute-matrix
strategy:
matrix:
- weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
lib_init_image: ${{ fromJson(needs.compute-matrix.outputs.init_image) }}
lang_suported: "true"
- weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix_not_supported) }}
lib_init_image: ${{ fromJson(needs.compute-matrix.outputs.init_image) }}
lang_suported: "false"
fail-fast: false
env:
TEST_LIBRARY: ${{ inputs.library }}
LIB_INIT_IMAGE: ${{ matrix.lib_init_image }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # 3.0.0
with:
registry: ghcr.io/datadog
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build weblog init image validator
if: matrix.lang_suported == 'true'
run: lib-injection/build/build_lib_injection_weblog.sh -w ${{ matrix.weblog }} -l ${{ inputs.library }}
- name: Install runner
uses: ./.github/actions/install_runner
- name: Perform lib injection
if: matrix.lang_suported == 'true'
run: |
echo "Testing lib injection init image: $LIB_INIT_IMAGE"
./run.sh LIB_INJECTION_VALIDATION
- name: Perform lib injection for not supported lang
if: matrix.lang_suported == 'false'
run: |
echo "Testing lib injection init image: $LIB_INIT_IMAGE"
echo "Weblog: ${{ matrix.weblog }}"
- name: Compress logs
id: compress_logs
if: always()
run: tar -czvf artifact.tar.gz $(ls | grep logs)
- name: Upload artifact
if: always() && steps.compress_logs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: logs_lib-injection_validation_${{ inputs.library}}_${{matrix.weblog}}_${{ endsWith(matrix.lib_init_image, 'latest_snapshot') == true && 'latest_snapshot' || 'latest'}}
path: artifact.tar.gz
k8s-lib-injection-tests:
if: 1==2 && inputs.library == 'dotnet' || inputs.library == 'java' || inputs.library == 'python' || inputs.library == 'ruby' || inputs.library == 'nodejs'
runs-on:
group: "APM Larger Runners"
permissions:
contents: read
packages: write
needs:
- compute-matrix
strategy:
matrix:
weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
version:
- latest
- latest_snapshot
fail-fast: false
env:
TEST_LIBRARY: ${{ inputs.library }}
WEBLOG_VARIANT: ${{ matrix.weblog }}
DOCKER_REGISTRY_IMAGES_PATH: ghcr.io/datadog
DOCKER_IMAGE_TAG: ${{ matrix.version }}
BUILDX_PLATFORMS: linux/amd64
SYSTEM_TESTS_REPORT_ENVIRONMENT: dev
SYSTEM_TESTS_REPORT_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.12.1 # 0.13.0 is causing the builds to fail
install: true
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 1
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # 3.0.0
with:
registry: ghcr.io/datadog
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build weblog base images (PR)
if: inputs.build_lib_injection_app_images
env:
DOCKER_IMAGE_WEBLOG_TAG: ${{ github.sha }}
APP_DOCKER_IMAGE_REPO: ghcr.io/datadog/system-tests/${{ matrix.weblog }}
run: |
cd lib-injection/build/docker/$TEST_LIBRARY/$WEBLOG_VARIANT
LIBRARY_INJECTION_TEST_APP_IMAGE=$APP_DOCKER_IMAGE_REPO:${{ github.sha }} ./build.sh
cd ..
- name: Build weblog latest base images
#If we execute on system-tests-dashboard, we can't push the images because we don't have the permissions.
#To asign the permissions, we need to configure the image on ghcr, but due to a issue we can't do it
#The case is opened with github support
if: github.ref == 'refs/heads/main' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
env:
DOCKER_IMAGE_WEBLOG_TAG: latest
APP_DOCKER_IMAGE_REPO: ghcr.io/datadog/system-tests/${{ matrix.weblog }}
run: |
cd lib-injection/build/docker/$TEST_LIBRARY/$WEBLOG_VARIANT
LIBRARY_INJECTION_TEST_APP_IMAGE=$APP_DOCKER_IMAGE_REPO:latest ./build.sh
cd ..
- name: Install runner
uses: ./.github/actions/install_runner
- name: Kubernetes lib-injection tests (using custom weblog image tag)
if: inputs.build_lib_injection_app_images
id: k8s-lib-injection-tests-custom-weblog-tag
run: DOCKER_IMAGE_WEBLOG_TAG=${{ github.sha }} ./run.sh K8S_LIB_INJECTION_FULL
- name: Kubernetes lib-injection tests
if: inputs.build_lib_injection_app_images != true
id: k8s-lib-injection-tests
run: ./run.sh K8S_LIB_INJECTION_FULL
- name: Compress logs
id: compress_logs
if: always()
run: tar -czvf artifact.tar.gz $(ls | grep logs)
- name: Upload artifact
if: always() && steps.compress_logs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: logs_k8s-lib-injection_${{ inputs.library}}_${{matrix.weblog}}_${{ matrix.version == 'latest' && 'prod' || 'dev' }}
path: artifact.tar.gz