Skip to content

Commit e61d957

Browse files
authored
Improve our CI visibility reporting and streamline test-target (DataDog#22355)
* Use official datadog GH action to monitor CI visibility * Add changelog * Add some debugging for failing tests * Remove action and ensure ddtrace is a depdnency of the default environment * Revert changes for debugging in test_agent_packages * Remove profiling * Remove trace analytics * Disable subprocess tracing * Try removing git metadta gathering * Debug messages to understand git issues * Fix formattingh * Fix error in debug code * Fix formatting * Make sure we unshallwo the repo * Also unshallwo for windows setup for ddev * Add test environment name to differentiate between e2e and unit tests * Update documentation * Add ci visibility to e2e tests as well * Try reducing the size of test-target * Streamline test-target to reduce the object footprint on actions * Ensure python version set to 3.13 when input is an empty string * Ensure python version is updatable through the py upgrade script * Print actual ddev command run when executing tests * Update ddev env test command to respect trace enabled option * Fix update_py_config script patterns * Fix AppEnvVar for enable tracing * Modify integration tag to target * Tag jobs with the same tags as we tag tests * Add target_env tag to the test workflow * Make bash script more robust * Avoid running flaky tests in pr-all * Fix handling of pytest args * Address comments
1 parent c34a9fb commit e61d957

34 files changed

Lines changed: 476 additions & 5114 deletions

.ddev/ci/scripts/ddev/linux/55_fetch_master.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Only required on non-master branches
6+
# To benefit from ci visibility, ddtrace needs to explore git and the local clone we do in ddev tests
7+
# from a shallow repo can break it. Lets get the full repo so we have a proper repo to clone from locally.
8+
9+
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
10+
echo "Repository is shallow. Unshallowing to get full history..."
11+
# --unshallow: Downloads the rest of the commit history
12+
# --tags: Ensures we get tags (useful for versioning)
13+
# -f: Force update references if needed
14+
git fetch --unshallow --tags -f origin
15+
fi
16+
17+
# 2. Your original logic: Ensure we have the master branch reference locally
18+
# (Unshallowing gets the history, but doesn't necessarily create the local 'master' ref)
19+
if [[ "$GITHUB_REF_NAME" != "master" ]]; then
20+
git fetch origin master:master
21+
fi
22+
23+
set +ex

.ddev/ci/scripts/ddev/windows/55_fetch_master.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo on
2+
3+
:: 1. Check if the repo is shallow by capturing the output of the git command
4+
FOR /F "tokens=*" %%g IN ('git rev-parse --is-shallow-repository') do (SET IS_SHALLOW=%%g)
5+
6+
:: 2. If it is shallow ("true"), fetch the full history
7+
IF "%IS_SHALLOW%"=="true" (
8+
ECHO Repository is shallow. Unshallowing to get full history...
9+
git fetch --unshallow --tags -f origin
10+
)
11+
12+
:: 3. Only required on non-master branches (Your original logic)
13+
if "%GITHUB_REF_NAME%" NEQ "master" (
14+
git fetch origin master:master
15+
)

.ddev/ci/scripts/traces.py

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

.github/actions/tag-job/action.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 'Tag Job with Datadog CI'
2+
description: 'Tags the current job with custom tags for CI Visibility in Datadog'
3+
4+
inputs:
5+
tags:
6+
description: 'Comma-separated list of tags to add (e.g., "custom_tag:value,another_tag:value2")'
7+
required: true
8+
dd_api_key:
9+
description: 'Datadog API key'
10+
required: true
11+
dd_site:
12+
description: 'Datadog site (e.g., datadoghq.com, datad0g.com)'
13+
required: false
14+
default: 'datadoghq.com'
15+
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Set up Node.js
20+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
21+
with:
22+
node-version: '20'
23+
24+
- name: Install datadog-ci and tag job
25+
shell: bash
26+
env:
27+
DATADOG_API_KEY: ${{ inputs.dd_api_key }}
28+
DATADOG_SITE: ${{ inputs.dd_site }}
29+
TAGS: ${{ inputs.tags }}
30+
run: |
31+
npm install -g @datadog/datadog-ci
32+
33+
# Convert comma-separated tags to --tags flag format
34+
# e.g., "tag1:value1,tag2:value2" becomes "--tags tag1:value1 --tags tag2:value2"
35+
TAGS_ARGS=""
36+
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"
37+
for tag in "${TAG_ARRAY[@]}"; do
38+
TAGS_ARGS="$TAGS_ARGS --tags $tag"
39+
done
40+
41+
datadog-ci tag --level job $TAGS_ARGS

.github/workflows/flaky-tests-windows.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,3 @@ jobs:
4949

5050
uses: ./.github/workflows/test-results-master.yml
5151
secrets: inherit
52-
53-
submit-traces:
54-
needs:
55-
- test
56-
if: success() || failure()
57-
58-
uses: ./.github/workflows/submit-traces.yml
59-
secrets: inherit

.github/workflows/flaky-tests.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,3 @@ jobs:
4747

4848
uses: ./.github/workflows/test-results-master.yml
4949
secrets: inherit
50-
51-
submit-traces:
52-
needs:
53-
- test
54-
if: success() || failure()
55-
56-
uses: ./.github/workflows/submit-traces.yml
57-
secrets: inherit

.github/workflows/master-windows.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,3 @@ jobs:
9696
use_oidc: true
9797
directory: coverage-reports
9898
fail_ci_if_error: false
99-
100-
submit-traces:
101-
needs:
102-
- test
103-
if: success() || failure()
104-
105-
uses: ./.github/workflows/submit-traces.yml
106-
secrets: inherit

.github/workflows/master.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,3 @@ jobs:
9393
use_oidc: true
9494
directory: coverage-reports
9595
fail_ci_if_error: false
96-
97-
submit-traces:
98-
needs:
99-
- test
100-
if: success() || failure()
101-
102-
uses: ./.github/workflows/submit-traces.yml
103-
secrets: inherit

0 commit comments

Comments
 (0)