Skip to content

Commit c5213ff

Browse files
authored
ci: update testrunner and use dd-octo-sts everywhere (#14152)
Use the latest version of testrunner image in CI, including the new one which contains `dd-octo-sts` got GitHub token management. This PR: - Use the new image locally and in CI - We use the ghcr image still locally since external contributors need to be able to pull the image - Don't install riot when we already have it baked in - Replace aws ssm with dd-octo-sts to generate GitHub API tokens - Update scripts/ddtest for the new projects directory for the testrunner image The biggest change being introduced here is we are moving to a testrunner image which uses the user `bits` by default `/home/bits/` as the working directory. ## 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 - [ ] 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)
1 parent 6f5cc35 commit c5213ff

25 files changed

+57
-63
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ disable_warnings = couldnt-parse
88
[paths]
99
source =
1010
./
11-
/home/circleci/project/
1211
/root/project/
12+
/home/bits/project

.github/workflows/requirements-locks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
validate:
1212
name: Check requirements lockfiles
1313
runs-on: ubuntu-latest
14-
container: ghcr.io/datadog/dd-trace-py/testrunner:bca6869fffd715ea9a731f7b606807fa1b75cb71@sha256:9e3f53fa98ffc4b838b959d74d969aa2c384c4cbee7a3047a03d501be5f58760
14+
container:
15+
image: ghcr.io/datadog/dd-trace-py/testrunner:ae4c189ebf8e539f39905f21c7918cc19de69d13@sha256:9476c426c677d39a58c170ed3167e4d630ed4f067a8a2be2fb96d843795d2ac2
16+
options: "--user 0"
1517
steps:
1618
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1719
with:

.gitlab-ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ include:
4242
tests-gen:
4343
stage: tests
4444
extends: .testrunner
45+
id_tokens:
46+
DDOCTOSTS_ID_TOKEN:
47+
aud: dd-octo-sts
4548
script:
46-
- pip install riot==0.20.1
49+
- |
50+
if [ -z ${GH_TOKEN} ]
51+
then
52+
# Use dd-octo-sts to get GitHub token
53+
export GH_TOKEN=$(dd-octo-sts token --scope DataDog/dd-trace-py --policy gitlab.github-access.read)
54+
fi
4755
- riot -v run --pass-env -s gitlab-gen-config -v
4856
needs: []
4957
artifacts:

.gitlab/benchmarks/microbenchmarks.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variables:
88
BENCHMARKING_IMAGE_REGISTRY: 486234852809.dkr.ecr.us-east-1.amazonaws.com
99
MICROBENCHMARKS_CI_IMAGE: $BENCHMARKING_IMAGE_REGISTRY/ci/benchmarking-platform:dd-trace-py
1010
PACKAGE_IMAGE: registry.ddbuild.io/images/mirror/pypa/manylinux2014_x86_64:2024-08-12-7fde9b1
11-
GITHUB_CLI_IMAGE: registry.ddbuild.io/github-cli:v27480869-eafb11d-2.43.0
11+
GITHUB_CLI_IMAGE: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1
1212
BENCHMARKING_BRANCH: dd-trace-py
1313

1414
.benchmarks:
@@ -64,6 +64,9 @@ baseline:detect:
6464
image: $GITHUB_CLI_IMAGE
6565
tags: [ "arch:amd64" ]
6666
stage: build
67+
id_tokens:
68+
DDOCTOSTS_ID_TOKEN:
69+
aud: dd-octo-sts
6770
variables:
6871
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
6972
script: |
@@ -74,7 +77,8 @@ baseline:detect:
7477
7578
if [ -z ${GH_TOKEN} ]
7679
then
77-
aws ssm get-parameter --region us-east-1 --name ci.$CI_PROJECT_NAME.gh_token --with-decryption --query "Parameter.Value" --out text > token
80+
# Use dd-octo-sts to get GitHub token
81+
dd-octo-sts token --scope DataDog/dd-trace-py --policy gitlab.github-access.read > token
7882
gh auth login --with-token < token
7983
rm token
8084
fi

.gitlab/templates/build-base-venvs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ build_base_venvs:
1818
- when: always
1919
script: |
2020
set -e -o pipefail
21-
apt update && apt install -y sccache
22-
pip install riot==0.20.1
2321
riot -P -v generate --python=$PYTHON_VERSION
2422
echo "Running smoke tests"
2523
riot -v run -s --python=$PYTHON_VERSION smoke_test

.gitlab/templates/cached-testrunner.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
extends: .testrunner
33
variables:
44
PIP_CACHE_DIR: '${{CI_PROJECT_DIR}}/.cache/pip'
5-
SCCACHE_DIR: '${{CI_PROJECT_DIR}}/.cache/sccache'
65
EXT_CACHE_VENV: '${{CI_PROJECT_DIR}}/.cache/ext_cache_venv'
76
before_script: |
87
ulimit -c unlimited
@@ -26,13 +25,13 @@
2625
deactivate
2726
$SHELL scripts/save-ext-cache.sh
2827
cache:
29-
# Share pip/sccache between jobs of the same Python version
30-
- key: v1-build_base_venvs-${{PYTHON_VERSION}}-cache-{current_month}
28+
# Share pip between jobs of the same Python version
29+
- key: v2-build_base_venvs-${{PYTHON_VERSION}}-cache-{current_month}
3130
paths:
3231
- .cache
33-
- key: v1-build_base_venvs-${{PYTHON_VERSION}}-ext-{current_month}
32+
- key: v2-build_base_venvs-${{PYTHON_VERSION}}-ext-{current_month}
3433
paths:
3534
- .ext_cache
36-
- key: v1-build_base_venvs-${{PYTHON_VERSION}}-download-cache-{current_month}
35+
- key: v2-build_base_venvs-${{PYTHON_VERSION}}-download-cache-{current_month}
3736
paths:
3837
- .download_cache

.gitlab/testrunner.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
variables:
2+
TESTRUNNER_IMAGE: registry.ddbuild.io/dd-trace-py:v72171907-b7ecc7e-testrunner-2025.07.29@sha256:0951475f34dad2b2eed3f30f79895676dd6fb9c1ae2563c93729942ebbb269aa
3+
14
.testrunner:
2-
image: ghcr.io/datadog/dd-trace-py/testrunner:8b69a2610342b333f8832422ffc4f3a9327bed13@sha256:c2d067947ffdb305fc7dc7ff1f8eb7035cfa110bd1199917dd2519eadd166402
5+
image:
6+
name: ${TESTRUNNER_IMAGE}
7+
docker:
8+
user: bits
39
# DEV: we have a larger pool of amd64 runners, prefer that over arm64
410
tags: [ "arch:amd64" ]
511
timeout: 20m
612
before_script:
713
- ulimit -c unlimited
14+
- git config --global --add safe.directory ${CI_PROJECT_DIR}
815
- pyenv global 3.12 3.8 3.9 3.10 3.11 3.13
916
- export _CI_DD_AGENT_URL=http://${HOST_IP}:8126/
1017
retry: 2

.gitlab/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ include:
9898
# 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
9999
# agent at that host. Therefore setting this as a variable will cause recursive requests to the testagent
100100
- export DD_TRACE_AGENT_URL="http://testagent:9126"
101-
- ln -s "${CI_PROJECT_DIR}" "/root/project"
101+
- ln -s "${CI_PROJECT_DIR}" "/home/bits/project"
102102

103103

104104
# Required jobs will appear here

.riot/requirements/1336cbd.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pastedeploy==3.1.0
2222
plaster==1.1.2
2323
plaster-pastedeploy==1.0.1
2424
pluggy==1.5.0
25-
pserve-test-app @ file:///root/project/tests/contrib/pyramid/pserve_app
25+
pserve-test-app @ file:///home/bits/project/tests/contrib/pyramid/pserve_app
2626
pyramid==2.0.2
2727
pytest==8.3.1
2828
pytest-cov==5.0.0

.riot/requirements/192e4d0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pastedeploy==3.1.0
2222
plaster==1.1.2
2323
plaster-pastedeploy==1.0.1
2424
pluggy==1.5.0
25-
pserve-test-app @ file:///root/project/tests/contrib/pyramid/pserve_app
25+
pserve-test-app @ file:///home/bits/project/tests/contrib/pyramid/pserve_app
2626
pyramid==2.0.2
2727
pytest==8.3.1
2828
pytest-cov==5.0.0

0 commit comments

Comments
 (0)