2424 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)]))"
2525 continue-on-error : true
2626
27- system-tests :
27+ system-tests-build :
2828 runs-on : ubuntu-latest
2929 needs : needs-run
3030 strategy :
3434 - weblog-variant : uwsgi-poc
3535 - weblog-variant : django-poc
3636 - weblog-variant : fastapi
37- # runs django-poc for 3.12
37+ # runs django-poc for 3.12
3838 - weblog-variant : python3.12
3939 fail-fast : false
4040 env :
4747 CMAKE_BUILD_PARALLEL_LEVEL : 12
4848 steps :
4949 - name : Setup python 3.9
50+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
5051 uses : actions/setup-python@v4
5152 with :
5253 python-version : ' 3.9'
@@ -68,95 +69,165 @@ jobs:
6869 if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
6970 run : ./build.sh
7071
71- - name : Run
72+ - name : Save
73+ id : save
7274 if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
73- run : ./run.sh
75+ run : |
76+ docker image save system_tests/weblog:latest | gzip > ${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
77+ docker image save system_tests/agent:latest | gzip > ${{ matrix.weblog-variant}}_agent_${{ github.sha }}.tar.gz
7478
75- - name : Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
79+ - uses : actions/upload-artifact@master
80+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
81+ with :
82+ name : ${{ matrix.weblog-variant }}_${{ github.sha }}
83+ path : |
84+ ${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
85+ ${{ matrix.weblog-variant}}_agent_${{ github.sha }}.tar.gz
86+ venv
87+ retention-days : 2
88+
89+ system-tests :
90+ runs-on : ubuntu-latest
91+ needs : [needs-run, system-tests-build]
92+ strategy :
93+ matrix :
94+ weblog-variant : [flask-poc, uwsgi-poc , django-poc, fastapi, python3.12]
95+ scenario : [remote-config, appsec, appsec-1, other]
96+
97+ fail-fast : false
98+ env :
99+ TEST_LIBRARY : python
100+ WEBLOG_VARIANT : ${{ matrix.weblog-variant }}
101+ # system-tests requires an API_KEY, but it does not have to be a valid key, as long as we don't run a scenario
102+ # that make assertion on backend data. Using a fake key allow to run system tests on PR originating from forks.
103+ # If ever it's needed, a valid key exists in the repo, using ${{ secrets.DD_API_KEY }}
104+ DD_API_KEY : 1234567890abcdef1234567890abcdef
105+ CMAKE_BUILD_PARALLEL_LEVEL : 12
106+ steps :
107+ - name : Setup python 3.9
76108 if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
109+ uses : actions/setup-python@v4
110+ with :
111+ python-version : ' 3.9'
112+
113+ - name : Checkout system tests
114+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
115+ uses : actions/checkout@v3
116+ with :
117+ repository : ' DataDog/system-tests'
118+
119+ - uses : actions/download-artifact@master
120+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
121+ with :
122+ name : ${{ matrix.weblog-variant }}_${{ github.sha }}
123+ path : ${{ matrix.weblog-variant}}_${{ github.sha }}.tar.gz
124+
125+ - name : docker load
126+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
127+ run : |
128+ docker load < ${{ matrix.weblog-variant}}_${{ github.sha }}.tar.gz/${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
129+ docker load < ${{ matrix.weblog-variant}}_${{ github.sha }}.tar.gz/${{ matrix.weblog-variant}}_agent_${{ github.sha }}.tar.gz
130+
131+ - name : move venv
132+ if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
133+ run : |
134+ mv ${{ matrix.weblog-variant}}_${{ github.sha }}.tar.gz/venv venv
135+ chmod -R +x venv/bin/*
136+
137+ - name : Run DEFAULT
138+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
139+ run : ./run.sh DEFAULT
140+
141+ - name : Run SAMPLING
142+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
143+ run : ./run.sh SAMPLING
144+
145+ - name : Run INTEGRATIONS
146+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
147+ run : ./run.sh INTEGRATIONS
148+
149+ - name : Run CROSSED_TRACING_LIBRARIES
150+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
151+ run : ./run.sh CROSSED_TRACING_LIBRARIES
152+
153+ - name : Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
154+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
77155 run : ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
78156
79157 - name : Run REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
80- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
158+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config '
81159 run : ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
82160
83161 - name : Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
84- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
162+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config '
85163 run : ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
86164
87165 - name : Run APPSEC_MISSING_RULES
88- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
166+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
89167 run : ./run.sh APPSEC_MISSING_RULES
90168
91169 - name : Run APPSEC_CUSTOM_RULES
92- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
170+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
93171 run : ./run.sh APPSEC_CUSTOM_RULES
94172
95173 - name : Run APPSEC_CORRUPTED_RULES
96- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
174+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
97175 run : ./run.sh APPSEC_CORRUPTED_RULES
98176
99177 - name : Run APPSEC_RULES_MONITORING_WITH_ERRORS
100- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
178+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
101179 run : ./run.sh APPSEC_RULES_MONITORING_WITH_ERRORS
102180
103- - name : Run APPSEC_BLOCKING
104- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
105- run : ./run.sh APPSEC_BLOCKING
106-
107- - name : Run APPSEC_DISABLED
108- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
109- run : ./run.sh APPSEC_DISABLED
110-
111181 - name : Run APPSEC_LOW_WAF_TIMEOUT
112- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
182+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
113183 run : ./run.sh APPSEC_LOW_WAF_TIMEOUT
114184
115185 - name : Run APPSEC_CUSTOM_OBFUSCATION
116- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
186+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
117187 run : ./run.sh APPSEC_CUSTOM_OBFUSCATION
118188
119189 - name : Run APPSEC_RATE_LIMITER
120- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
190+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec '
121191 run : ./run.sh APPSEC_RATE_LIMITER
122192
123- - name : Run APPSEC_BLOCKING_FULL_DENYLIST
124- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
125- run : ./run.sh APPSEC_BLOCKING_FULL_DENYLIST
126-
127- - name : Run APPSEC_REQUEST_BLOCKING
128- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
129- run : ./run.sh APPSEC_REQUEST_BLOCKING
130-
131193 - name : Run APPSEC_RUNTIME_ACTIVATION
132- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
194+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1 '
133195 run : ./run.sh APPSEC_RUNTIME_ACTIVATION
134196
135197 - name : Run APPSEC_WAF_TELEMETRY
136- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
198+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1 '
137199 run : ./run.sh APPSEC_WAF_TELEMETRY
138200
139- - name : Run SAMPLING
140- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
141- run : ./run.sh SAMPLING
201+ - name : Run APPSEC_DISABLED
202+ if : ( needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1 '
203+ run : ./run.sh APPSEC_DISABLED
142204
143- - name : Run INTEGRATIONS
144- if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
145- run : ./run.sh INTEGRATIONS
205+ - name : Run APPSEC_BLOCKING
206+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
207+
208+ run : ./run.sh APPSEC_BLOCKING
209+ - name : Run APPSEC_BLOCKING_FULL_DENYLIST
210+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
211+ run : ./run.sh APPSEC_BLOCKING_FULL_DENYLIST
212+
213+ - name : Run APPSEC_REQUEST_BLOCKING
214+ if : (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
215+ run : ./run.sh APPSEC_REQUEST_BLOCKING
146216
147- # even on failures, we want to have artifact to be able to investigate
148217 # The compress step speed up a lot the upload artifact process
149218 - name : Compress artifact
150219 if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
220+ id : compress-artifact
151221 run : tar -czvf artifact.tar.gz $(ls | grep logs)
152222
153223 - name : Upload artifact
154224 uses : actions/upload-artifact@v3
155225 if : needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
156226 with :
157- name : logs_${{ matrix.weblog-variant }}
227+ name : logs_${{ matrix.weblog-variant }}_${{ matrix.scenario }}
158228 path : artifact.tar.gz
159229
230+
160231 parametric :
161232 runs-on : ubuntu-latest
162233 needs : needs-run
@@ -197,3 +268,4 @@ jobs:
197268 with :
198269 name : logs_parametric
199270 path : artifact.tar.gz
271+
0 commit comments