Skip to content

Commit 8e06cd1

Browse files
authored
ci: backport of conditional system tests configuration (#6758)
We backport the changes to the system tests GitHub action configuration to get its benefits on lower release branches, since the jobs are now marked as required on PRs. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Title is accurate. - [ ] No unnecessary changes are introduced. - [ ] Description motivates each change. - [ ] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Testing strategy adequately addresses listed risk(s). - [ ] Change is maintainable (easy to change, telemetry, documentation). - [ ] Release note makes sense to a user of the library. - [ ] Reviewer has explicitly 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) - [ ] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [ ] This PR doesn't touch any of that.
1 parent 4f7150c commit 8e06cd1

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

.github/workflows/system-tests.yml

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@ name: System Tests
22

33
on:
44
push:
5+
branches:
6+
- 0.x
7+
- 1.x
8+
pull_request:
59
workflow_dispatch: {}
610
schedule:
711
- cron: '00 04 * * 2-6'
812

913
jobs:
14+
needs-run:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
outcome: ${{ steps.run_needed.outcome }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- id: run_needed
21+
name: Check if run is needed
22+
run: |
23+
git fetch origin ${{ github.event.pull_request.base.sha }}
24+
export PATHS=$(git diff --name-only HEAD ${{ github.event.pull_request.base.sha }})
25+
python -c "import os,sys,fnmatch;sys.exit(not bool([_ for pattern in {'ddtrace/*', 'setup*', 'pyproject.toml', '.github/workflows/system-tests.yml'} for _ in fnmatch.filter(os.environ['PATHS'].splitlines(), pattern)]))"
26+
continue-on-error: true
27+
1028
system-tests:
1129
runs-on: ubuntu-latest
30+
needs: needs-run
1231
strategy:
1332
matrix:
1433
include:
@@ -25,115 +44,146 @@ jobs:
2544
DD_API_KEY: 1234567890abcdef1234567890abcdef
2645
steps:
2746
- name: Setup python 3.9
47+
if: needs.needs-run.outputs.outcome == 'success'
2848
uses: actions/setup-python@v4
2949
with:
3050
python-version: '3.9'
3151

3252
- name: Checkout system tests
53+
if: needs.needs-run.outputs.outcome == 'success'
3354
uses: actions/checkout@v3
3455
with:
3556
repository: 'DataDog/system-tests'
3657

3758
- name: Checkout dd-trace-py
59+
if: needs.needs-run.outputs.outcome == 'success'
3860
uses: actions/checkout@v3
3961
with:
4062
path: 'binaries/dd-trace-py'
4163
fetch-depth: 0
4264

4365
- name: Build
66+
if: needs.needs-run.outputs.outcome == 'success'
4467
run: ./build.sh
4568

4669
- name: Run
70+
if: needs.needs-run.outputs.outcome == 'success'
4771
run: ./run.sh
4872

4973
- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
74+
if: needs.needs-run.outputs.outcome == 'success'
5075
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
5176

5277
- name: Run REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
78+
if: needs.needs-run.outputs.outcome == 'success'
5379
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
5480

5581
- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
82+
if: needs.needs-run.outputs.outcome == 'success'
5683
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
5784

5885
- name: Run APPSEC_MISSING_RULES
86+
if: needs.needs-run.outputs.outcome == 'success'
5987
run: ./run.sh APPSEC_MISSING_RULES
6088

6189
- name: Run APPSEC_CUSTOM_RULES
90+
if: needs.needs-run.outputs.outcome == 'success'
6291
run: ./run.sh APPSEC_CUSTOM_RULES
6392

6493
- name: Run APPSEC_CORRUPTED_RULES
94+
if: needs.needs-run.outputs.outcome == 'success'
6595
run: ./run.sh APPSEC_CORRUPTED_RULES
6696

6797
- name: Run APPSEC_RULES_MONITORING_WITH_ERRORS
98+
if: needs.needs-run.outputs.outcome == 'success'
6899
run: ./run.sh APPSEC_RULES_MONITORING_WITH_ERRORS
69100

70101
- name: Run APPSEC_BLOCKING
102+
if: needs.needs-run.outputs.outcome == 'success'
71103
run: ./run.sh APPSEC_BLOCKING
72104

73105
- name: Run APPSEC_DISABLED
106+
if: needs.needs-run.outputs.outcome == 'success'
74107
run: ./run.sh APPSEC_DISABLED
75108

76109
- name: Run APPSEC_LOW_WAF_TIMEOUT
110+
if: needs.needs-run.outputs.outcome == 'success'
77111
run: ./run.sh APPSEC_LOW_WAF_TIMEOUT
78112

79113
- name: Run APPSEC_CUSTOM_OBFUSCATION
114+
if: needs.needs-run.outputs.outcome == 'success'
80115
run: ./run.sh APPSEC_CUSTOM_OBFUSCATION
81116

82117
- name: Run APPSEC_RATE_LIMITER
118+
if: needs.needs-run.outputs.outcome == 'success'
83119
run: ./run.sh APPSEC_RATE_LIMITER
84120

85121
- name: Run APPSEC_BLOCKING_FULL_DENYLIST
122+
if: needs.needs-run.outputs.outcome == 'success'
86123
run: ./run.sh APPSEC_BLOCKING_FULL_DENYLIST
87124

88125
- name: Run APPSEC_REQUEST_BLOCKING
126+
if: needs.needs-run.outputs.outcome == 'success'
89127
run: ./run.sh APPSEC_REQUEST_BLOCKING
90128

91129
- name: Run APPSEC_RUNTIME_ACTIVATION
130+
if: needs.needs-run.outputs.outcome == 'success'
92131
run: ./run.sh APPSEC_RUNTIME_ACTIVATION
93132

94133
- name: Run APPSEC_WAF_TELEMETRY
134+
if: needs.needs-run.outputs.outcome == 'success'
95135
run: ./run.sh APPSEC_WAF_TELEMETRY
96136

97137
- name: Run SAMPLING
138+
if: needs.needs-run.outputs.outcome == 'success'
98139
run: ./run.sh SAMPLING
99140

100141
# even on failures, we want to have artifact to be able to investigate
101142
# The compress step speed up a lot the upload artifact process
102143
- name: Compress artifact
103-
if: ${{ always() }}
144+
if: needs.needs-run.outputs.outcome == 'success'
104145
run: tar -czvf artifact.tar.gz $(ls | grep logs)
105146

106147
- name: Upload artifact
107148
uses: actions/upload-artifact@v3
108-
if: ${{ always() }}
149+
if: needs.needs-run.outputs.outcome == 'success'
109150
with:
110151
name: logs_${{ matrix.weblog-variant }}
111152
path: artifact.tar.gz
112153

113154
parametric:
114155
runs-on: ubuntu-latest
156+
needs: needs-run
115157
env:
116158
TEST_LIBRARY: python
117159
PYTHON_DDTRACE_PACKAGE: git+https://github.com/Datadog/dd-trace-py.git@${{ github.sha }}
118160
steps:
119161
- name: Checkout system tests
162+
if: needs.needs-run.outputs.outcome == 'success'
120163
uses: actions/checkout@v3
121164
with:
122165
repository: 'DataDog/system-tests'
166+
123167
- uses: actions/setup-python@v4
168+
if: needs.needs-run.outputs.outcome == 'success'
124169
with:
125170
python-version: '3.9'
171+
126172
- name: Build
173+
if: needs.needs-run.outputs.outcome == 'success'
127174
run: ./build.sh -i runner
175+
128176
- name: Run
177+
if: needs.needs-run.outputs.outcome == 'success'
129178
run: ./run.sh PARAMETRIC
130179

131180
- name: Compress artifact
132-
if: ${{ always() }}
181+
if: needs.needs-run.outputs.outcome == 'success'
133182
run: tar -czvf artifact.tar.gz $(ls | grep logs)
183+
134184
- name: Upload artifact
135185
uses: actions/upload-artifact@v3
136-
if: ${{ always() }}
186+
if: needs.needs-run.outputs.outcome == 'success'
137187
with:
138188
name: logs_parametric
139189
path: artifact.tar.gz

0 commit comments

Comments
 (0)