@@ -46,111 +46,18 @@ jobs:
4646 _system_tests_dev_mode : ${{ matrix.version == 'dev' }}
4747 push_to_test_optimization : true
4848
49- create_test_report :
50- name : Create test report
51- permissions :
52- contents : read
53- packages : read
54- if : (success() || failure()) && github.event_name == 'schedule'
55- needs :
56- - nightly
57- runs-on : ubuntu-latest
58- steps :
59- - name : Checkout
60- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
61- with :
62- sparse-checkout : .github/actions
63- sparse-checkout-cone-mode : false
64- - name : Download logs artifact
65- uses : ./.github/actions/download_artifact
66- with :
67- merge-multiple : false
68- pattern : logs_*
69- - name : Uncompress logs
70- run : |
71- for d in logs_*; do
72- if [ -f "$d/artifact.tar.gz" ]; then
73- tar -xzf "$d/artifact.tar.gz" -C "$d" --wildcards '*/report.json' || true
74- fi
75- done
76- - name : Upload test report
77- uses : ./.github/actions/upload_artifact
78- with :
79- name : test-report
80- path : |
81- logs_*
82- !logs_*/artifact.tar.gz
83-
8449 test_activation :
8550 name : Test activation
8651 runs-on : ubuntu-latest
8752 if : (success() || failure()) && github.event_name == 'schedule'
88- strategy :
89- fail-fast : false
90- matrix :
91- library :
92- - cpp
93- - cpp_httpd
94- - cpp_nginx
95- - dotnet
96- - golang
97- - java
98- - nodejs
99- - php
100- - python
101- - python_lambda
102- - nodejs_lambda
103- - ruby
104- - rust
105- include :
106- - library : cpp
107- exclude_owners : " "
108- use_dev : " "
109- - library : cpp_httpd
110- exclude_owners : " "
111- use_dev : " "
112- - library : cpp_nginx
113- exclude_owners : " "
114- use_dev : " "
115- - library : dotnet
116- exclude_owners : " "
117- use_dev : " "
118- - library : golang
119- exclude_owners : " "
120- use_dev : " "
121- - library : java
122- exclude_owners : " "
123- use_dev : " "
124- - library : nodejs
125- exclude_owners : " "
126- use_dev : " "
127- - library : php
128- exclude_owners : " "
129- use_dev : " "
130- - library : python
131- exclude_owners : " "
132- use_dev : " "
133- - library : python_lambda
134- exclude_owners : " "
135- use_dev : " "
136- - library : nodejs_lambda
137- exclude_owners : " "
138- use_dev : " "
139- - library : ruby
140- exclude_owners : " "
141- use_dev : " "
142- - library : rust
143- exclude_owners : " "
144- use_dev : " true"
14553 permissions :
14654 contents : read
14755 actions : read
56+ packages : read
14857 id-token : write
14958 pull-requests : write
15059 needs :
151- - create_test_report
152- env :
153- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60+ - nightly
15461
15562 steps :
15663 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
16269
16370 - uses : ./.github/actions/download_artifact
16471 with :
165- name : test-report
72+ merge-multiple : false
73+ pattern : logs_*
16674 path : data
16775
16876 - uses : DataDog/system-tests/.github/actions/install_runner@main
@@ -173,122 +81,27 @@ jobs:
17381 source venv/bin/activate
17482 python -m pip install --upgrade pip ruamel.yaml requests tqdm pygtrie
17583
176- - name : Configure git
177- run : |
178- git config --global user.name 'github-actions[bot]'
179- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
180-
181- - name : Run activation script
182- id : activation_script
183- shell : bash
184- run : |
185- source venv/bin/activate
186- set +e
187- EXTRA_ARGS=""
188- if [[ -n "${{ matrix.exclude_owners }}" ]]; then
189- EXTRA_ARGS="$EXTRA_ARGS --exclude ${{ matrix.exclude_owners }}"
190- fi
191- if [[ -n "${{ matrix.use_dev }}" ]]; then
192- EXTRA_ARGS="$EXTRA_ARGS --dev"
193- fi
194- python -m utils.scripts.activate_easy_wins --no-download --split-co --components "${{ matrix.library }}" $EXTRA_ARGS
195- EXIT_CODE=$?
196- set -e
197- echo "activation_exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT"
198-
199- # Collect branches created by --split-co
200- BRANCHES=$(git branch --list 'easy-win/*/${{ matrix.library }}' --format='%(refname:short)' | tr '\n' ' ')
201- echo "branches=$BRANCHES" >> "$GITHUB_OUTPUT"
202-
20384 - uses : DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
20485 id : octo-sts
205- if : steps.activation_script.outputs.activation_exit_code == '0' && steps.activation_script.outputs.branches != ''
20686 with :
20787 scope : DataDog/system-tests
20888 policy : self.test-activation-github
20989
21090 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
211- if : steps.activation_script.outputs.activation_exit_code == '0' && steps.activation_script.outputs.branches != ''
21291 with :
21392 repository : DataDog/commit-headless
21493 ref : action/v3.3.0
21594 path : .commit-headless
21695
217- - name : Push signed branches and create PRs
218- if : steps.activation_script.outputs.activation_exit_code == '0' && steps.activation_script.outputs.branches != ''
96+ - name : Run nightly activation
21997 env :
22098 GITHUB_TOKEN : ${{ steps.octo-sts.outputs.token }}
221- PR_REVIEW_TOKEN : ${{ github.token }}
22299 shell : bash
223100 run : |
224- gh auth setup-git
225- chmod +x .commit-headless/dist/commit-headless-linux-amd64
226- COMMIT_HEADLESS=".commit-headless/dist/commit-headless-linux-amd64"
227- REVIEW_BODY="This automated easy-win activation PR intentionally starts with requested changes "
228- REVIEW_BODY+="to block automatic merge. If you approve this activation, please merge it manually "
229- REVIEW_BODY+="or dismiss this review according to repository rules."
230-
231- for BRANCH_NAME in ${{ steps.activation_script.outputs.branches }}; do
232- echo "============ Processing $BRANCH_NAME ============"
233-
234- # Extract owner name from branch: easy-win/<owner>/<library> -> <owner>
235- OWNER=$(echo "$BRANCH_NAME" | cut -d'/' -f2)
236-
237- # Check if a PR already exists for this branch
238- PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' 2>/dev/null || true)
239-
240- if [[ -n "$PR_NUMBER" ]]; then
241- # Skip if the PR has any human activity (comments, reviews, or extra commits)
242- COMMENTS=$(gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" --jq '[.[] | select(.user.type != "Bot")] | length')
243- REVIEWS=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/reviews" --jq '[.[] | select(.user.type != "Bot")] | length')
244- COMMITS=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --jq 'length')
245-
246- if [[ "$COMMENTS" -gt 0 || "$REVIEWS" -gt 0 || "$COMMITS" -gt 1 ]]; then
247- echo "PR #$PR_NUMBER for $BRANCH_NAME has activity (comments=$COMMENTS, reviews=$REVIEWS, commits=$COMMITS), skipping"
248- continue
249- fi
250- echo "PR #$PR_NUMBER exists but has no activity, updating"
251- fi
252-
253- git checkout "$BRANCH_NAME"
254- MAIN_SHA=$(git rev-parse main)
255-
256- if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
257- SIGNED_COMMIT=$(git log --reverse --format="%H" "$MAIN_SHA..HEAD" | \
258- HEADLESS_TOKEN="$GITHUB_TOKEN" $COMMIT_HEADLESS push \
259- -T "${{ github.repository }}" --branch "$BRANCH_NAME" \
260- --head-sha "$MAIN_SHA" --force)
261- else
262- SIGNED_COMMIT=$(git log --reverse --format="%H" "$MAIN_SHA..HEAD" | \
263- HEADLESS_TOKEN="$GITHUB_TOKEN" $COMMIT_HEADLESS push \
264- -T "${{ github.repository }}" --branch "$BRANCH_NAME" \
265- --head-sha "$MAIN_SHA" --create-branch)
266- fi
267- echo "Pushed signed commit $SIGNED_COMMIT to $BRANCH_NAME"
268-
269- # Create PR if it doesn't exist
270- if [[ -z "$PR_NUMBER" ]]; then
271- gh pr create \
272- --title "Auto-activate ${{ matrix.library }} easy wins for $OWNER" \
273- --body "Automated activation of easy-win tests for \`${{ matrix.library }}\` owned by \`$OWNER\`
274- [View nightly workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
275- - This PR is created ready for review and can be merged according to repository rules.
276- - If the tests are failing it might be due to a change made since the last nightly system-tests run. You can close the PR, an updated one will be available tomorrow.
277- - If you close the PR please also delete the branch" \
278- --head "$BRANCH_NAME" \
279- --base main
280- PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number')
281-
282- # This block can be activated to add a change request on new PRs to block auto merge (you also need to add --draft to gh pr create)
283- # echo "Requesting changes on newly created PR #$PR_NUMBER to block automatic merge..."
284- # GH_TOKEN="$PR_REVIEW_TOKEN" gh pr review "$PR_NUMBER" --request-changes --body "$REVIEW_BODY"
285- #
286- # echo "Marking PR #$PR_NUMBER as ready for review..."
287- # gh pr ready "$PR_NUMBER"
288- fi
289-
290- # # Enable auto-merge on the PR
291- # echo "Enabling auto-merge on PR #$PR_NUMBER..."
292- # gh pr merge "$PR_NUMBER" --auto --squash
293-
294- done
101+ source venv/bin/activate
102+ python utils/ci/github/nightly.py activate \
103+ --reports-dir data \
104+ --commit-headless .commit-headless/dist/commit-headless-linux-amd64 \
105+ --repository "${{ github.repository }}" \
106+ --server-url "${{ github.server_url }}" \
107+ --run-id "${{ github.run_id }}"
0 commit comments