Skip to content

Commit f3c25f7

Browse files
github-actions[bot]P403n1x87erikayasuda
authored
ci: add suitespec to GitLab [backport 2.17] (#11419)
Backport f7c102e from #10877 to 2.17. We port the suitespec machinery to GitLab. The current implementation uses generated child pipelines, with the tests YAML configuration automatically generated to include the required jobs based on the files listed in the PR. The job information previously contained in the config.templ.yaml file has been migrated to the jobspec.yml configuration. The jobspec can be "modular", in the sense that it can be split into multiple jobspec.yml file within the `tests/` subtree (e.g. `tests/jobspec.yml`, `tests/debugging/jobspec.yml`, ...) ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Gabriele N. Tornetta <[email protected]> Co-authored-by: erikayasuda <[email protected]>
1 parent 475d911 commit f3c25f7

29 files changed

+929
-721
lines changed

.circleci/config.templ.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_resource_class: &default_resource_class medium
44
ubuntu_base_image: &ubuntu_base_img ubuntu-2004:2023.04.2
55
cimg_base_image: &cimg_base_image cimg/base:2022.08
66
python310_image: &python310_image cimg/python:3.10.12
7-
ddtrace_dev_image: &ddtrace_dev_image ghcr.io/datadog/dd-trace-py/testrunner@sha256:4c8afd048321e702f3605b4ae4d206fcd00e74bac708089cfe7f9c24383dc53b
7+
ddtrace_dev_image: &ddtrace_dev_image ghcr.io/datadog/dd-trace-py/testrunner@sha256:8ca43d46ff34e078bd7bc0662e74e6be38547a98140a5cd4203805f6b214b583
88
redis_image: &redis_image redis:4.0-alpine@sha256:3e99741f293147ff406657dda7644c2b88564b80a498cd00da8f905743449c9f
99
memcached_image: &memcached_image memcached:1.5-alpine@sha256:48cb7207e3d34871893fa1628f3a4984375153e9942facf82e25935b0a633c8a
1010
cassandra_image: &cassandra_image cassandra:3.11.7@sha256:495e5752526f7e75d3ad85b6a6bbf3b79714321b17a44255a216c341e3baae11

.github/workflows/requirements-locks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
validate:
1212
name: Check requirements lockfiles
1313
runs-on: ubuntu-latest
14-
container: ghcr.io/datadog/dd-trace-py/testrunner@sha256:4c8afd048321e702f3605b4ae4d206fcd00e74bac708089cfe7f9c24383dc53b
14+
container: ghcr.io/datadog/dd-trace-py/testrunner@sha256:8ca43d46ff34e078bd7bc0662e74e6be38547a98140a5cd4203805f6b214b583
1515
steps:
1616
- uses: actions/checkout@v4
1717
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ template_venv/
162162
cloned_venvs/
163163
# CircleCI generated config
164164
.circleci/config.gen.yml
165+
# GitLab CI generated config
166+
.gitlab/*-gen.yml
165167

166168
# Automatically generated fixtures
167169
tests/appsec/iast/fixtures/aspects/callers.py

.gitlab-ci.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
stages:
22
- package
3-
- tests
3+
- tests-gen
4+
- tests-trigger
45
- shared-pipeline
56
- dogfood
67
- benchmarks
@@ -10,27 +11,37 @@ stages:
1011

1112
variables:
1213
REPO_LANG: python # "python" is used everywhere rather than "py"
13-
TESTRUNNER_IMAGE: registry.ddbuild.io/images/mirror/dd-trace-py/testrunner:ecc5741ff3e7c8a30363fcd9cca79a371dcea5b4
1414
# CI_DEBUG_SERVICES: "true"
1515

16-
.testrunner:
17-
image: $TESTRUNNER_IMAGE
18-
# DEV: we have a larger pool of amd64 runners, prefer that over arm64
19-
tags: [ "arch:amd64" ]
20-
timeout: 20m
21-
before_script:
22-
- pyenv global 3.12 3.7 3.8 3.9 3.10 3.11 3.13-dev
23-
- export _CI_DD_AGENT_URL=http://${HOST_IP}:8126/
24-
2516
include:
2617
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/one-pipeline.yml
2718
- local: ".gitlab/services.yml" # Include early so others can use the definitions
2819
- local: ".gitlab/benchmarks.yml"
2920
- local: ".gitlab/package.yml"
30-
- local: ".gitlab/tests.yml"
3121
- local: ".gitlab/macrobenchmarks.yml"
3222
- local: ".gitlab/dogfood.yml"
3323
- local: ".gitlab/release.yml"
24+
- local: ".gitlab/testrunner.yml"
25+
26+
tests-gen:
27+
stage: tests-gen
28+
extends: .testrunner
29+
script:
30+
- pip install riot==0.20.0
31+
- riot -v run --pass-env -s gitlab-gen-config -v
32+
needs: []
33+
artifacts:
34+
paths:
35+
- .gitlab/tests-gen.yml
36+
37+
run-tests-trigger:
38+
stage: tests-trigger
39+
needs: [ tests-gen ]
40+
trigger:
41+
include:
42+
- artifact: .gitlab/tests-gen.yml
43+
job: tests-gen
44+
strategy: depend
3445

3546
requirements_json_test:
3647
rules:

.gitlab/package.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
build_base_venvs:
2-
extends: .testrunner
3-
stage: package
4-
parallel:
5-
matrix:
6-
- PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
7-
variables:
8-
CMAKE_BUILD_PARALLEL_LEVEL: 12
9-
PIP_VERBOSE: 1
10-
DD_PROFILING_NATIVE_TESTS: 1
11-
script:
12-
- pip install riot==0.20.0
13-
- riot -P -v generate --python=$PYTHON_VERSION
14-
artifacts:
15-
name: venv_$PYTHON_VERSION
16-
paths:
17-
- .riot/venv_*
18-
- ddtrace/**/*.so*
19-
- ddtrace/internal/datadog/profiling/crashtracker/crashtracker_exe*
20-
- ddtrace/internal/datadog/profiling/test/test_*
21-
221
download_ddtrace_artifacts:
232
image: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
243
tags: [ "arch:amd64" ]

.gitlab/testrunner.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.testrunner:
2+
image: registry.ddbuild.io/images/mirror/dd-trace-py/testrunner:7a2e802af76051f82d698919d2837eff18dbb48e
3+
# DEV: we have a larger pool of amd64 runners, prefer that over arm64
4+
tags: [ "arch:amd64" ]
5+
timeout: 20m
6+
before_script:
7+
- pyenv global 3.12 3.7 3.8 3.9 3.10 3.11 3.13-dev
8+
- export _CI_DD_AGENT_URL=http://${HOST_IP}:8126/

.gitlab/tests.yml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1+
stages:
2+
- tests
3+
14
variables:
25
RIOT_RUN_CMD: riot -P -v run --exitfirst --pass-env -s
6+
REPO_LANG: python # "python" is used everywhere rather than "py"
7+
# CI_DEBUG_SERVICES: "true"
8+
9+
10+
.testrunner:
11+
image: registry.ddbuild.io/images/mirror/dd-trace-py/testrunner:7a2e802af76051f82d698919d2837eff18dbb48e
12+
# DEV: we have a larger pool of amd64 runners, prefer that over arm64
13+
tags: [ "arch:amd64" ]
14+
timeout: 20m
15+
before_script:
16+
- pyenv global 3.12 3.7 3.8 3.9 3.10 3.11 3.13-dev
17+
- export _CI_DD_AGENT_URL=http://${HOST_IP}:8126/
18+
19+
20+
{{services.yml}}
321

422
.test_base_hatch:
523
extends: .testrunner
@@ -22,6 +40,7 @@ variables:
2240
hatch run ${env}:test
2341
done
2442
43+
2544
.test_base_hatch_snapshot:
2645
extends: .test_base_hatch
2746
services:
@@ -32,6 +51,28 @@ variables:
3251
# agent at that host. Therefore setting this as a variable will cause recursive requests to the testagent
3352
- export DD_TRACE_AGENT_URL="http://testagent:9126"
3453

54+
55+
build_base_venvs:
56+
extends: .testrunner
57+
stage: tests
58+
parallel:
59+
matrix:
60+
- PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
61+
variables:
62+
CMAKE_BUILD_PARALLEL_LEVEL: 12
63+
PIP_VERBOSE: 1
64+
DD_PROFILING_NATIVE_TESTS: 1
65+
script:
66+
- pip install riot==0.20.0
67+
- riot -P -v generate --python=$PYTHON_VERSION
68+
artifacts:
69+
name: venv_$PYTHON_VERSION
70+
paths:
71+
- .riot/venv_*
72+
- ddtrace/**/*.so*
73+
- ddtrace/internal/datadog/profiling/crashtracker/crashtracker_exe*
74+
- ddtrace/internal/datadog/profiling/test/test_*
75+
3576
.test_base_riot:
3677
extends: .testrunner
3778
stage: tests
@@ -71,13 +112,20 @@ variables:
71112
# DEV: All job variables get shared with services, setting `DD_TRACE_AGENT_URL` on the testagent will tell it to forward all requests to the
72113
# agent at that host. Therefore setting this as a variable will cause recursive requests to the testagent
73114
- export DD_TRACE_AGENT_URL="http://testagent:9126"
115+
- ln -s "${CI_PROJECT_DIR}" "/root/project"
116+
117+
slotscheck:
118+
extends: .testrunner
119+
stage: tests
120+
needs: []
121+
script:
122+
- hatch run slotscheck:_
123+
124+
conftests:
125+
extends: .testrunner
126+
stage: tests
127+
needs: []
128+
script:
129+
- hatch run meta-testing:meta-testing
74130

75-
include:
76-
- local: ".gitlab/tests/appsec.yml"
77-
- local: ".gitlab/tests/ci_visibility.yml"
78-
- local: ".gitlab/tests/contrib.yml"
79-
- local: ".gitlab/tests/core.yml"
80-
- local: ".gitlab/tests/debugging.yml"
81-
- local: ".gitlab/tests/llmobs.yml"
82-
- local: ".gitlab/tests/tracer.yml"
83-
- local: ".gitlab/tests/profiling.yml"
131+
# Required jobs will appear here

.gitlab/tests/appsec.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.gitlab/tests/ci_visibility.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)