Skip to content

Commit

Permalink
Merge branch 'DataDog:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
danielshaar committed Sep 11, 2024
2 parents cd66fc2 + 09e53b1 commit 50dc60d
Show file tree
Hide file tree
Showing 124 changed files with 3,576 additions and 1,076 deletions.
39 changes: 6 additions & 33 deletions .circleci/config.templ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,13 @@ jobs:
env: 'dd_coverage'
snapshot: true

sourcecode:
<<: *contrib_job_small
pytest_v2:
<<: *machine_executor
parallelism: 10
steps:
- run_test:
pattern: "sourcecode"
- run_hatch_env_test:
env: 'pytest_plugin_v2'
snapshot: true

opentelemetry:
parallelism: 4
Expand Down Expand Up @@ -650,15 +652,6 @@ jobs:
snapshot: true
docker_services: "memcached redis postgres"

djangorestframework:
<<: *machine_executor
parallelism: 2
steps:
- run_test:
pattern: 'djangorestframework'
snapshot: true
docker_services: "memcached redis"

dramatiq:
<<: *machine_executor
parallelism: 2
Expand Down Expand Up @@ -727,16 +720,6 @@ jobs:
wait: mysql
pattern: 'pymysql$'

pylibmc:
<<: *contrib_job_small
docker:
- image: *ddtrace_dev_image
- image: *memcached_image
- *testagent
steps:
- run_test:
pattern: 'pylibmc'

pytest:
<<: *machine_executor
parallelism: 10
Expand All @@ -745,16 +728,6 @@ jobs:
pattern: 'pytest'
snapshot: true

pymemcache:
<<: *contrib_job
docker:
- image: *ddtrace_dev_image
- image: *memcached_image
- *testagent
steps:
- run_test:
pattern: "pymemcache"

mongoengine:
<<: *machine_executor
steps:
Expand Down
57 changes: 29 additions & 28 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,107 +155,108 @@ jobs:

- name: docker load
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
id: docker_load
run: |
docker load < images_artifacts/${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
docker load < images_artifacts/agent_${{ github.sha }}.tar.gz
- name: Run DEFAULT
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
run: ./run.sh DEFAULT

- name: Run SAMPLING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
run: ./run.sh SAMPLING

- name: Run INTEGRATIONS
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
run: ./run.sh INTEGRATIONS

- name: Run CROSSED_TRACING_LIBRARIES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
run: ./run.sh CROSSED_TRACING_LIBRARIES

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD

- name: Run APPSEC_MISSING_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_MISSING_RULES

- name: Run APPSEC_CUSTOM_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CUSTOM_RULES

- name: Run APPSEC_CORRUPTED_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CORRUPTED_RULES

- name: Run APPSEC_RULES_MONITORING_WITH_ERRORS
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_RULES_MONITORING_WITH_ERRORS

- name: Run APPSEC_LOW_WAF_TIMEOUT
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_LOW_WAF_TIMEOUT

- name: Run APPSEC_CUSTOM_OBFUSCATION
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CUSTOM_OBFUSCATION

- name: Run APPSEC_RATE_LIMITER
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_RATE_LIMITER

- name: Run APPSEC_STANDALONE
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_STANDALONE

- name: Run APPSEC_RUNTIME_ACTIVATION
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_RUNTIME_ACTIVATION

- name: Run APPSEC_WAF_TELEMETRY
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_WAF_TELEMETRY

- name: Run APPSEC_DISABLED
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_DISABLED

- name: Run APPSEC_BLOCKING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_BLOCKING

- name: Run APPSEC_BLOCKING_FULL_DENYLIST
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_BLOCKING_FULL_DENYLIST

- name: Run APPSEC_REQUEST_BLOCKING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_REQUEST_BLOCKING

- name: Run APPSEC_RASP
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_RASP

# The compress step speed up a lot the upload artifact process
- name: Compress artifact
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.docker_load.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule')
id: compress-artifact
run: tar -czvf artifact.tar.gz $(ls | grep logs)

- name: Upload artifact
uses: actions/upload-artifact@v4
if: steps.compress-artifact.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.docker_load.outcome == 'success' && (steps.compress-artifact.outcome == 'success' || github.event_name == 'schedule')
with:
name: logs_${{ matrix.weblog-variant }}_${{ matrix.scenario }}
path: artifact.tar.gz
Expand All @@ -282,21 +283,21 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Build runner
id: build_runner
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: ./.github/actions/install_runner

- name: Run
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule')
run: ./run.sh PARAMETRIC

- name: Compress artifact
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule')
run: tar -czvf artifact.tar.gz $(ls | grep logs)

- name: Upload artifact
uses: actions/upload-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success' && (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule')
with:
name: logs_parametric
path: artifact.tar.gz

4 changes: 1 addition & 3 deletions .gitlab/prepare-oci-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ echo -n "$PYTHON_PACKAGE_VERSION" > sources/version

cp -r ../pywheels-dep/site-packages* sources/ddtrace_pkgs

cp ../lib-injection/sitecustomize.py sources/
cp ../min_compatible_versions.csv sources/
cp ../lib-injection/telemetry-forwarder.sh sources/
cp ../lib-injection/sources/* sources/
5 changes: 5 additions & 0 deletions .gitlab/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ variables:
TWINE_USERNAME: "__token__"
TWINE_NON_INTERACTIVE: "1"
before_script:
- |
curl -L "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.3.zip" -o "awscliv2.zip"
echo "13ee8a87756aa61027bd87985d4da4dee7ac777a36410321b03621a943cf030e awscliv2.zip" | sha256sum --check
unzip awscliv2.zip
./aws/install
- export TWINE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name "ci.${CI_PROJECT_NAME}.${PYPI_REPOSITORY}_token" --with-decryption --query "Parameter.Value" --out text)
- python -m pip install twine
- python -m twine check --strict pywheels/*
Expand Down
21 changes: 21 additions & 0 deletions .gitlab/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,26 @@ variables:
script:
- |
envs=( $(hatch env show --json | jq -r --arg suite_name "$SUITE_NAME" 'keys[] | select(. | contains($suite_name))' | sort | ./.gitlab/ci-split-input.sh) )
if [[ ${#envs[@]} -eq 0 ]]; then
echo "No hatch envs found for ${SUITE_NAME}"
exit 1
fi
for env in "${envs[@]}"
do
echo "Running hatch env: ${env}:test"
hatch run ${env}:test
done
.test_base_hatch_snapshot:
extends: .test_base_hatch
services:
- !reference [.services, testagent]
before_script:
- !reference [.testrunner, before_script]
# DEV: All job variables get shared with services, setting `DD_TRACE_AGENT_URL` on the testagent will tell it to forward all requests to the
# agent at that host. Therefore setting this as a variable will cause recursive requests to the testagent
- export DD_TRACE_AGENT_URL="http://testagent:9126"

.test_base_riot:
extends: .testrunner
stage: tests
Expand All @@ -31,12 +45,19 @@ variables:
- unset DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED
- |
hashes=( $(riot list --hash-only "${SUITE_NAME}" | sort | ./.gitlab/ci-split-input.sh) )
if [[ ${#hashes[@]} -eq 0 ]]; then
echo "No riot hashes found for ${SUITE_NAME}"
exit 1
fi
for hash in "${hashes[@]}"
do
echo "Running riot hash: ${hash}"
riot list "${hash}"
${RIOT_RUN_CMD} "${hash}"
done
./scripts/check-diff ".riot/requirements/" \
"Changes detected after running riot. Consider deleting changed files, running scripts/compile-and-prune-test-requirements and committing the result."
.test_base_riot_snapshot:
extends: .test_base_riot
Expand Down
7 changes: 7 additions & 0 deletions .gitlab/tests/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ appsec:
parallel: 6
variables:
SUITE_NAME: "appsec$"
retry: 2

appsec iast:
extends: .test_base_riot_snapshot
Expand All @@ -18,34 +19,40 @@ appsec iast:
variables:
SUITE_NAME: "appsec_iast$"
TEST_POSTGRES_HOST: "postgres"
retry: 2

appsec iast tdd_propagation:
extends: .test_base_riot_snapshot
allow_failure: true
parallel: 2
variables:
SUITE_NAME: "appsec_iast_tdd_propagation"
retry: 2

appsec iast memcheck:
extends: .test_base_riot_snapshot
parallel: 5
variables:
SUITE_NAME: "appsec_iast_memcheck"
retry: 2

appsec threats django:
extends: .test_base_hatch
parallel: 12
variables:
SUITE_NAME: "appsec_threats_django"
retry: 2

appsec threats flask:
extends: .test_base_hatch
parallel: 10
variables:
SUITE_NAME: "appsec_threats_flask"
retry: 2

appsec threats fastapi:
extends: .test_base_hatch
parallel: 9
variables:
SUITE_NAME: "appsec_threats_fastapi"
retry: 2
Loading

0 comments on commit 50dc60d

Please sign in to comment.