Skip to content

Commit 26a21e8

Browse files
authored
Add parallel mode in CI #4035 (#4158)
1 parent d288500 commit 26a21e8

File tree

8 files changed

+7322
-47
lines changed

8 files changed

+7322
-47
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
build_lib_injection_app_images: ${{ contains(github.event.pull_request.labels.*.name, 'build-lib-injection-app-images') }}
131131
parametric_job_count: ${{ matrix.version == 'dev' && 2 || 1 }} # test both use cases
132132
skip_empty_scenarios: true
133+
desired_execution_time: 3600 # one hour
133134

134135
system_tests_docker_mode:
135136
name: Ruby Docker Mode

.github/workflows/compute-workflow-parameters.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ on:
2020
default: 1
2121
required: false
2222
type: number
23+
desired_execution_time:
24+
description: "In seconds, system-tests will try to respect this time budget."
25+
default: -1
26+
required: false
27+
type: number
2328
_ci_environment:
2429
description: "Which CI environment is running the tests, used for FPD. used internally to skip some weblogs on prod"
2530
default: 'custom'
@@ -49,16 +54,24 @@ on:
4954
parametric_job_matrix:
5055
description: ""
5156
value: ${{ jobs.main.outputs.parametric_job_matrix }}
52-
endtoend_defs_weblogs:
57+
endtoend_defs_parallel_enable:
58+
description: ""
59+
value: ${{ jobs.main.outputs.endtoend_defs_parallel_enable }}
60+
endtoend_defs_parallel_weblogs:
5361
description: ""
54-
value: ${{ jobs.main.outputs.endtoend_defs_weblogs }}
62+
value: ${{ jobs.main.outputs.endtoend_defs_parallel_weblogs }}
63+
endtoend_defs_parallel_jobs:
64+
description: ""
65+
value: ${{ jobs.main.outputs.endtoend_defs_parallel_jobs }}
5566

5667
jobs:
5768
main:
5869
name: Get parameters
5970
runs-on: ubuntu-latest
6071
outputs:
61-
endtoend_defs_weblogs: ${{ steps.main.outputs.endtoend_defs_weblogs }}
72+
endtoend_defs_parallel_enable: ${{ steps.main.outputs.endtoend_defs_parallel_enable }}
73+
endtoend_defs_parallel_weblogs: ${{ steps.main.outputs.endtoend_defs_parallel_weblogs }}
74+
endtoend_defs_parallel_jobs: ${{ steps.main.outputs.endtoend_defs_parallel_jobs }}
6275
externalprocessing_scenarios: ${{ steps.main.outputs.externalprocessing_scenarios }}
6376
libinjection_scenarios: ${{ steps.main.outputs.libinjection_scenarios }}
6477
libinjection_enable: ${{ steps.main.outputs.libinjection_enable }}
@@ -81,18 +94,18 @@ jobs:
8194
python utils/scripts/compute-workflow-parameters.py ${{ inputs.library }} \
8295
-s "${{ inputs.scenarios }}" \
8396
-g "${{ inputs.scenarios_groups }}" \
97+
-t ${{ inputs.desired_execution_time }} \
8498
--parametric-job-count ${{ inputs.parametric_job_count }} \
85-
--ci-environment "${{ inputs._ci_environment }}" >> $GITHUB_OUTPUT
86-
env:
87-
PYTHONPATH: "."
99+
--ci-environment "${{ inputs._ci_environment }}" \
100+
--output $GITHUB_OUTPUT
88101
- name: log
89102
run: |
90103
source venv/bin/activate
91104
python utils/scripts/compute-workflow-parameters.py ${{ inputs.library }} \
92105
-s "${{ inputs.scenarios }}" \
93106
-g "${{ inputs.scenarios_groups }}" \
107+
-t ${{ inputs.desired_execution_time }} \
94108
--parametric-job-count ${{ inputs.parametric_job_count }} \
95109
--ci-environment "${{ inputs._ci_environment }}" \
96110
--format json | jq
97-
env:
98-
PYTHONPATH: "."
111+

.github/workflows/run-end-to-end.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ on:
5151
default: false
5252
required: false
5353
type: boolean
54+
logs_artifact_name:
55+
description: "The name of the artifact to use for logs"
56+
required: true
57+
type: string
5458

5559
env:
5660
REGISTRY: ghcr.io
@@ -371,7 +375,7 @@ jobs:
371375
uses: actions/upload-artifact@v4
372376
with:
373377
# log name convention to respect : logs_$SCENARIO-FAMILY_$LIBRARY_$WEBLOG_$CI-ENVIRONMENT
374-
name: logs_endtoend_${{ inputs.library }}_${{ inputs.weblog }}_${{ inputs.ci_environment }}
378+
name: ${{ inputs.logs_artifact_name }}
375379
path: artifact.tar.gz
376380

377381
- name: Push results to Feature Parity Dashboard

.github/workflows/system-tests.yml

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ on:
6161
default: 1
6262
required: false
6363
type: number
64+
desired_execution_time:
65+
description: "In seconds, system-tests will try to respect this time budget."
66+
default: -1
67+
required: false
68+
type: number
6469
_experimental_parametric_job_count:
6570
description: "*DEPRECATED*"
6671
default: 1
@@ -76,6 +81,7 @@ jobs:
7681
scenarios: ${{ inputs.scenarios }}
7782
scenarios_groups: ${{ inputs.scenarios_groups }}
7883
parametric_job_count: ${{ inputs.parametric_job_count }}
84+
desired_execution_time: ${{ inputs.desired_execution_time }}
7985
_ci_environment: ${{ inputs.ci_environment }}
8086

8187
parametric:
@@ -91,7 +97,7 @@ jobs:
9197
job_count: ${{ inputs.parametric_job_count }}
9298
job_matrix: ${{ needs.compute_parameters.outputs.parametric_job_matrix }}
9399

94-
lib-injection:
100+
lib_injection:
95101
needs:
96102
- compute_parameters
97103
if: ${{ needs.compute_parameters.outputs.libinjection_enable == 'true' }}
@@ -105,29 +111,66 @@ jobs:
105111
library: ${{ inputs.library }}
106112
version: ${{ inputs.binaries_artifact == '' && 'prod' || 'dev' }}
107113

108-
end-to-end:
109-
name: end-to-end (${{ matrix.weblogs.weblog_name }})
114+
build_end_to_end:
115+
name: Build end-to-end (${{ matrix.weblog }})
110116
needs:
111117
- compute_parameters
112-
if: ${{ needs.compute_parameters.outputs.endtoend_defs_weblogs != '[]' }}
118+
if: ${{ needs.compute_parameters.outputs.endtoend_defs_parallel_enable == 'true' }}
119+
runs-on: ubuntu-latest
113120
strategy:
114121
matrix:
115-
weblogs: ${{ fromJson(needs.compute_parameters.outputs.endtoend_defs_weblogs) }}
122+
weblog: ${{ fromJson(needs.compute_parameters.outputs.endtoend_defs_parallel_weblogs) }}
123+
fail-fast: false
124+
steps:
125+
- name: Checkout
126+
uses: actions/checkout@v4
127+
with:
128+
repository: 'DataDog/system-tests'
129+
- name: Get binaries artifact
130+
if : ${{ inputs.binaries_artifact != '' }}
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: ${{ inputs.binaries_artifact }}
134+
path: binaries/
135+
- name: Build python's weblog base images
136+
if: inputs.library == 'python' && inputs.build_python_base_images
137+
run: |
138+
./utils/build/build_python_base_images.sh
139+
- name: Build agent
140+
run: SYSTEM_TEST_BUILD_ATTEMPTS=3 ./build.sh -i agent -s
141+
- name: Build weblog
142+
id: build
143+
run: SYSTEM_TEST_BUILD_ATTEMPTS=3 ./build.sh ${{ inputs.library }} -i weblog -w ${{ matrix.weblog }} -s
144+
- name: Upload artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: binaries_${{ inputs.ci_environment}}_${{ inputs.library }}_${{ matrix.weblog }}
148+
path: binaries/
149+
150+
run_end_to_end:
151+
name: "End-to-end #${{ matrix.job.weblog_instance }}"
152+
needs:
153+
- compute_parameters
154+
- build_end_to_end
155+
if: ${{ needs.compute_parameters.outputs.endtoend_defs_parallel_enable == 'true' }}
156+
strategy:
157+
matrix:
158+
job: ${{ fromJson(needs.compute_parameters.outputs.endtoend_defs_parallel_jobs) }}
116159
fail-fast: false
117160
uses: ./.github/workflows/run-end-to-end.yml
118161
secrets: inherit
119162
with:
120-
library: ${{ matrix.weblogs.library }}
121-
weblog: ${{ matrix.weblogs.weblog_name }}
122-
scenarios: ${{ toJson(matrix.weblogs.scenarios) }}
123-
build_python_base_images: ${{ inputs.build_python_base_images }}
163+
library: ${{ matrix.job.library }}
164+
weblog: ${{ matrix.job.weblog }}
165+
scenarios: ${{ toJson(matrix.job.scenarios) }}
124166
build_buddies_images: ${{ inputs.build_buddies_images }}
125167
build_proxy_image: ${{ inputs.build_proxy_image }}
126-
binaries_artifact: ${{ inputs.binaries_artifact }}
168+
binaries_artifact: binaries_${{ inputs.ci_environment}}_${{ inputs.library }}_${{ matrix.job.weblog }}
127169
ci_environment: ${{ inputs.ci_environment }}
128170
skip_empty_scenarios: ${{ inputs.skip_empty_scenarios }}
171+
logs_artifact_name: logs_endtoend_${{ inputs.library }}_${{ matrix.job.weblog }}_${{ inputs.ci_environment }}_${{ matrix.job.weblog_instance }}
129172

130-
external-processing:
173+
external_processing:
131174
needs:
132175
- compute_parameters
133176
if: ${{ needs.compute_parameters.outputs.externalprocessing_scenarios != '[]' && inputs.library == 'golang' && inputs.binaries_artifact != ''}}

utils/build/docker/python/install_ddtrace.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
99
if [ -e "dd-trace-py" ]; then
1010
echo "Install from local folder /binaries/dd-trace-py"
1111
pip install /binaries/dd-trace-py
12-
elif [ "$(ls *.whl *.tar.gz | grep -v 'datadog-dotnet-apm.tar.gz' | grep -v 'dd-library-php-x86_64-linux-gnu.tar.gz' | wc -l)" = "1" ]; then
13-
path=$(readlink -f $(ls *.whl *.tar.gz | grep -v 'datadog-dotnet-apm.tar.gz' | grep -v 'dd-library-php-x86_64-linux-gnu.tar.gz'))
12+
elif [ "$(ls *.whl | wc -l)" = "1" ]; then
13+
path=$(readlink -f $(ls *.whl))
1414
echo "Install ddtrace from ${path}"
1515
pip install "ddtrace[appsec-beta] @ file://${path}"
1616
elif [ $(ls python-load-from-pip | wc -l) = 1 ]; then

0 commit comments

Comments
 (0)