Skip to content

Commit 9eb410d

Browse files
authored
Pin one-pipeline system tests on release branches (#10966)
Pin one-pipeline system tests Test pinning system-tests Revert test pinning Simplify paths Fix comments Co-authored-by: sarah.chen <sarah.chen@datadoghq.com>
1 parent 9769884 commit 9eb410d

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

.github/workflows/create-release-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
run: |
120120
git config user.name "github-actions[bot]"
121121
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
122-
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml
122+
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml .gitlab-ci.yml
123123
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
124124
125125
- name: Push changes

.github/workflows/run-system-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
needs:
6363
- build
6464
# If you change the following comment, update the pattern in the update_system_test_reference.sh script to match.
65-
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main # system tests are pinned for releases only
65+
uses: DataDog/system-tests/.github/workflows/system-tests.yml@main # system tests are pinned on release branches only
6666
secrets:
6767
TEST_OPTIMIZATION_API_KEY: ${{ secrets.DATADOG_API_KEY_PROD }}
6868
permissions:
@@ -72,7 +72,7 @@ jobs:
7272
with:
7373
library: java
7474
# If you change the following comment, update the pattern in the update_system_test_reference.sh script to match.
75-
ref: main # system tests are pinned for releases only
75+
ref: main # system tests are pinned on release branches only
7676
binaries_artifact: binaries
7777
desired_execution_time: 900 # 15 minutes
7878
scenarios_groups: tracer-release

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,7 @@ publishing-gate:
10711071

10721072
configure_system_tests:
10731073
variables:
1074+
SYSTEM_TESTS_REF: main # system tests are pinned on release branches only
10741075
SYSTEM_TESTS_SCENARIOS_GROUPS: "simple_onboarding,simple_onboarding_profiling,simple_onboarding_appsec,docker-ssi,lib-injection"
10751076

10761077
create_key:

tooling/update_system_test_reference.sh

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# This script updates the system-tests reference in run-system-tests.yaml.
4+
# This script updates the system-tests references used by GitHub Actions (run-system-tests.yaml) and GitLab CI (.gitlab-ci.yml).
55
# The reference will be updated with the latest commit SHA of the given branch (or `main` if not set) of https://github.com/DataDog/system-tests.
66
# Usage: BRANCH=<branch-name> tooling/update_system_test_reference.sh
77

@@ -11,9 +11,11 @@ if [ -z "${BRANCH:-}" ]; then
1111
echo "BRANCH is not set. Defaulting to 'main'."
1212
fi
1313

14-
TARGET=".github/workflows/run-system-tests.yaml" # target file to update
15-
PATTERN_1='(\s*system-tests\.yml@)(\S+)(\s+# system tests.*)' # pattern to update the "system-tests.yml@" reference
16-
PATTERN_2='(\s*ref: )(\S+)(\s+# system tests.*)' # pattern to update the "ref:" reference
14+
GITHUB_TARGET=".github/workflows/run-system-tests.yaml"
15+
GITLAB_TARGET=".gitlab-ci.yml"
16+
GITHUB_PATTERN_1='(\s*system-tests\.yml@)(\S+)(\s+# system tests.*)' # pattern to update the "system-tests.yml@" reference
17+
GITHUB_PATTERN_2='(\s*ref: )(\S+)(\s+# system tests.*)' # pattern to update the "ref:" reference
18+
GITLAB_PATTERN='(\s*SYSTEM_TESTS_REF:\s*)(\S+)(\s+# system tests.*)' # pattern to update the GitLab SYSTEM_TESTS_REF variable
1719

1820
echo "Fetching latest commit SHA for system-tests branch: $BRANCH"
1921
REF=$(git ls-remote https://github.com/DataDog/system-tests "refs/heads/$BRANCH" | cut -f 1)
@@ -23,8 +25,13 @@ if [ -z "$REF" ]; then
2325
fi
2426
echo "Fetched SHA: $REF"
2527

26-
if [ ! -f "$TARGET" ]; then
27-
echo "Error: Target file $TARGET does not exist"
28+
if [ ! -f "$GITHUB_TARGET" ]; then
29+
echo "Error: Target file $GITHUB_TARGET does not exist"
30+
exit 1
31+
fi
32+
33+
if [ ! -f "$GITLAB_TARGET" ]; then
34+
echo "Error: Target file $GITLAB_TARGET does not exist"
2835
exit 1
2936
fi
3037

@@ -33,13 +40,18 @@ TEMP_FILE=$(mktemp)
3340

3441
# Update the "system-tests.yml@" reference
3542
echo "Updating 'system-tests.yml@' reference..."
36-
perl -pe "s/$PATTERN_1/\${1}$REF\${3}/g" "$TARGET" > "$TEMP_FILE"
37-
cp "$TEMP_FILE" "$TARGET"
43+
perl -pe "s/$GITHUB_PATTERN_1/\${1}$REF\${3}/g" "$GITHUB_TARGET" > "$TEMP_FILE"
44+
cp "$TEMP_FILE" "$GITHUB_TARGET"
3845

3946
# Update the "ref:" reference
4047
echo "Updating 'ref:' reference..."
41-
perl -pe "s/$PATTERN_2/\${1}$REF\${3}/g" "$TARGET" > "$TEMP_FILE"
42-
cp "$TEMP_FILE" "$TARGET"
48+
perl -pe "s/$GITHUB_PATTERN_2/\${1}$REF\${3}/g" "$GITHUB_TARGET" > "$TEMP_FILE"
49+
cp "$TEMP_FILE" "$GITHUB_TARGET"
50+
51+
# Update the GitLab SYSTEM_TESTS_REF variable
52+
echo "Updating 'SYSTEM_TESTS_REF' reference..."
53+
perl -pe "s/$GITLAB_PATTERN/\${1}$REF\${3}/g" "$GITLAB_TARGET" > "$TEMP_FILE"
54+
cp "$TEMP_FILE" "$GITLAB_TARGET"
4355

4456
# Clean up temporary file
4557
rm -f "$TEMP_FILE"

0 commit comments

Comments
 (0)