Skip to content

Commit d7b93c2

Browse files
committed
Setup update
1 parent 3c076dd commit d7b93c2

File tree

3 files changed

+134
-2
lines changed

3 files changed

+134
-2
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,7 +4508,9 @@ stages:
45084508
versionSpec: '3.12'
45094509
displayName: Install python 3.12
45104510

4511-
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
4511+
- script: git clone https://github.com/DataDog/system-tests.git --revision $SYSTEM_TESTS_REF
4512+
env:
4513+
SYSTEM_TESTS_REF: 0fb4a33cf727c23aa3f796ff3c9bc6499a9ea01e # Automated: This reference is automatically updated.
45124514
displayName: Get system tests repo
45134515

45144516
- script: |
@@ -4619,7 +4621,9 @@ stages:
46194621
versionSpec: '3.12'
46204622
displayName: Install python 3.12
46214623

4622-
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
4624+
- script: git clone https://github.com/DataDog/system-tests.git --revision $SYSTEM_TESTS_REF
4625+
env:
4626+
SYSTEM_TESTS_REF: 0fb4a33cf727c23aa3f796ff3c9bc6499a9ea01e # Automated: This reference is automatically updated.
46234627
displayName: Get system tests repo
46244628

46254629
- template: steps/download-artifact.yml
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# This script updates the reference in a YAML file.
4+
5+
# Check if required environment variables are set
6+
if [ -z "$TARGET" ]; then
7+
echo "Error: TARGET environment variable is not set"
8+
exit 1
9+
fi
10+
11+
if [ -z "$REF" ]; then
12+
echo "Error: REF environment variable is not set"
13+
exit 1
14+
fi
15+
16+
if [ -z "$PATTERN" ]; then
17+
echo "Error: PATTERN environment variable is not set"
18+
exit 1
19+
fi
20+
21+
echo "Target: $TARGET"
22+
echo "Ref: $REF"
23+
24+
# Remove leading and trailing forward slashes from pattern
25+
CLEAN_PATTERN=$(echo "$PATTERN" | sed 's/^\///;s/\/$//')
26+
echo "Pattern: $CLEAN_PATTERN"
27+
28+
# Create a temporary file
29+
TEMP_FILE=$(mktemp)
30+
31+
# Read the file and perform the substitution
32+
if [ -f "$TARGET" ]; then
33+
# Perform the substitution and save to temporary file
34+
# We use perl here because sed's regex support varies across platforms
35+
perl -pe "s/$CLEAN_PATTERN/\${1}$REF\${3}/g" "$TARGET" > "$TEMP_FILE"
36+
37+
# Compare files to check if any changes were made
38+
if cmp -s "$TARGET" "$TEMP_FILE"; then
39+
echo "No references found in $TARGET"
40+
else
41+
# Copy the temp file back to the target
42+
cp "$TEMP_FILE" "$TARGET"
43+
echo "✓ Updated references in $TARGET"
44+
fi
45+
else
46+
echo "Error: Target file $TARGET does not exist"
47+
rm -f "$TEMP_FILE"
48+
exit 1
49+
fi
50+
51+
# Clean up temporary file
52+
rm -f "$TEMP_FILE"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Update System Tests
2+
3+
on: # yamllint disable-line rule:truthy
4+
schedule:
5+
- cron: '0 0 * * 0' # Every Sunday at midnight
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: Reference to be updated (commit hash, branch, or tag)
10+
required: false
11+
type: string
12+
dry-run:
13+
description: Skip PR creation and only show changes
14+
required: false
15+
type: boolean
16+
default: false
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
# Default permissions for all jobs
23+
permissions: {}
24+
25+
jobs:
26+
update-system-tests:
27+
name: "Update System Tests"
28+
runs-on: ubuntu-24.04
29+
steps:
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: true
33+
34+
- name: Checkout System Test
35+
id: system-test-ref
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
repository: "DataDog/system-tests"
39+
path: system-tests
40+
persist-credentials: false
41+
ref: ${{ github.event.inputs.ref || '' }}
42+
43+
- run: .github/scripts/update_reference.sh
44+
env:
45+
TARGET: ".azure-pipelines/ultimate-pipeline.yml"
46+
PATTERN: '(\s*SYSTEM_TESTS_REF:\s+)(\S+)(\s+# Automated:.*)'
47+
REF: ${{ steps.system-test-ref.outputs.commit }}
48+
49+
- run: git diff --color=always
50+
51+
- name: Generate GitHub App Token
52+
id: generate-token
53+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
54+
with:
55+
app-id: ${{ secrets.APP_ID }}
56+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
57+
58+
- name: Create Pull Request
59+
if: ${{ github.event.inputs.dry-run != true }}
60+
id: cpr
61+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
62+
with:
63+
token: ${{ steps.generate-token.outputs.token }}
64+
branch: auto-generate/update-system-tests
65+
title: '[🤖] Update System Tests'
66+
base: master
67+
sign-commits: true
68+
labels: dev/internal
69+
commit-message: "[🤖] Update System Tests: ${{github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
70+
delete-branch: true
71+
add-paths: |
72+
.azure-pipelines/
73+
body: |
74+
_This is an auto-generated PR from [here](${{github.server_url}}/${{ github.repository }}/blob/master/.github/workflows/update-system-tests.yml)_
75+
The PR updates the system tests (Updated to commit: ${{ steps.system-test-ref.outputs.commit }})
76+
Please review the changes and merge when ready

0 commit comments

Comments
 (0)