From 6d159722dfdf6e87d2ff6b971f239d2d64bd56d9 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Thu, 1 Aug 2024 12:24:49 +0200 Subject: [PATCH] Optimize circleci build times (#2781) * Optimize Signed-off-by: Bob Weinand * Faster checkout Signed-off-by: Bob Weinand * Split building of extension to speed build workflow up Signed-off-by: Bob Weinand * Cache cargo packages Signed-off-by: Bob Weinand * Fix ASAN build Signed-off-by: Bob Weinand * Move web tests from build_packages to build Signed-off-by: Bob Weinand * Fix some tests Signed-off-by: Bob Weinand * Increase test_c2php timeout Signed-off-by: Bob Weinand --------- Signed-off-by: Bob Weinand --- .circleci/continue_config.yml | 1198 +++++++++++------ Makefile | 65 +- compile_rust.sh | 7 + config.m4 | 6 +- .../packaging/fpm_packaging/Dockerfile | 23 + dockerfiles/packaging/fpm_packaging/README.md | 5 + .../fpm_packaging/fpm_apk_pax_header.patch | 29 + .../agent_sampling_sidecar.phpt | 1 + tests/randomized/Makefile | 2 +- tooling/bin/generate-final-artifact.sh | 68 +- tooling/bin/generate-ssi-package.sh | 20 +- 11 files changed, 901 insertions(+), 523 deletions(-) create mode 100644 dockerfiles/packaging/fpm_packaging/Dockerfile create mode 100644 dockerfiles/packaging/fpm_packaging/README.md create mode 100644 dockerfiles/packaging/fpm_packaging/fpm_apk_pax_header.patch diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index 8ef8aeda8f..344da463e5 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -100,26 +100,10 @@ aliases: attach_workspace: at: ~/datadog - - &STEP_APPEND_BUILD_ID - run: - name: Append build id to version number - command: | - githash="${CIRCLE_SHA1?}" - if [[ "x$CIRCLE_BRANCH" == "x" ]] ; then - echo "The environment variable CIRCLE_BRANCH was not set or was empty." - exit 1 - fi - if [[ "$CIRCLE_BRANCH" =~ "ddtrace-" ]] ; then - echo "Release branch detected; not adding git sha1 to version number." - else - echo -n "+$githash" >>VERSION - echo "Appended +$githash to version number." - fi - - &STEP_EXT_INSTALL run: name: Build and install extension - command: make sudo install install_ini BUILD_DIR=$(pwd)/tmp/build_extension + command: make sudo install install_ini BUILD_DIR=$(pwd)/tmp/build_extension $(if [ -f libddtrace_php.a ]; then echo EXTRA_CONFIGURE_OPTIONS=--with-ddtrace-rust-library=$(pwd)/libddtrace_php.a; fi) - &STEP_CODE_COVERAGE when: @@ -260,58 +244,32 @@ aliases: # Avoid intermittent DNS hangs: See https://github.com/curl/curl/issues/593#issuecomment-170146252 echo "options single-request" | sudo tee -a /etc/resolv.conf - - &STEP_STORE_TEST_RESULTS - store_test_results: - path: test-results - - - &STEP_CHECKOUT + - &STEP_LINK_EXTENSION run: - name: Checkout code + name: Link extension + background: true command: | - git config --global gc.auto 0 - - export CIRCLE_REPOSITORY_URL="${CIRCLE_REPOSITORY_URL/git@github.com:/https://github.com/}" - - if [ -e "$HOME/datadog/.git" ] ; then - echo 'Fetching into existing repository' - existing_repo='true' - cd "$HOME/datadog" - git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true - - echo 'Fetching from remote repository' - retry_count=3 - if [ -n "$CIRCLE_TAG" ]; then - for i in $(seq 1 $retry_count); do - git fetch --force --no-recurse-submodules --tags origin && break || sleep 1 - done - elif [ -z "$CIRCLE_PR_NUMBER" ]; then - for i in $(seq 1 $retry_count); do - git fetch --force --no-recurse-submodules origin "+refs/heads/$CIRCLE_BRANCH:refs/remotes/origin/$CIRCLE_BRANCH" && break || sleep 1 - done - fi - else - echo 'Cloning git repository' - existing_repo='false' - mkdir -p "$HOME/datadog" - cd "$HOME/datadog" - git clone --no-checkout "$CIRCLE_REPOSITORY_URL" . + echo $$ > /tmp/link_extension.pid + # If it's missing, we're building in the job + if [ -f ddtrace.a ]; then + sed -i 's/-export-symbols .*\/ddtrace\.sym/-Wl,--retain-symbols-file=ddtrace.sym/g' ddtrace.ldflags + gcc -shared -Wl,-whole-archive ddtrace.a -Wl,-no-whole-archive $(cat ddtrace.ldflags) libddtrace_php.a -Wl,-soname -Wl,ddtrace.so -o ddtrace.so + mkdir -p tmp/build_extension/modules + mv ddtrace.so tmp/build_extension/modules/ fi - if [ -n "$CIRCLE_TAG" ]; then - echo 'Checking out tag' - git checkout --force "$CIRCLE_TAG" - git reset --hard "$CIRCLE_SHA1" - else - echo 'Checking out branch' - if [ -n "$CIRCLE_PR_NUMBER" ]; then - git fetch --force origin "+refs/pull/${CIRCLE_PR_NUMBER}/head:refs/remotes/origin/$CIRCLE_BRANCH" - fi - git checkout --force -B "$CIRCLE_BRANCH" "$CIRCLE_SHA1" - git --no-pager log --no-color -n 1 --format='HEAD is now at %h %s' + - &STEP_AWAIT_LINK_EXTENSION + run: + name: Wait for extension linking + command: | + tail --pid=$(cat /tmp/link_extension.pid) -f /dev/null || true + if [ -f tmp/build_extension/modules/ddtrace.so ]; then + echo "export DD_TRACE_ASSUME_COMPILED=1" >> $BASH_ENV fi - echo 'Updating submodules' - git submodule update --init --recursive + - &STEP_STORE_TEST_RESULTS + store_test_results: + path: test-results - &BARE_DOCKER_MACHINE resource_class: << parameters.resource_class >> @@ -319,6 +277,64 @@ aliases: image: ubuntu-2004:current commands: + git_checkout: + parameters: + is_windows: + type: boolean + default: false + steps: + - run: + name: Checkout code + shell: "<<# parameters.is_windows >>bash.exe<>" + command: | + git config --global gc.auto 0 + + export CIRCLE_REPOSITORY_URL="${CIRCLE_REPOSITORY_URL/git@github.com:/https://github.com/}" + + APP_DIR="$HOME/datadog" + if [ -e "$APP_DIR/.git" ] ; then + echo 'Fetching into existing repository' + existing_repo='true' + cd "$APP_DIR" + git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true + + echo 'Fetching from remote repository' + retry_count=3 + if [ -n "$CIRCLE_TAG" ]; then + for i in $(seq 1 $retry_count); do + git fetch --force --no-recurse-submodules --tags origin && break || sleep 1 + done + elif [ -z "$CIRCLE_PR_NUMBER" ]; then + for i in $(seq 1 $retry_count); do + git fetch --force --no-recurse-submodules origin "+refs/heads/$CIRCLE_BRANCH:refs/remotes/origin/$CIRCLE_BRANCH" && break || sleep 1 + done + fi + else + echo 'Cloning git repository' + existing_repo='false' + mkdir -p "$APP_DIR" + cd "$APP_DIR" + git clone --no-checkout "$CIRCLE_REPOSITORY_URL" . + fi + + if [ -n "$CIRCLE_TAG" ]; then + echo 'Checking out tag' + git checkout --force "$CIRCLE_TAG" + git reset --hard "$CIRCLE_SHA1" + else + echo 'Checking out branch' + if [ -n "$CIRCLE_PR_NUMBER" ]; then + git fetch --force origin "+refs/pull/${CIRCLE_PR_NUMBER}/head:refs/remotes/origin/$CIRCLE_BRANCH" + fi + git checkout --force -B "$CIRCLE_BRANCH" "$CIRCLE_SHA1" + git --no-pager log --no-color -n 1 --format='HEAD is now at %h %s' + fi + + echo 'Updating submodules' + # we don't need appsec submodules on windows + <<# parameters.is_windows >>git submodule update --init libdatadog<> + <<^ parameters.is_windows >>git submodule update --init --recursive<> + lib_curl_workaround: parameters: command: @@ -353,6 +369,52 @@ commands: command: << parameters.lib_curl_command >> - <<: *STEP_EXT_INSTALL + append_build_id: + parameters: + shell: + type: string + default: /bin/bash -eo pipefail + steps: + - run: + name: Append build id to version number + shell: << parameters.shell >> + command: | + githash="${CIRCLE_SHA1?}" + if [[ "x$CIRCLE_BRANCH" == "x" ]] ; then + echo "The environment variable CIRCLE_BRANCH was not set or was empty." + exit 1 + fi + if [[ "$CIRCLE_BRANCH" =~ "ddtrace-" ]] ; then + echo "Release branch detected; not adding git sha1 to version number." + else + echo -n "+$githash" >>VERSION + echo "Appended +$githash to version number." + fi + + + fetch_job_artifact: + parameters: + job: + type: string + artifact: + type: string + directory: + type: string + default: "." + steps: + - run: + name: "Get artifact << parameters.artifact >> from job << parameters.job >>" + command: | + set +x + cd << parameters.directory >> + if [[ '<< parameters.job >>' != "${LAST_ARTIFACTS_JOB:-}" ]]; then + job_id=$(curl -X GET "https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/job" -H "Accept: application/json" | grep -Eo '\{[^}]*"<< parameters.job >>"[^}]*' | grep -Eo '"job_number":[^,]+' | tail -c +14) + export LAST_ARTIFACTS_RESULT=$(curl -X GET "https://circleci.com/api/v2/project/github/DataDog/dd-trace-php/$job_id/artifacts" -H "Accept: application/json") + export LAST_ARTIFACTS_JOB='<< parameters.job >>' + fi + artifact_url=$(echo "$LAST_ARTIFACTS_RESULT" | grep -Eo '\{[^}]*"<< parameters.artifact >>"[^}]*' | grep -Eo '"url":"[^"]+' | tail -c +8) + curl -LO "$artifact_url" + copy_valgrind_rc: parameters: valgrind_config: @@ -366,9 +428,8 @@ commands: cp .circleci/valgrind/<< parameters.valgrind_config >>_valgrind.rc /home/circleci/.valgrindrc cp .circleci/valgrind/valgrind_<< parameters.valgrind_config >>_suppressions.lib /home/circleci/valgrind_<< parameters.valgrind_config >>_suppressions.lib fi - prepare_extension_and_composer_with_cache: + update_composer_with_cache: steps: - - <<: *STEP_EXT_INSTALL - <<: *STEP_COMPOSER_CACHE_RESTORE - <<: *STEP_COMPOSER_UPDATE - <<: *STEP_COMPOSER_CACHE_SAVE @@ -390,6 +451,9 @@ commands: extra: type: string default: none + ramdisk: + type: boolean + default: false steps: - run: name: Fix mounted folder permissions mismatch on buster (user 1000 vs user 3434 in docker) @@ -529,11 +593,12 @@ commands: -e CIRCLECI \ -e CIRCLE_PROJECT_USERNAME \ -e CIRCLE_PROJECT_REPONAME \ + <<# parameters.ramdisk >>--tmpfs /mnt/ramdisk:uid=3434,gid=3434,exec<> \ -v $(pwd):/home/circleci/datadog \ -v /tmp/bashenv:/home/circleci/bashenv \ -v /rust:/rust \ -v /tmp/artifacts:/tmp/artifacts \ - $(if [ -n "${CARGO_TARGET_DIR:-}" ]; then echo -v ${CARGO_TARGET_DIR}:${CARGO_TARGET_DIR} -e CARGO_TARGET_DIR=${CARGO_TARGET_DIR}; fi) \ + $(if [ -n "${CARGO_TARGET_DIR:-}" ]; then echo "-e CARGO_TARGET_DIR=${CARGO_TARGET_DIR}"; fi) \ $image \ sh -c 'echo Started; sleep 10000' 2>&1 | tee /tmp/docker.out & tail -F /tmp/docker.out | grep -Em1 'Started|Error response from daemon' @@ -676,11 +741,14 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE + - <<: *STEP_LINK_EXTENSION - lib_curl_workaround: command: sudo apt update; sudo apt -y install libcurl4-nss-dev - - prepare_extension_and_composer_with_cache + - update_composer_with_cache + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - run: name: Install phpstan command: | @@ -704,7 +772,7 @@ jobs: command: | apt-get update apt-get install -y git - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Start Supervisor @@ -736,17 +804,18 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - - <<: *STEP_EXT_INSTALL + - <<: *STEP_LINK_EXTENSION - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_PREPARE_TEST_RESULTS_DIR + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - run: name: Run xdebug tests command: | export REPORT_EXIT_STATUS=1 export DD_TRACE_CLI_ENABLED=1 - cd tmp/build_extension targetdir() { if [[ ${1:0:1} -eq 2 ]]; then echo $1 @@ -754,9 +823,9 @@ jobs: echo "3.0.0" fi } - php run-tests.php -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_one >>.so ../../tests/xdebug/$(targetdir << parameters.xdebug_version_one >>) + php /usr/local/src/php/run-tests.php -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_one >>.so tests/xdebug/$(targetdir << parameters.xdebug_version_one >>) if [[ ! "<>" == "none" ]]; then - php run-tests.php -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_two >>.so ../../tests/xdebug/$(targetdir << parameters.xdebug_version_two >>) + php /usr/local/src/php/run-tests.php -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_two >>.so tests/xdebug/$(targetdir << parameters.xdebug_version_two >>) fi; - run: name: Run unit tests with xdebug @@ -791,7 +860,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Set core pattern @@ -802,13 +871,16 @@ jobs: extra: with_httpbin_and_request_replayer - switch_php: php_version: << parameters.switch_php_version >> - - prepare_extension_and_composer_with_cache + - <<: *STEP_LINK_EXTENSION + - update_composer_with_cache - <<: *STEP_COMPOSER_TESTS_UPDATE - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_RESOLVE_HTTPBIN_HOSTNAME_TO_IP - <<: *STEP_WAIT_TEST_AGENT + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - run: name: Run tests command: | @@ -845,7 +917,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Set core pattern @@ -856,11 +928,14 @@ jobs: extra: with_httpbin_and_request_replayer - switch_php: php_version: << parameters.switch_php_version >> - - prepare_extension_and_composer_with_cache + - <<: *STEP_LINK_EXTENSION + - update_composer_with_cache - <<: *STEP_COMPOSER_TESTS_UPDATE - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_REQUEST_REPLAYER + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - run: name: Run tests command: | @@ -893,7 +968,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Set core pattern @@ -904,13 +979,16 @@ jobs: extra: with_httpbin_and_request_replayer - switch_php: php_version: << parameters.switch_php_version >> - - prepare_extension_and_composer_with_cache + - <<: *STEP_LINK_EXTENSION + - update_composer_with_cache - <<: *STEP_COMPOSER_TESTS_UPDATE - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_RESOLVE_HTTPBIN_HOSTNAME_TO_IP - <<: *STEP_WAIT_TEST_AGENT + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - run: name: Run tests command: | @@ -934,8 +1012,13 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' - run: command: | docker run --rm -v $(pwd):/root -i ubuntu:jammy bash -s \<>_buster extra: with_httpbin_and_request_replayer - switch_php: php_version: << parameters.switch_php_version >> + - <<: *STEP_LINK_EXTENSION - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_RESOLVE_HTTPBIN_HOSTNAME_TO_IP - <<: *STEP_WAIT_TEST_AGENT + - <<: *STEP_AWAIT_LINK_EXTENSION - run: name: Run tests command: | @@ -1150,7 +1231,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1195,7 +1276,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Hunter Cache" @@ -1236,7 +1317,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Integration tests @@ -1252,7 +1333,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1287,7 +1368,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1353,7 +1434,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1391,7 +1472,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1431,7 +1512,7 @@ jobs: working_directory: ~/datadog <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - restore_cache: name: "Restore Cache" @@ -1539,13 +1620,14 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - setup_docker: docker_image: datadog/dd-trace-ci:php-<< parameters.php_major_minor >>_buster extra: with_snapshots - switch_php: php_version: << parameters.switch_php_version >> + - <<: *STEP_LINK_EXTENSION - when: condition: and: @@ -1558,7 +1640,6 @@ jobs: - run: name: Updating composer to v2 command: sudo composer self-update --2 --no-interaction - - install_extension - <<: *STEP_COMPOSER_CACHE_RESTORE - <<: *STEP_COMPOSER_UPDATE - <<: *STEP_COMPOSER_TESTS_UPDATE @@ -1569,6 +1650,8 @@ jobs: equal: [ false, << parameters.coverage >> ] steps: - <<: *STEP_DISABLE_XDEBUG + - <<: *STEP_AWAIT_LINK_EXTENSION + - install_extension - <<: *STEP_WAIT_MYSQL - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_WAIT_TEST_AGENT @@ -1629,6 +1712,11 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} + - git_checkout + - <<: *STEP_ATTACH_WORKSPACE + - switch_php: + php_version: << parameters.switch_php_version >> + - <<: *STEP_LINK_EXTENSION - when: condition: and: @@ -1641,11 +1729,6 @@ jobs: - run: name: Updating composer to v2 command: sudo composer self-update --2 --no-interaction - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE - - switch_php: - php_version: << parameters.switch_php_version >> - - install_extension - <<: *STEP_COMPOSER_CACHE_RESTORE - <<: *STEP_COMPOSER_UPDATE - <<: *STEP_COMPOSER_TESTS_UPDATE @@ -1656,6 +1739,8 @@ jobs: equal: [ false, << parameters.coverage >> ] steps: - <<: *STEP_DISABLE_XDEBUG + - <<: *STEP_AWAIT_LINK_EXTENSION + - install_extension - when: condition: equal: [ "with_integrations", << parameters.with_executor >> ] @@ -1703,9 +1788,12 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - - prepare_extension_and_composer_with_cache + - <<: *STEP_LINK_EXTENSION + - update_composer_with_cache + - <<: *STEP_AWAIT_LINK_EXTENSION + - <<: *STEP_EXT_INSTALL - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_TEST_AGENT @@ -1792,7 +1880,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - setup_docker: docker_image: datadog/dd-trace-ci:php-<< parameters.php_major_minor >>_buster @@ -1808,8 +1896,7 @@ jobs: command: sudo composer self-update --2 --no-interaction - switch_php: php_version: << parameters.switch_php_version >> - - install_extension: - lib_curl_command: << parameters.lib_curl_command >> + - <<: *STEP_LINK_EXTENSION - run: name: Install required packages command: sudo apt update && sudo apt install -y jq @@ -1818,6 +1905,9 @@ jobs: - <<: *STEP_COMPOSER_TESTS_UPDATE - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_DISABLE_XDEBUG + - <<: *STEP_AWAIT_LINK_EXTENSION + - install_extension: + lib_curl_command: << parameters.lib_curl_command >> - <<: *STEP_WAIT_MYSQL - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_WAIT_TEST_AGENT @@ -1855,10 +1945,11 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - switch_php: php_version: << parameters.switch_php_version >> + - <<: *STEP_LINK_EXTENSION - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV - <<: *STEP_WAIT_REQUEST_REPLAYER @@ -1872,6 +1963,7 @@ jobs: echo 'ext/<< parameters.ext_name >> is enabled but should not be installed' exit 1 fi + - <<: *STEP_AWAIT_LINK_EXTENSION - run: name: Run << parameters.ext_name >> integration tests with ext/<< parameters.ext_name >> as shared lib + leak detection command: | @@ -1920,17 +2012,20 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout - <<: *STEP_PREPARE_TEST_RESULTS_DIR - <<: *STEP_EXPORT_CI_ENV + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer_[^"]+'"$(if [ $(uname -m) = "aarch64" ]; then echo arm64; else echo amd64; fi)"'.deb - <<: *STEP_WAIT_REQUEST_REPLAYER - <<: *STEP_RESOLVE_HTTPBIN_HOSTNAME_TO_IP - <<: *STEP_WAIT_TEST_AGENT - run: name: Install .deb from artifacts command: | - sudo dpkg -i ./build/packages/*$(if [ $(uname -m) = "aarch64" ]; then echo aarch64; else echo amd64; fi)*.deb + sudo dpkg -i *$(if [ $(uname -m) = "aarch64" ]; then echo arm64; else echo amd64; fi)*.deb php --ri=ddtrace - run: name: Run phpt tests against shippable package @@ -1966,8 +2061,13 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer_[^"]+'"$(if [ $(uname -m) = "aarch64" ]; then echo arm64; else echo amd64; fi)"'.deb + directory: build/packages - setup_remote_docker - run: make -f dockerfiles/frameworks/Makefile << parameters.framework_target >> @@ -2002,11 +2102,35 @@ jobs: - run: name: Install git command: apk add git + - run: + name: Install curl + command: apk add curl - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - when: + condition: + equal: [php_installer, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-musl.tar.gz' + directory: build/packages + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' + directory: build/packages + - when: + condition: + equal: [native_package, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer_[^"]+'"$(uname -m)"'.apk + directory: build/packages - run: name: Validate alpine package command: ./dockerfiles/verify_packages/verify.sh @@ -2050,8 +2174,29 @@ jobs: sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo yum update -y yum install -y git - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - when: + condition: + equal: [php_installer, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + directory: build/packages + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' + directory: build/packages + - when: + condition: + equal: [native_package, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer-[^"]+'"$(uname -m)"'.rpm + directory: build/packages - run: name: Validate centos package command: << parameters.configuration >> ./dockerfiles/verify_packages/verify.sh @@ -2075,8 +2220,29 @@ jobs: command: | yum update -y yum install -y git - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - when: + condition: + equal: [php_installer, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + directory: build/packages + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' + directory: build/packages + - when: + condition: + equal: [native_package, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer-[^"]+'"$(uname -m)"'.rpm + directory: build/packages - run: mkdir -p test-results - run: name: Test installing packages on target systems @@ -2122,8 +2288,33 @@ jobs: command: | apt-get update apt-get install -y git - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - run: + name: Install curl + command: | + apt-get install -y curl + - git_checkout + - run: mkdir -p build/packages + - when: + condition: + equal: [php_installer, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + directory: build/packages + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' + directory: build/packages + - when: + condition: + equal: [native_package, << parameters.install_type >>] + steps: + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer_[^"]+'"$(if [ $(uname -m) = "aarch64" ]; then echo arm64; else echo amd64; fi)"'.deb + directory: build/packages - run: name: Validate debian package command: << parameters.configuration >> bash ./dockerfiles/verify_packages/verify.sh @@ -2146,8 +2337,13 @@ jobs: command: | sudo apt-get update sudo apt-get install -y git - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer-[^"]+'"$(uname -m)"'.tar.gz + directory: build/packages - setup_docker: docker_image: debian:bullseye - run: @@ -2167,11 +2363,19 @@ jobs: - run: name: Install git command: apk add git + - run: + name: Install curl + command: apk add curl - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: mkdir -p build/packages + - fetch_job_artifact: + job: "package extension" + artifact: |- + datadog-php-tracer_[^"]+'"$(uname -m)"'.apk + directory: build/packages - run: name: Test command: ./dockerfiles/verify_packages/verify_no_ext_json.sh @@ -2186,7 +2390,7 @@ jobs: docker_image: type: string steps: - - checkout + - git_checkout: { is_windows: true } - <<: *STEP_ATTACH_WORKSPACE - run: name: Build nts @@ -2201,11 +2405,32 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - run: name: Let testing images to write to build/packages dir - command: chmod a+w build/packages + command: mkdir -p build/packages && chmod a+w build/packages + + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + directory: build/packages + + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-musl.tar.gz' + directory: build/packages + + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-php-tracer-[^"]+x86_64.tar.gz' + directory: build/packages + + - fetch_job_artifact: + job: "package extension" + artifact: "datadog-setup.php" + directory: build/packages + - run: name: Run tests command: make -C dockerfiles/verify_packages test_installer @@ -2223,6 +2448,9 @@ jobs: batch: # Batch is only used to run a number of these jobs in parallel via a testing matrix. type: integer + parent_job: + type: string + default: "package extension" steps: &randomized_tests_steps - run: name: Ensure enough memory via swapfile @@ -2234,8 +2462,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout - run: command: ls -al - run: @@ -2244,6 +2471,10 @@ jobs: - run: name: "Increase virtual memory limit for elasticsearch" command: sudo sysctl -w vm.max_map_count=262144 + - fetch_job_artifact: + job: "<< parameters.parent_job >>" + artifact: |- + dd-library-php-[^"]+'"$(uname -m)"'-linux-gnu.tar.gz - run: name: Copy tracer package command: make -C tests/randomized library.local @@ -2273,6 +2504,9 @@ jobs: batch: # Batch is only used to run a number of these jobs in parallel via a testing matrix. type: integer + parent_job: + type: string + default: "package extension" steps: *randomized_tests_steps randomized_tests_asan: @@ -2286,6 +2520,9 @@ jobs: batch: # Batch is only used to run a number of these jobs in parallel via a testing matrix. type: integer + parent_job: + type: string + default: "package extension zts-debug-asan" steps: *randomized_tests_steps randomized_tests_arm_asan: @@ -2299,6 +2536,9 @@ jobs: batch: # Batch is only used to run a number of these jobs in parallel via a testing matrix. type: integer + parent_job: + type: string + default: "package extension zts-debug-asan" steps: *randomized_tests_steps pecl_build: @@ -2310,7 +2550,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Make PECL build @@ -2338,7 +2578,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Install from PECL build @@ -2367,6 +2607,73 @@ jobs: when: on_fail - store_artifacts: { path: '/tmp/artifacts' } + compile_rust_test: + working_directory: ~/datadog + parameters: + resource_class: + type: string + default: large + triplet: + type: string + asan: + type: boolean + default: false + <<: *BARE_DOCKER_MACHINE + environment: + - CARGO_TARGET_DIR: /mnt/ramdisk/cargo + steps: + - restore_cache: + keys: + - source-v1-{{ .Branch }}-{{ .Revision }} + - git_checkout + - append_build_id + - restore_cache: + name: Restore Cargo Package Cache + keys: + - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} + - setup_docker: + docker_image: datadog/dd-trace-ci:buster + ramdisk: true + - run: + name: Compile sidecar + command: | + <<# parameters.asan >>COMPILE_ASAN=1<> SHARED=1 host_os=linux-gnu ./compile_rust.sh + cp -v ${CARGO_TARGET_DIR:-target}/debug/libddtrace_php.a . + - persist_to_workspace: + root: '.' + paths: [ './libddtrace_php.a' ] + + compile_extension_test: + working_directory: ~/datadog + parameters: + php_major_minor: + # Expected in the format: ., e.g. 8.2 + type: string + resource_class: + type: string + default: medium + switch_php_version: + type: string + <<: *BARE_DOCKER_MACHINE + steps: + - restore_cache: + keys: + - source-v1-{{ .Branch }}-{{ .Revision }} + - git_checkout + - append_build_id + - setup_docker: + docker_image: datadog/dd-trace-ci:php-<< parameters.php_major_minor >>_buster + - run: + name: Build << parameters.switch_php_version >> extension + command: | + switch-php << parameters.switch_php_version >> + make -j static + cp -v tmp/build_extension/modules/ddtrace.a ddtrace.a + cp -v tmp/build_extension/ddtrace.ldflags ddtrace.ldflags + - persist_to_workspace: + root: '.' + paths: [ './ddtrace.a', 'ddtrace.ldflags' ] + ExtensionComponents: working_directory: ~/datadog parameters: @@ -2382,7 +2689,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Install cmake << parameters.cmake_version >> @@ -2496,7 +2803,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Install cmake << parameters.cmake_version >> @@ -2644,7 +2951,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - run: name: Switch PHP to nts @@ -2726,13 +3033,19 @@ jobs: resource_class: type: string default: large + triplet: + type: string <<: *BARE_DOCKER_MACHINE steps: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - restore_cache: + name: Restore Cargo Package Cache + keys: + - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} + - append_build_id - setup_docker: docker_image: datadog/dd-trace-ci:php-compile-extension-alpine - run: @@ -2759,8 +3072,8 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: datadog/dd-trace-ci:php-compile-extension-alpine-<< parameters.php_major_minor >> - run: mkdir -p extensions_$(uname -m) standalone_$(uname -m) @@ -2796,14 +3109,14 @@ jobs: default: unknown resource_class: type: string - default: medium # mostly for more RAM for ramdisk + default: medium <<: *BARE_DOCKER_MACHINE steps: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: << parameters.docker_image >> - run: mkdir -p extensions_$(uname -m) @@ -2834,36 +3147,39 @@ jobs: type: string resource_class: type: string - default: medium # mostly for more RAM for ramdisk + default: medium <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT + - git_checkout - setup_docker: docker_image: << parameters.docker_image >> - restore_cache: name: Restore Cargo Package Cache keys: - - profiling-cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }} + - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} - run: name: cargo fetch command: | - cd profiling + SUDO=$(! command -v sudo >/dev/null || echo "sudo") # On occasion, we've observed the .package-cache being in the cache. # If it's there, it will cause commands to stall, waiting for the file to be released. if [ -e '/rust/cargo/.package-cache' ] ; then echo "WARNING: .package-cache was part of the cache and shouldn't be!" - rm -vf '/rust/cargo/.package-cache' + $SUDO rm -vf '/rust/cargo/.package-cache' fi - cargo fetch -v --target << parameters.triplet >> - chmod -R 777 '/rust/cargo' + $SUDO mkdir /.cargo + $SUDO chmod 777 /.cargo + + $SUDO cargo fetch -v --target << parameters.triplet >> + $SUDO chmod -R 777 '/rust/cargo' # ensure the .package-cache isn't there - rm -vf '/rust/cargo/.package-cache' + $SUDO rm -vf '/rust/cargo/.package-cache' - save_cache: name: Save Cargo Package Cache - key: profiling-cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }} + key: cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} paths: - /rust/cargo @@ -2883,14 +3199,14 @@ jobs: environment: - CARGO_TARGET_DIR: /mnt/ramdisk/cargo steps: - - <<: *STEP_CHECKOUT + - git_checkout - setup_docker: docker_image: << parameters.docker_image >> - restore_cache: name: Restore Cargo Package Cache keys: - - profiling-cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }} - - <<: *STEP_APPEND_BUILD_ID + - cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }} + - append_build_id - build_profiler: prefix: datadog-profiling/<< parameters.triplet >>/lib/php/<< parameters.abi_no >> - persist_to_workspace: @@ -2915,14 +3231,15 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - setup_docker: docker_image: << parameters.docker_image >> + ramdisk: true - restore_cache: name: Restore Cargo Package Cache keys: - - profiling-cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }} + - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} - run: name: cargo tests command: | @@ -2996,8 +3313,8 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: << parameters.docker_image >> - run: @@ -3045,8 +3362,11 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - fetch_job_artifact: + job: "package extension" + artifact: |- + dd-library-php-ssi-[^"]+'"$(uname -m)"'-linux.tar.gz - setup_docker: docker_image: << parameters.docker_image >> - switch_php: @@ -3056,10 +3376,8 @@ jobs: command: | set -xeuo pipefail - arch=$(uname -m) - package=$(find ./build/packages -maxdepth 1 -name "dd-library-php-ssi-*-${arch}-linux.tar.gz") rm -rf dd-library-php-ssi - tar -xzf ${package} + tar -xzf dd-library-php-ssi-*-linux.tar.gz export DD_LOADER_PACKAGE_PATH=${PWD}/dd-library-php-ssi cd loader @@ -3085,8 +3403,11 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - fetch_job_artifact: + job: "package extension" + artifact: |- + dd-library-php-ssi-[^"]+'"$(uname -m)"'-linux.tar.gz - setup_docker: docker_image: << parameters.docker_image >> - run: @@ -3096,10 +3417,8 @@ jobs: apk add --no-cache curl-dev << parameters.alpine_packages >> - arch=$(uname -m) - package=$(find ./build/packages -maxdepth 1 -name "dd-library-php-ssi-*-${arch}-linux.tar.gz") rm -rf dd-library-php-ssi - tar -xzf ${package} + tar -xzf dd-library-php-ssi-*-linux.tar.gz export DD_LOADER_PACKAGE_PATH=${PWD}/dd-library-php-ssi cd loader @@ -3113,13 +3432,19 @@ jobs: resource_class: type: string default: large + triplet: + type: string <<: *BARE_DOCKER_MACHINE steps: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - restore_cache: + name: Restore Cargo Package Cache + keys: + - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} + - append_build_id - setup_docker: docker_image: datadog/dd-trace-ci:centos-7 - run: @@ -3157,8 +3482,8 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: << parameters.docker_image >> - run: mkdir -p extensions_$(uname -m) standalone_$(uname -m) @@ -3207,7 +3532,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - setup_docker: docker_image: << parameters.docker_image >> @@ -3227,6 +3552,7 @@ jobs: paths: [ './extensions_*' ] compile_extension_windows: + working_directory: ~/datadog resource_class: 'windows.medium' machine: image: 'windows-server-2019-vs2019:2022.08.1' @@ -3240,12 +3566,9 @@ jobs: php_version: type: string steps: - - checkout - - run: - name: Pull submodules - shell: powershell.exe - command: | - git submodule update --init --recursive + - git_checkout: { is_windows: true } + - append_build_id: + shell: bash.exe - run: name: Setup docker container shell: powershell.exe @@ -3260,11 +3583,16 @@ jobs: shell: powershell.exe command: | docker exec php powershell.exe "cd app; switch-php nts; C:\php\SDK\phpize.bat; .\configure.bat --enable-debug-pack; nmake; move x64\Release\php_ddtrace.dll extensions_windows_x86_64\php_ddtrace-<< parameters.so_suffix >>.dll; move x64\Release\php_ddtrace.pdb extensions_windows_x86_64_debugsymbols\php_ddtrace-<< parameters.so_suffix >>.pdb" + - run: + name: Reuse libdatadog build + shell: powershell.exe + command: | + docker exec php powershell.exe "mkdir app\x64\Release_TS; mv app\x64\Release\target app\x64\Release_TS\target" - run: name: Build zts shell: powershell.exe command: | - docker exec php powershell.exe "cd app; switch-php zts; nmake clean; C:\php\SDK\phpize.bat; .\configure.bat --enable-debug-pack; nmake; move x64\Release_TS\php_ddtrace.dll extensions_windows_x86_64\php_ddtrace-<< parameters.so_suffix >>-zts.dll; move x64\Release_TS\php_ddtrace.pdb extensions_windows_x86_64_debugsymbols\php_ddtrace-<< parameters.so_suffix >>-zts.pdb" + docker exec php powershell.exe "cd app; switch-php zts; C:\php\SDK\phpize.bat; .\configure.bat --enable-debug-pack; nmake; move x64\Release_TS\php_ddtrace.dll extensions_windows_x86_64\php_ddtrace-<< parameters.so_suffix >>-zts.dll; move x64\Release_TS\php_ddtrace.pdb extensions_windows_x86_64_debugsymbols\php_ddtrace-<< parameters.so_suffix >>-zts.pdb" - persist_to_workspace: root: '.' paths: [ './extensions_windows_x86_64', './extensions_windows_x86_64_debugsymbols' ] @@ -3279,8 +3607,8 @@ jobs: type: string <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: "datadog/dd-trace-ci:php-<< parameters.php_version >>_centos-7" - run: mkdir -p appsec_$(uname -m) @@ -3333,8 +3661,8 @@ jobs: type: string <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-<< parameters.php_version >>" - run: mkdir -p appsec_$(uname -m) @@ -3377,8 +3705,8 @@ jobs: default: medium <<: *BARE_DOCKER_MACHINE steps: - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - append_build_id - setup_docker: docker_image: "datadog/libddwaf:toolchain" - run: mkdir -p appsec_$(uname -m) @@ -3421,13 +3749,13 @@ jobs: - source-v1-{{ .Branch }}-{{ .Revision }} - source-v1-{{ .Branch }}- - source-v1- - - <<: *STEP_CHECKOUT + - git_checkout - save_cache: key: source-v1-{{ .Branch }}-{{ .Revision }} paths: - ".git" - <<: *STEP_ATTACH_WORKSPACE - - <<: *STEP_APPEND_BUILD_ID + - append_build_id - <<: *STEP_COMPOSER_SELF_UPDATE - <<: *STEP_COMPOSER_UPDATE - <<: *STEP_COMPOSER_GENERATE @@ -3442,43 +3770,26 @@ jobs: "package extension": working_directory: ~/datadog - # The `Dockerfile` to this image is located at https://github.com/DataDog/docker-library/blob/master/dd-trace-php/Dockerfile_fpm - docker: [ image: 'datadog/docker-library:ddtrace_php_fpm_packaging' ] + docker: [ image: 'datadog/dd-trace-ci:php_fpm_packaging' ] parameters: asan_build: type: boolean default: false + resource_class: xlarge steps: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT + - git_checkout - <<: *STEP_ATTACH_WORKSPACE - - unless: - condition: << parameters.asan_build >> - steps: - - run: - name: Package Profiler - command: | - # The layout matches what the dd-prof-php releases had to minimize - # transition work. - for triplet in x86_64-unknown-linux-gnu x86_64-alpine-linux-musl aarch64-unknown-linux-gnu aarch64-alpine-linux-musl; do - # Add licensing. TODO: generate rust libs to third-party CSV. - cp -v profiling/LICENSE* profiling/NOTICE "datadog-profiling/${triplet}/" - mkdir -vp "datadog-profiling/${triplet}/bin" - # Add undocumented installer currently used by relenv - cp -v profiling/datadog-profiling-install.sh "datadog-profiling/${triplet}/bin/" - done - find - tar -czf "datadog-profiling.tar.gz" "datadog-profiling/" - run: name: Build packages command: | <<# parameters.asan_build >>export DDTRACE_MAKE_PACKAGES_ASAN=1<> - make packages + make -j9 calculate_package_sha256_sums packages - run: name: Display sha256sums - command: cd build/packages && find . -type f -exec sha256sum {} + && cd - + command: cat package_sha256sums - run: name: Spot-check shape of library name command: | @@ -3503,9 +3814,6 @@ jobs: - store_artifacts: { path: 'build/packages', destination: / } - store_artifacts: { path: 'packages.tar.gz', destination: '/all/packages.tar.gz' } - store_artifacts: { path: 'pecl', destination: '/pecl' } - - persist_to_workspace: - root: '.' - paths: ['./build/packages', 'dockerfiles/verify_packages'] "x-profiling phpt tests on Alpine": working_directory: ~/datadog @@ -3518,18 +3826,24 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout + - run: + name: Install curl + command: apk add curl + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-musl.tar.gz' + - fetch_job_artifact: + job: "package extension" + artifact: 'datadog-setup.php' - run: name: Run cross-product profiling phpt tests command: | set -eu apk update apk add autoconf coreutils gcc make - cd ./build/packages installable_bundle=$(find . -maxdepth 1 -name 'dd-library-php-*-x86_64-linux-musl.tar.gz') php datadog-setup.php --file "${installable_bundle}" --php-bin php --enable-profiling - cd - # run phpize just to get run-tests.php phpize php run-tests.php -p $(which php) --show-diff -g "FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP" tests/ext/profiling @@ -3542,8 +3856,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout - run: name: Install cbindgen command: cargo install cbindgen @@ -3575,8 +3888,7 @@ jobs: - restore_cache: keys: - source-v1-{{ .Branch }}-{{ .Revision }} - - <<: *STEP_CHECKOUT - - <<: *STEP_ATTACH_WORKSPACE + - git_checkout - run: name: Install python 3.12 @@ -3592,13 +3904,17 @@ jobs: - run: name: Clone System Tests repo command: git clone https://github.com/DataDog/system-tests.git - - run: - name: Copy .tar.gz file to system test binaries folder - command: | - ls -la build/packages - installable_bundle=$(find build/packages -maxdepth 1 -name 'dd-library-php-*-x86_64-linux-gnu.tar.gz' | xargs) - echo using $installable_bundle - cp $installable_bundle build/packages/datadog-setup.php system-tests/binaries/ + + - fetch_job_artifact: + job: "package extension" + artifact: 'dd-library-php-[^"]+x86_64-linux-gnu.tar.gz' + directory: system-tests/binaries + + - fetch_job_artifact: + job: "package extension" + artifact: "datadog-setup.php" + directory: system-tests/binaries + - run: name: Build command: << parameters.build >> @@ -3877,7 +4193,6 @@ workflows: resource_class: "arm.medium" - compile_appsec_extension_centos: - requires: [ 'Prepare Code' ] matrix: parameters: php_version: @@ -3895,7 +4210,6 @@ workflows: - "arm.medium" - compile_appsec_extension_alpine: - requires: [ 'Prepare Code' ] matrix: parameters: php_version: @@ -3913,7 +4227,6 @@ workflows: - "arm.medium" - compile_appsec_helper: - requires: [ 'Prepare Code' ] matrix: parameters: resource_class: @@ -3921,7 +4234,6 @@ workflows: - "arm.medium" - compile_alpine: - requires: [ 'Prepare Code' ] matrix: parameters: php_major_minor: @@ -3937,7 +4249,6 @@ workflows: resource_class: "medium" name: "Compile alpine x86_64 PHP << matrix.php_major_minor >>" - compile_alpine: - requires: [ 'Prepare Code' ] matrix: parameters: php_major_minor: @@ -3953,15 +4264,16 @@ workflows: resource_class: "arm.medium" name: "Compile alpine aarch64 PHP << matrix.php_major_minor >>" - compile_rust_alpine: - requires: [ 'Prepare Code' ] - matrix: - parameters: - resource_class: - - "medium" - - "arm.medium" + name: "Compile alpine x86_64 rust" + resource_class: medium + triplet: "x86_64-alpine-linux-musl" + - compile_rust_alpine: + name: "Compile alpine aarch64 rust" + resource_class: arm.medium + triplet: "aarch64-alpine-linux-musl" - link_extension: requires: - - compile_rust_alpine + - "Compile alpine x86_64 rust" - "Compile alpine x86_64 PHP 7.0" - "Compile alpine x86_64 PHP 7.1" - "Compile alpine x86_64 PHP 7.2" @@ -3977,7 +4289,7 @@ workflows: docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine" - link_extension: requires: - - compile_rust_alpine + - "Compile alpine aarch64 rust" - "Compile alpine aarch64 PHP 7.0" - "Compile alpine aarch64 PHP 7.1" - "Compile alpine aarch64 PHP 7.2" @@ -3992,14 +4304,12 @@ workflows: name: "Link aarch64 alpine" docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 70 nts + zts + debug" php_version: "7.0" docker_image: "datadog/dd-trace-ci:php-7.0_centos-7" so_suffix: "20151012" persist_ldflags: true - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 70 nts + zts + debug" php_version: "7.0" docker_image: "datadog/dd-trace-ci:php-7.0_centos-7" @@ -4007,46 +4317,39 @@ workflows: persist_ldflags: true resource_class: "arm.medium" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 71 nts + zts + debug" php_version: "7.1" docker_image: "datadog/dd-trace-ci:php-7.1_centos-7" so_suffix: "20160303" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 71 nts + zts + debug" php_version: "7.1" docker_image: "datadog/dd-trace-ci:php-7.1_centos-7" so_suffix: "20160303" resource_class: "arm.medium" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 72 nts + zts + debug" php_version: "7.2" docker_image: "datadog/dd-trace-ci:php-7.2_centos-7" so_suffix: "20170718" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 72 nts + zts + debug" php_version: "7.2" docker_image: "datadog/dd-trace-ci:php-7.2_centos-7" so_suffix: "20170718" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 72 nts + zts" docker_image: "datadog/dd-trace-ci:php-7.2_windows" php_version: "7.2" so_suffix: "20170718" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 73 nts + zts + debug" php_version: "7.3" docker_image: "datadog/dd-trace-ci:php-7.3_centos-7" so_suffix: "20180731" catch_warnings: false # On debug builds: unused parameter '__zend_filename' - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 73 nts + zts + debug" php_version: "7.3" docker_image: "datadog/dd-trace-ci:php-7.3_centos-7" @@ -4054,114 +4357,98 @@ workflows: catch_warnings: false # On debug builds: unused parameter '__zend_filename' resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 73 nts + zts" docker_image: "datadog/dd-trace-ci:php-7.3_windows" php_version: "7.3" so_suffix: "20180731" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 74 nts + zts + debug" php_version: "7.4" docker_image: "datadog/dd-trace-ci:php-7.4_centos-7" so_suffix: "20190902" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 74 nts + zts + debug" php_version: "7.4" docker_image: "datadog/dd-trace-ci:php-7.4_centos-7" so_suffix: "20190902" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 74 nts + zts" docker_image: "datadog/dd-trace-ci:php-7.4_windows" php_version: "7.4" so_suffix: "20190902" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 80 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.0_centos-7" php_version: "8.0" so_suffix: "20200930" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 80 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.0_centos-7" php_version: "8.0" so_suffix: "20200930" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 80 nts + zts" docker_image: "datadog/dd-trace-ci:php-8.0_windows" php_version: "8.0" so_suffix: "20200930" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 81 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.1_centos-7" php_version: "8.1" so_suffix: "20210902" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 81 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.1_centos-7" php_version: "8.1" so_suffix: "20210902" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 81 nts + zts" docker_image: "datadog/dd-trace-ci:php-8.1_windows" php_version: "8.1" so_suffix: "20210902" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 82 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.2_centos-7" php_version: "8.2" so_suffix: "20220829" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 82 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.2_centos-7" php_version: "8.2" so_suffix: "20220829" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 82 nts + zts" docker_image: "datadog/dd-trace-ci:php-8.2_windows" php_version: "8.2" so_suffix: "20220829" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 83 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.3_centos-7" php_version: "8.3" so_suffix: "20230831" - compile_extension_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 83 nts + zts + debug" docker_image: "datadog/dd-trace-ci:php-8.3_centos-7" php_version: "8.3" so_suffix: "20230831" resource_class: "arm.medium" - compile_extension_windows: - requires: [ 'Prepare Code' ] name: "Compile Windows PHP 83 nts + zts" docker_image: "datadog/dd-trace-ci:php-8.3_windows" php_version: "8.3" so_suffix: "20230831" - compile_rust_centos: - requires: [ 'Prepare Code' ] name: "Compile x86_64 rust" + triplet: "x86_64-unknown-linux-gnu" - compile_rust_centos: - requires: [ 'Prepare Code' ] name: "Compile aarch64 rust" resource_class: "arm.large" + triplet: "aarch64-unknown-linux-gnu" - link_extension: requires: @@ -4259,56 +4546,46 @@ workflows: - compile_appsec_helper - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 74 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-7.4_buster" so_suffix: "20190902" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 74 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-7.4_buster" so_suffix: "20190902" resource_class: "arm.medium" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 80 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.0_buster" so_suffix: "20200930" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 80 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.0_buster" so_suffix: "20200930" resource_class: "arm.medium" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 81 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.1_buster" so_suffix: "20210902" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 81 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.1_buster" so_suffix: "20210902" resource_class: "arm.medium" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 82 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.2_buster" so_suffix: "20220829" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 82 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.2_buster" so_suffix: "20220829" resource_class: "arm.medium" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile x86_64 PHP 83 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.3_buster" so_suffix: "20230831" - compile_extension_asan: - requires: [ 'Prepare Code' ] name: "Compile aarch64 PHP 83 debug-zts-asan" docker_image: "datadog/dd-trace-ci:php-8.3_buster" so_suffix: "20230831" @@ -4318,6 +4595,7 @@ workflows: name: "package extension zts-debug-asan" asan_build: true requires: + - "Prepare Code" - "Compile x86_64 PHP 74 debug-zts-asan" - "Compile aarch64 PHP 74 debug-zts-asan" - "Compile x86_64 PHP 80 debug-zts-asan" @@ -4586,119 +4864,6 @@ workflows: name: "PHP 83 PECL tests" docker_image: "datadog/dd-trace-ci:php-8.3_buster" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 72 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-7.2_buster" - php_major_minor: "7.2" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 72 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-7.2_buster" - php_major_minor: "7.2" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 73 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-7.3_buster" - php_major_minor: "7.3" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 74 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-7.4_buster" - php_major_minor: "7.4" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 74 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-7.4_buster" - php_major_minor: "7.4" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 80 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.0_buster" - php_major_minor: "8.0" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 80 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.0_buster" - php_major_minor: "8.0" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 81 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.1_buster" - php_major_minor: "8.1" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 81 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.1_buster" - php_major_minor: "8.1" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 82 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.2_buster" - php_major_minor: "8.2" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 82 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.2_buster" - php_major_minor: "8.2" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 83 web tests with apache (+ opcache)" - resource_class: medium+ - sapi: apache2handler - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.3_buster" - php_major_minor: "8.3" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 83 web tests with nginx + FastCGI" - resource_class: medium+ - sapi: cgi-fcgi - integration_testsuite: "test_web" - docker_image: "datadog/dd-trace-ci:php-8.3_buster" - php_major_minor: "8.3" - - integration_tests: - requires: [ 'Prepare Code' ] - name: "PHP 74 custom autoloaded web tests with nginx + PHP-FPM" - resource_class: medium+ - sapi: fpm-fcgi - integration_testsuite: "test_web_custom" - docker_image: "datadog/dd-trace-ci:php-7.4_buster" - php_major_minor: "7.4" - - min_install_tests: requires: [ 'package extension' ] name: "PHP min install tests" @@ -4731,28 +4896,24 @@ workflows: TEST_LIBRARY=php ./run.sh PARAMETRIC - "compile_loader": - requires: [ 'Prepare Code' ] name: "Compile Loader Linux x86_64" docker_image: "datadog/dd-trace-ci:php-8.3_buster" resource_class: "medium" os: "linux-gnu" - "compile_loader": - requires: [ 'Prepare Code' ] name: "Compile Loader Linux aarch64" docker_image: "datadog/dd-trace-ci:php-8.3_buster" resource_class: "arm.medium" os: "linux-gnu" - "compile_loader": - requires: [ 'Prepare Code' ] name: "Compile Loader Alpine x86_64" docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.0" resource_class: "medium" os: "linux-musl" - "compile_loader": - requires: [ 'Prepare Code' ] name: "Compile Loader Alpine aarch64" docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.0" resource_class: "arm.medium" @@ -4865,8 +5026,67 @@ workflows: - "Prepare Code" + - "cache cargo deps": + name: "cache cargo deps - x86_64-unknown-linux-gnu" + docker_image: "datadog/dd-trace-ci:buster" + triplet: "x86_64-unknown-linux-gnu" + - "cache cargo deps": + name: "cache cargo deps - aarch64-unknown-linux-gnu" + docker_image: "datadog/dd-trace-ci:buster" + triplet: "aarch64-unknown-linux-gnu" + resource_class: "arm.medium" + + - compile_rust_test: + name: "Compile rust code for testing" + resource_class: xlarge + triplet: "x86_64-unknown-linux-gnu" + + - compile_rust_test: + name: "medium: Compile ASAN rust code for testing" + resource_class: xlarge + triplet: "x86_64-unknown-linux-gnu" + asan: true + - compile_rust_test: + name: "arm.medium: Compile ASAN rust code for testing" + resource_class: arm.xlarge + triplet: "aarch64-unknown-linux-gnu" + asan: true + + - compile_extension_test: + name: "Compile << matrix.php_major_minor >> extension for testing" + matrix: + parameters: + php_major_minor: + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + switch_php_version: + - debug + + - compile_extension_test: + name: "<< matrix.resource_class >>: Compile << matrix.php_major_minor >> ZTS asan extension for testing" + matrix: + parameters: + php_major_minor: + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + switch_php_version: + - debug-zts-asan + resource_class: + - medium + - arm.medium + - test: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] matrix: parameters: php_major_minor: @@ -4889,7 +5109,7 @@ workflows: - test_opcache - test: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] coverage: true codecov_flags: tracer-php matrix: @@ -4901,7 +5121,7 @@ workflows: - test_unit_coverage - test: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] matrix: parameters: php_major_minor: @@ -4913,7 +5133,7 @@ workflows: - test_extension_ci - test: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] matrix: parameters: resource_class: @@ -4942,13 +5162,13 @@ workflows: # sidecar is version independent - test_sidecar_sender: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'medium: Compile 8.2 ZTS asan extension for testing', 'medium: Compile ASAN rust code for testing' ] php_major_minor: '8.2' switch_php_version: debug-zts-asan resource_class: medium - test_multi_observer: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'medium: Compile << matrix.php_major_minor >> ZTS asan extension for testing', 'medium: Compile ASAN rust code for testing' ] matrix: parameters: php_major_minor: @@ -4960,7 +5180,7 @@ workflows: - debug-zts-asan - coverage: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] matrix: parameters: php_major_minor: @@ -4976,7 +5196,7 @@ workflows: make_target: - test_coverage - asan: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', '<< matrix.resource_class >>: Compile << matrix.php_major_minor >> ZTS asan extension for testing', '<< matrix.resource_class >>: Compile ASAN rust code for testing' ] matrix: parameters: php_major_minor: @@ -5003,7 +5223,7 @@ workflows: switch_php_version: debug-zts-asan - integration: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] resource_class: medium+ matrix: parameters: @@ -5024,7 +5244,7 @@ workflows: - test_integration - integration: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] resource_class: medium+ coverage: true codecov_flags: tracer-php @@ -5038,7 +5258,7 @@ workflows: - test_distributed_tracing_coverage - integration_snapshots: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] # Due to Symfony OOM during composer update resource_class: xlarge matrix: @@ -5058,7 +5278,7 @@ workflows: - test_integrations - integration_snapshots: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] # Due to Symfony OOM during composer update resource_class: xlarge coverage: true @@ -5073,7 +5293,7 @@ workflows: - test_integrations_coverage - integration: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] resource_class: medium+ sapi: fpm-fcgi disable_runner_distributed_tracing: true @@ -5114,8 +5334,105 @@ workflows: make_target: - test_integrations_phpredis5 + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.2 extension for testing', 'Compile rust code for testing' ] + name: "PHP 72 web tests with apache (+ opcache)" + resource_class: medium+ + sapi: apache2handler + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-7.2_buster" + php_major_minor: "7.2" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.2 extension for testing', 'Compile rust code for testing' ] + name: "PHP 72 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-7.2_buster" + php_major_minor: "7.2" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.3 extension for testing', 'Compile rust code for testing' ] + name: "PHP 73 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-7.3_buster" + php_major_minor: "7.3" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.4 extension for testing', 'Compile rust code for testing' ] + name: "PHP 74 web tests with apache (+ opcache)" + resource_class: medium+ + sapi: apache2handler + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-7.4_buster" + php_major_minor: "7.4" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.4 extension for testing', 'Compile rust code for testing' ] + name: "PHP 74 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-7.4_buster" + php_major_minor: "7.4" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.0 extension for testing', 'Compile rust code for testing' ] + name: "PHP 80 web tests with apache (+ opcache)" + resource_class: medium+ + sapi: apache2handler + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.0_buster" + php_major_minor: "8.0" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.0 extension for testing', 'Compile rust code for testing' ] + name: "PHP 80 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.0_buster" + php_major_minor: "8.0" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.1 extension for testing', 'Compile rust code for testing' ] + name: "PHP 81 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.1_buster" + php_major_minor: "8.1" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.2 extension for testing', 'Compile rust code for testing'] + name: "PHP 82 web tests with apache (+ opcache)" + resource_class: medium+ + sapi: apache2handler + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.2_buster" + php_major_minor: "8.2" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.3 extension for testing', 'Compile rust code for testing' ] + name: "PHP 83 web tests with apache (+ opcache)" + resource_class: medium+ + sapi: apache2handler + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.3_buster" + php_major_minor: "8.3" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 8.3 extension for testing', 'Compile rust code for testing' ] + name: "PHP 83 web tests with nginx + FastCGI" + resource_class: medium+ + sapi: cgi-fcgi + integration_testsuite: "test_web" + docker_image: "datadog/dd-trace-ci:php-8.3_buster" + php_major_minor: "8.3" + - integration_tests: + requires: [ 'Prepare Code', 'Compile 7.4 extension for testing', 'Compile rust code for testing' ] + name: "PHP 74 custom autoloaded web tests with nginx + PHP-FPM" + resource_class: medium+ + sapi: fpm-fcgi + integration_testsuite: "test_web_custom" + docker_image: "datadog/dd-trace-ci:php-7.4_buster" + php_major_minor: "7.4" + - integration: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile << matrix.php_major_minor >> extension for testing', 'Compile rust code for testing' ] resource_class: medium+ sapi: fpm-fcgi disable_runner_distributed_tracing: true @@ -5131,130 +5448,121 @@ workflows: - test_distributed_tracing_coverage - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.0 extension for testing', 'Compile rust code for testing' ] name: "PHP 70 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-7.0_buster" xdebug_version_one: "2.7.2" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.1 extension for testing', 'Compile rust code for testing' ] name: "PHP 71 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-7.1_buster" xdebug_version_one: "2.9.5" xdebug_version_two: "2.9.2" - # - unit_tests: # disabled due to posisbly leaking tests - # requires: [ 'Prepare Code' ] - # name: "PHP 70 Unit tests-zts" - # docker_image: "datadog/docker-library:ddtrace_alpine_php-7.0-zts-debug" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.2 extension for testing', 'Compile rust code for testing' ] name: "PHP 72 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-7.2_buster" xdebug_version_one: "2.9.5" xdebug_version_two: "2.9.2" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.3 extension for testing', 'Compile rust code for testing' ] name: "PHP 73 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-7.3_buster" xdebug_version_one: "2.9.5" xdebug_version_two: "2.9.2" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.4 extension for testing', 'Compile rust code for testing' ] name: "PHP 74 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-7.4_buster" xdebug_version_one: "2.9.5" xdebug_version_two: "2.9.2" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.0 extension for testing', 'Compile rust code for testing' ] name: "PHP 80 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-8.0_buster" xdebug_version_one: "3.0.0" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.1 extension for testing', 'Compile rust code for testing' ] name: "PHP 81 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-8.1_buster" xdebug_version_one: "3.1.0" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.2 extension for testing', 'Compile rust code for testing' ] name: "PHP 82 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-8.2_buster" xdebug_version_one: "3.2.2" - xdebug_tests: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.3 extension for testing', 'Compile rust code for testing' ] name: "PHP 83 Xdebug tests" docker_image: "datadog/dd-trace-ci:php-8.3_buster" xdebug_version_one: "3.3.0" - - placeholder: - requires: [ 'Prepare Code' ] - name: Language tests - - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 8.3 extension for testing' ] name: "PHP 83 language tests" xfail_list: dockerfiles/ci/xfail_tests/8.3.list docker_image: "datadog/dd-trace-ci:php-8.3_buster" parallel_workers: true - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 8.2 extension for testing' ] name: "PHP 82 language tests" xfail_list: dockerfiles/ci/xfail_tests/8.2.list docker_image: "datadog/dd-trace-ci:php-8.2_buster" parallel_workers: true - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 8.1 extension for testing' ] name: "PHP 81 language tests" xfail_list: dockerfiles/ci/xfail_tests/8.1.list docker_image: "datadog/dd-trace-ci:php-8.1_buster" parallel_workers: true - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 8.0 extension for testing' ] name: "PHP 80 language tests" xfail_list: dockerfiles/ci/xfail_tests/8.0.list docker_image: "datadog/dd-trace-ci:php-8.0_buster" parallel_workers: true - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 7.4 extension for testing' ] name: "PHP 74 language tests" xfail_list: dockerfiles/ci/xfail_tests/7.4.list docker_image: "datadog/dd-trace-ci:php-7.4_buster" parallel_workers: true - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 7.3 extension for testing' ] name: "PHP 73 language tests" xfail_list: dockerfiles/ci/xfail_tests/7.3.list docker_image: "datadog/dd-trace-ci:php-7.3_buster" - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 7.2 extension for testing' ] name: "PHP 72 language tests" xfail_list: dockerfiles/ci/xfail_tests/7.2.list docker_image: "datadog/dd-trace-ci:php-7.2_buster" - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 7.1 extension for testing' ] name: "PHP 71 language tests" xfail_list: dockerfiles/ci/xfail_tests/7.1.list docker_image: "datadog/dd-trace-ci:php-7.1_buster" - php_language_tests: - requires: [ 'Language tests' ] + requires: [ 'Compile rust code for testing', 'Compile 7.0 extension for testing' ] name: "PHP 70 language tests" xfail_list: dockerfiles/ci/xfail_tests/7.0.list docker_image: "datadog/dd-trace-ci:php-7.0_buster" - internal_integrations: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.0 extension for testing', 'Compile rust code for testing' ] name: "PHP 80 curl integration tests a shared lib" ext_name: "curl" docker_image: "datadog/dd-trace-ci:php-8.0-shared-ext" - static_analysis: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 7.1 extension for testing', 'Compile rust code for testing' ] name: "Static Analysis 71" docker_image: datadog/dd-trace-ci:php-7.1_buster scenario: opentracing_beta6 - static_analysis: - requires: [ 'Prepare Code' ] + requires: [ 'Prepare Code', 'Compile 8.0 extension for testing', 'Compile rust code for testing' ] name: "Static Analysis 80" docker_image: datadog/dd-trace-ci:php-8.0_buster scenario: opentracing10 - - "cbindgen up-to-date": - requires: [ 'Prepare Code' ] + - "cbindgen up-to-date" - "Post-Install Hook": requires: [ 'Prepare Code' ] diff --git a/Makefile b/Makefile index 0e2331b25f..c5dbcd7c20 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ ARCHITECTURE = $(shell uname -m) QUIET_TESTS := ${CIRCLE_SHA1} RUST_DEBUG_BUILD ?= $(shell [ -n "${DD_TRACE_DOCKER_DEBUG}" ] && echo 1) EXTRA_CONFIGURE_OPTIONS ?= +ASSUME_COMPILED := ${DD_TRACE_ASSUME_COMPILED} VERSION := $(shell cat VERSION) @@ -97,19 +98,22 @@ all: $(BUILD_DIR)/configure $(SO_FILE) $(BUILD_DIR)/configure: $(M4_FILES) $(BUILD_DIR)/ddtrace.sym $(BUILD_DIR)/VERSION $(Q) (cd $(BUILD_DIR); phpize && $(SED_I) 's/\/FAILED/\/\\bFAILED/' $(BUILD_DIR)/run-tests.php) # Fix PHP 5.4 exit code bug when running selected tests (FAILED vs XFAILED) +$(BUILD_DIR)/run-tests.php: $(if $(ASSUME_COMPILED),, $(BUILD_DIR)/configure) + $(if $(ASSUME_COMPILED), cp $(shell dirname $(shell realpath $(shell which phpize)))/../lib/php/build/run-tests.php $(BUILD_DIR)/run-tests.php) + $(BUILD_DIR)/Makefile: $(BUILD_DIR)/configure - $(Q) (cd $(BUILD_DIR); ./configure --$(if $(RUST_DEBUG_BUILD),enable,disable)-ddtrace-rust-debug $(EXTRA_CONFIGURE_OPTIONS)) + $(Q) (cd $(BUILD_DIR); ./configure --$(if $(RUST_DEBUG_BUILD),enable,disable)-ddtrace-rust-debug $(if $(ASAN), --enable-ddtrace-sanitize) $(EXTRA_CONFIGURE_OPTIONS)) all_object_files: $(C_FILES) $(RUST_FILES) $(BUILD_DIR)/Makefile -$(SO_FILE): all_object_files $(BUILD_DIR)/compile_rust.sh - $(Q) $(MAKE) -C $(BUILD_DIR) -j CFLAGS="$(CFLAGS)$(if $(ASAN), -fsanitize=address)" LDFLAGS="$(LDFLAGS)$(if $(ASAN), -fsanitize=address)" +$(SO_FILE): $(if $(ASSUME_COMPILED),, all_object_files $(BUILD_DIR)/compile_rust.sh) + $(if $(ASSUME_COMPILED),,$(Q) $(MAKE) -C $(BUILD_DIR) -j) $(AR_FILE): all_object_files - $(Q) $(MAKE) -C $(BUILD_DIR) -j ./modules/ddtrace.a all CFLAGS="$(CFLAGS)$(if $(ASAN), -fsanitize=address)" + $(Q) $(MAKE) -C $(BUILD_DIR) -j ./modules/ddtrace.a all $(PHP_EXTENSION_DIR)/ddtrace.so: $(SO_FILE) - $(Q) $(SUDO) $(MAKE) -C $(BUILD_DIR) install + $(Q) $(SUDO) $(if $(ASSUME_COMPILED),cp $(BUILD_DIR)/modules/ddtrace.so $(PHP_EXTENSION_DIR)/ddtrace.so,$(MAKE) -C $(BUILD_DIR) install) install: $(PHP_EXTENSION_DIR)/ddtrace.so @@ -125,51 +129,51 @@ install_ini: $(INI_FILE) install_all: install install_ini -run_tests: $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/configure +run_tests: $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php $(RUN_TESTS_CMD) $(BUILD_DIR)/$(TESTS) -test_c: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) +test_c: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php $(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) DD_TRACE_CLI_ENABLED=1 DD_TRACE_GIT_METADATA_ENABLED=0 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) $(BUILD_DIR)/$(TESTS) test_c_coverage: dist_clean DD_TRACE_DOCKER_DEBUG=1 EXTRA_CFLAGS="-fprofile-arcs -ftest-coverage" $(MAKE) test_c || exit 0 -test_c_disabled: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) +test_c_disabled: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php ( \ DD_TRACE_CLI_ENABLED=0 DD_TRACE_DEBUG=1 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) $(BUILD_DIR)/$(TESTS) || true; \ ! grep -E 'Successfully triggered flush with trace of size|=== Total [0-9]+ memory leaks detected ===|Segmentation fault|Assertion ' $$(find $(BUILD_DIR)/$(TESTS) -name "*.out" | grep -v segfault_backtrace_enabled.out); \ ) -test_c_observer: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) +test_c_observer: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php $(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) DD_TRACE_CLI_ENABLED=1 DD_TRACE_GIT_METADATA_ENABLED=0 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d extension=zend_test.so -d zend_test.observer.enabled=1 -d zend_test.observer.observe_all=1 -d zend_test.observer.show_output=0 $(BUILD_DIR)/$(TESTS) -test_opcache: $(SO_FILE) $(TEST_OPCACHE_FILES) +test_opcache: $(SO_FILE) $(TEST_OPCACHE_FILES) $(BUILD_DIR)/run-tests.php $(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) DD_TRACE_CLI_ENABLED=1 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d zend_extension=opcache.so $(BUILD_DIR)/tests/opcache test_c_mem: export DD_TRACE_CLI_ENABLED=1 -test_c_mem: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) +test_c_mem: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m $(BUILD_DIR)/$(TESTS) -test_c2php: $(SO_FILE) $(INIT_HOOK_TEST_FILES) +test_c2php: $(SO_FILE) $(INIT_HOOK_TEST_FILES) $(BUILD_DIR)/run-tests.php ( \ set -xe; \ + sed -i 's/stream_socket_accept($$listenSock, 5)/stream_socket_accept($$listenSock, 20)/' $(BUILD_DIR)/run-tests.php; \ export DD_TRACE_CLI_ENABLED=1; \ export USE_ZEND_ALLOC=0; \ export ZEND_DONT_UNLOAD_MODULES=1; \ export USE_TRACKED_ALLOC=1; \ - $(shell grep -Pzo '(?<=--ENV--)(?s).+?(?=--)' $(INIT_HOOK_TEST_FILES)) valgrind -q --tool=memcheck --trace-children=yes --vex-iropt-register-updates=allregs-at-mem-access php -n -d extension=$(SO_FILE) -d datadog.trace.sources_path=$(TRACER_SOURCE_DIR) $(INIT_HOOK_TEST_FILES); \ + $(shell grep -Pzo '(?<=--ENV--)(?s).+?(?=--)' $(INIT_HOOK_TEST_FILES)) valgrind -q --tool=memcheck --trace-children=yes --vex-iropt-register-updates=allregs-at-mem-access bash -c '$(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d datadog.trace.sources_path=$(TRACER_SOURCE_DIR) -d pcre.jit=0 $(INIT_HOOK_TEST_FILES)'; \ ) -test_with_init_hook: $(SO_FILE) $(INIT_HOOK_TEST_FILES) +test_with_init_hook: $(SO_FILE) $(INIT_HOOK_TEST_FILES) $(BUILD_DIR)/run-tests.php $(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) DD_TRACE_CLI_ENABLED=1 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d datadog.trace.sources_path=$(TRACER_SOURCE_DIR) $(INIT_HOOK_TEST_FILES); -test_extension_ci: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) +test_extension_ci: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php ( \ set -xe; \ export PATH="$(PROJECT_ROOT)/tests/ext/valgrind:$$PATH"; \ export DD_TRACE_CLI_ENABLED=1; \ export TEST_PHP_JUNIT=$(JUNIT_RESULTS_DIR)/normal-extension-test.xml; \ - $(MAKE) -C $(BUILD_DIR) CFLAGS="-g" clean all; \ export DD_TRACE_GIT_METADATA_ENABLED=0; \ $(RUN_TESTS_CMD) -d extension=$(SO_FILE) $(BUILD_DIR)/$(TESTS); \ \ @@ -435,21 +439,20 @@ $(PACKAGES_BUILD_DIR): # Example .tar.gz.aarch64, .tar.gz.x86_64 .tar.gz.%: $(PACKAGES_BUILD_DIR) - mkdir -p /tmp/$(PACKAGES_BUILD_DIR) - rm -rf /tmp/$(PACKAGES_BUILD_DIR)/* - fpm -p /tmp/$(PACKAGES_BUILD_DIR)/$(PACKAGE_NAME)-$(VERSION) -t dir $(call FPM_OPTS, $(*)) $(call FPM_FILES, $(*)) - tar zcf $(PACKAGES_BUILD_DIR)/$(PACKAGE_NAME)-$(VERSION).$(*).tar.gz -C /tmp/$(PACKAGES_BUILD_DIR)/$(PACKAGE_NAME)-$(VERSION) . --owner=0 --group=0 + mkdir -p /tmp/$(PACKAGES_BUILD_DIR)-$(*) + rm -rf /tmp/$(PACKAGES_BUILD_DIR)-$(*)/* + fpm -p /tmp/$(PACKAGES_BUILD_DIR)-$(*)/$(PACKAGE_NAME)-$(VERSION) -t dir $(call FPM_OPTS, $(*)) $(call FPM_FILES, $(*)) + tar -zcf $(PACKAGES_BUILD_DIR)/$(PACKAGE_NAME)-$(VERSION).$(*).tar.gz -C /tmp/$(PACKAGES_BUILD_DIR)-$(*)/$(PACKAGE_NAME)-$(VERSION) . --owner=0 --group=0 bundle.tar.gz: $(PACKAGES_BUILD_DIR) bash ./tooling/bin/generate-final-artifact.sh \ $(VERSION) \ $(PACKAGES_BUILD_DIR) + +$(PACKAGES_BUILD_DIR)/datadog-setup.php: $(PACKAGES_BUILD_DIR) bash ./tooling/bin/generate-installers.sh \ $(VERSION) \ $(PACKAGES_BUILD_DIR) - bash ./tooling/bin/generate-ssi-package.sh \ - $(VERSION) \ - $(PACKAGES_BUILD_DIR) build_pecl_package: BUILD_DIR='$(BUILD_DIR)/'; \ @@ -457,10 +460,20 @@ build_pecl_package: tooling/bin/pecl-build $${FILES//$${BUILD_DIR}/} dbgsym.tar.gz: - $(if $(DDTRACE_MAKE_PACKAGES_ASAN), , tar zcf $(PACKAGES_BUILD_DIR)/dd-library-php-$(VERSION)_windows_debugsymbols.tar.gz ./extensions_windows_x86_64_debugsymbols --owner=0 --group=0) + $(if $(DDTRACE_MAKE_PACKAGES_ASAN), , tar -zcf $(PACKAGES_BUILD_DIR)/dd-library-php-$(VERSION)_windows_debugsymbols.tar.gz ./extensions_windows_x86_64_debugsymbols --owner=0 --group=0) + +installer_packages: .apk.x86_64 .apk.aarch64 .rpm.x86_64 .rpm.aarch64 .deb.x86_64 .deb.arm64 .tar.gz.x86_64 .tar.gz.aarch64 bundle.tar.gz dbgsym.tar.gz + tar --use-compress-program=pigz --exclude='dd-library-php-ssi-*' -cf packages.tar.gz $(PACKAGES_BUILD_DIR) --owner=0 --group=0 + +ssi_packages: $(PACKAGES_BUILD_DIR) + bash ./tooling/bin/generate-ssi-package.sh \ + $(VERSION) \ + $(PACKAGES_BUILD_DIR) + +calculate_package_sha256_sums: $(PACKAGES_BUILD_DIR)/datadog-setup.php installer_packages + (cd build/packages && find . -type f -exec sha256sum {} + > ../../package_sha256sums) -packages: .apk.x86_64 .apk.aarch64 .rpm.x86_64 .rpm.aarch64 .deb.x86_64 .deb.arm64 .tar.gz.x86_64 .tar.gz.aarch64 bundle.tar.gz dbgsym.tar.gz - tar --exclude='dd-library-php-ssi-*' -zcf packages.tar.gz $(PACKAGES_BUILD_DIR) --owner=0 --group=0 +packages: $(PACKAGES_BUILD_DIR)/datadog-setup.php ssi_packages installer_packages # Generates the src/bridge/_generated_*.php files. generate: diff --git a/compile_rust.sh b/compile_rust.sh index a2981f33cc..a073e85ca7 100755 --- a/compile_rust.sh +++ b/compile_rust.sh @@ -15,4 +15,11 @@ case "${host_os}" in ;; esac +set -x + +if test -n "$COMPILE_ASAN"; then + export LDFLAGS="-fsanitize=address" + export CFLAGS="-fsanitize=address -fno-omit-frame-pointer" +fi + SIDECAR_VERSION=$(cat ../VERSION) RUSTFLAGS="$RUSTFLAGS" RUSTC_BOOTSTRAP=1 "${DDTRACE_CARGO:-cargo}" build $(test "${PROFILE:-debug}" = "debug" || echo --profile "$PROFILE") "$@" diff --git a/config.m4 b/config.m4 index 77c8b74c10..c29a3c9357 100644 --- a/config.m4 +++ b/config.m4 @@ -1,8 +1,8 @@ PHP_ARG_ENABLE(ddtrace, whether to enable Datadog tracing support, [ --enable-ddtrace Enable Datadog tracing support]) -PHP_ARG_WITH(ddtrace-sanitize, whether to enable AddressSanitizer for ddtrace, - [ --with-ddtrace-sanitize Build Datadog tracing with AddressSanitizer support], no, no) +PHP_ARG_ENABLE(ddtrace-sanitize, whether to enable AddressSanitizer for ddtrace, + [ --enable-ddtrace-sanitize Build Datadog tracing with AddressSanitizer support], no, no) PHP_ARG_WITH(ddtrace-rust-library, the rust library is located; i.e. to compile without cargo, [ --with-ddtrace-rust-library Location to rust library for linking against], -, will be compiled) @@ -325,7 +325,7 @@ EOT cat <> Makefile.fragments $ddtrace_rust_lib: $( (find "$ext_srcdir/components-rs" -name "*.rs" -o -name "Cargo.toml"; find "$ext_srcdir/../../libdatadog" -name "*.rs" -not -path "*/target/*"; find "$ext_srcdir/libdatadog" -name "*.rs" -not -path "*/target/*") 2>/dev/null | xargs ) - (cd "$ext_srcdir"; CARGO_TARGET_DIR=\$(builddir)/target/ SHARED=$(test "$ext_shared" = "yes" && echo 1) PROFILE="$ddtrace_cargo_profile" host_os="$host_os" DDTRACE_CARGO=\$(DDTRACE_CARGO) sh ./compile_rust.sh \$(shell echo "\$(MAKEFLAGS)" | $EGREP -o "[[-]]j[[0-9]]+")) + (cd "$ext_srcdir"; CARGO_TARGET_DIR=\$(builddir)/target/ SHARED=$(test "$ext_shared" = "yes" && echo 1) PROFILE="$ddtrace_cargo_profile" host_os="$host_os" DDTRACE_CARGO=\$(DDTRACE_CARGO) $(if test "$PHP_DDTRACE_SANITIZE" != "no"; then echo COMPILE_ASAN=1; fi) sh ./compile_rust.sh \$(shell echo "\$(MAKEFLAGS)" | $EGREP -o "[[-]]j[[0-9]]+")) EOT fi diff --git a/dockerfiles/packaging/fpm_packaging/Dockerfile b/dockerfiles/packaging/fpm_packaging/Dockerfile new file mode 100644 index 0000000000..1e8d4f27c2 --- /dev/null +++ b/dockerfiles/packaging/fpm_packaging/Dockerfile @@ -0,0 +1,23 @@ +FROM cimg/ruby:3.3.4 AS base + +USER root +WORKDIR /home/circleci + +RUN apt-get update && apt-get -y install vim less build-essential rpm lintian jq + +# Need at least tar 1.35 to work around concurrency problems with atime and inode count checks +# See also: https://stackoverflow.com/a/77765876 +FROM base as compile-tar +RUN curl -LO https://ftp.gnu.org/gnu/tar/tar-1.35.tar.gz +RUN tar xfz tar-1.35.tar.gz +RUN (cd tar-1.35 && FORCE_UNSAFE_CONFIGURE=1 ./configure --prefix=/usr && make install) + +FROM base as final +ADD fpm_apk_pax_header.patch /tmp +RUN sudo gem install fpm -v 1.15.1 +RUN (cd /usr/local/lib/ruby/gems/3.3.0/gems/fpm-1.15.1; patch -p 1 < /tmp/fpm_apk_pax_header.patch ) && rm -f /tmp/fpm_apk_pax_header.patch + +COPY --from=compile-tar /usr/bin/tar /usr/bin/tar + +USER circleci +ENTRYPOINT [ "bash" ] diff --git a/dockerfiles/packaging/fpm_packaging/README.md b/dockerfiles/packaging/fpm_packaging/README.md new file mode 100644 index 0000000000..5c88b1167e --- /dev/null +++ b/dockerfiles/packaging/fpm_packaging/README.md @@ -0,0 +1,5 @@ +## Build for x86_64 + +``` +docker buildx build --platform=linux/amd64 -t datadog/dd-trace-ci:php_fpm_packaging --push . +``` diff --git a/dockerfiles/packaging/fpm_packaging/fpm_apk_pax_header.patch b/dockerfiles/packaging/fpm_packaging/fpm_apk_pax_header.patch new file mode 100644 index 0000000000..0f877c6461 --- /dev/null +++ b/dockerfiles/packaging/fpm_packaging/fpm_apk_pax_header.patch @@ -0,0 +1,29 @@ +From 18221cceb06860395120b56cca7e270539b74073 Mon Sep 17 00:00:00 2001 +From: Pawel Chojnacki +Date: Wed, 30 Jan 2019 16:35:50 +0100 +Subject: [PATCH] Add guard against modifying LongLink entry and leave entries + above 80 chars alone + +--- + lib/fpm/package/apk.rb | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/fpm/package/apk.rb b/lib/fpm/package/apk.rb +index dd69067..bc9ff50 100644 +--- a/lib/fpm/package/apk.rb ++++ b/lib/fpm/package/apk.rb +@@ -435,6 +435,12 @@ class FPM::Package::APK< FPM::Package + # This takes an unchanged directory name and "paxifies" it. + def add_paxstring(ret) + ++ # Check if this is special Tar filename to mark that the next entry file name will be longer than 100 characters. ++ return ret if ret.match? "././@LongLink" ++ ++ # adding PaxHeaders prefix to entries over 80 characters is impossible without creating extra entries ++ return ret if ret.length > 80 ++ + pax_slash = ret.rindex('/') + if(pax_slash == nil) + pax_slash = 0 +-- +2.18.0 diff --git a/tests/ext/background-sender/agent_sampling_sidecar.phpt b/tests/ext/background-sender/agent_sampling_sidecar.phpt index 4529cbaf9f..2f7dbb5d63 100644 --- a/tests/ext/background-sender/agent_sampling_sidecar.phpt +++ b/tests/ext/background-sender/agent_sampling_sidecar.phpt @@ -2,6 +2,7 @@ The sidecar trace flusher sender informs about changes to the agent sample rate --SKIPIF-- + --ENV-- DD_TRACE_LOG_LEVEL=info,startup=off DD_AGENT_HOST=request-replayer diff --git a/tests/randomized/Makefile b/tests/randomized/Makefile index f407133748..0814ef0f44 100644 --- a/tests/randomized/Makefile +++ b/tests/randomized/Makefile @@ -66,7 +66,7 @@ pull.buster.%: library.local: @mkdir -p $(LIBRARY_DOWNLOAD_PATH) # For now we only handle centos in randomized tests - @cp ../../build/packages/dd-library-php-*-$(ARCHITECTURE)-linux-gnu.tar.gz $(LIBRARY_DOWNLOAD_PATH)/dd-library-php.tar.gz + @cp ../../dd-library-php-*-$(ARCHITECTURE)-linux-gnu.tar.gz $(LIBRARY_DOWNLOAD_PATH)/dd-library-php.tar.gz library.download: @echo "Downloading library at url: $(LIBRARY_TEST_URL)" diff --git a/tooling/bin/generate-final-artifact.sh b/tooling/bin/generate-final-artifact.sh index 606d87176f..d2ea5f2525 100755 --- a/tooling/bin/generate-final-artifact.sh +++ b/tooling/bin/generate-final-artifact.sh @@ -40,20 +40,20 @@ for architecture in "${architectures[@]}"; do for php_api in "${php_apis[@]}"; do mkdir -p ${tmp_folder_final_gnu_trace}/ext/$php_api ${tmp_folder_final_musl_trace}/ext/$php_api; if [[ -z ${DDTRACE_MAKE_PACKAGES_ASAN:-} ]]; then - cp ./extensions_${architecture}/ddtrace-$php_api.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace.so; - cp ./extensions_${architecture}/ddtrace-$php_api-zts.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-zts.so; - cp ./extensions_${architecture}/ddtrace-$php_api-debug.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-debug.so; - cp ./extensions_${architecture}/ddtrace-$php_api-alpine.so ${tmp_folder_final_musl_trace}/ext/$php_api/ddtrace.so; + ln ./extensions_${architecture}/ddtrace-$php_api.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace.so; + ln ./extensions_${architecture}/ddtrace-$php_api-zts.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-zts.so; + ln ./extensions_${architecture}/ddtrace-$php_api-debug.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-debug.so; + ln ./extensions_${architecture}/ddtrace-$php_api-alpine.so ${tmp_folder_final_musl_trace}/ext/$php_api/ddtrace.so; if [[ ${php_api} -ge 20151012 ]]; then # zts on alpine starting 7.0 - cp ./extensions_${architecture}/ddtrace-$php_api-alpine-zts.so ${tmp_folder_final_musl_trace}/ext/$php_api/ddtrace-zts.so; + ln ./extensions_${architecture}/ddtrace-$php_api-alpine-zts.so ${tmp_folder_final_musl_trace}/ext/$php_api/ddtrace-zts.so; fi if [[ ${php_api} -ge 20170718 && $architecture == "x86_64" ]]; then # Windows support starts on 7.2 mkdir -p ${tmp_folder_final_windows_trace}/ext/$php_api; - cp ./extensions_windows_${architecture}/php_ddtrace-$php_api.dll ${tmp_folder_final_windows_trace}/ext/$php_api/php_ddtrace.dll; - cp ./extensions_windows_${architecture}/php_ddtrace-$php_api-zts.dll ${tmp_folder_final_windows_trace}/ext/$php_api/php_ddtrace-zts.dll; + ln ./extensions_windows_${architecture}/php_ddtrace-$php_api.dll ${tmp_folder_final_windows_trace}/ext/$php_api/php_ddtrace.dll; + ln ./extensions_windows_${architecture}/php_ddtrace-$php_api-zts.dll ${tmp_folder_final_windows_trace}/ext/$php_api/php_ddtrace-zts.dll; fi else - cp ./extensions_${architecture}/ddtrace-$php_api-debug-zts.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-debug-zts.so; + ln ./extensions_${architecture}/ddtrace-$php_api-debug-zts.so ${tmp_folder_final_gnu_trace}/ext/$php_api/ddtrace-debug-zts.so; fi done; cp -r ./src ${tmp_folder_final_gnu_trace}; @@ -66,46 +66,38 @@ for architecture in "${architectures[@]}"; do # Profiling ######################## if [[ -z ${DDTRACE_MAKE_PACKAGES_ASAN:-} ]]; then - tmp_folder_profiling=$tmp_folder/profiling - tmp_folder_profiling_archive=$tmp_folder_profiling/datadog-profiling.tar.gz - mkdir -p $tmp_folder_profiling - - cp -v datadog-profiling.tar.gz "$tmp_folder_profiling_archive" - - tar -xf $tmp_folder_profiling_archive -C $tmp_folder_profiling - # Extension php_apis=(20160303 20170718 20180731 20190902 20200930 20210902 20220829 20230831) for version in "${php_apis[@]}" do mkdir -v -p \ - $tmp_folder_final/$architecture-linux-gnu/dd-library-php/profiling/ext/$version \ - $tmp_folder_final/$architecture-linux-musl/dd-library-php/profiling/ext/$version - - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-unknown-linux-gnu/lib/php/$version/datadog-profiling.so \ - $tmp_folder_final/$architecture-linux-gnu/dd-library-php/profiling/ext/$version/datadog-profiling.so - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-unknown-linux-gnu/lib/php/$version/datadog-profiling-zts.so \ - $tmp_folder_final/$architecture-linux-gnu/dd-library-php/profiling/ext/$version/datadog-profiling-zts.so - - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-alpine-linux-musl/lib/php/$version/datadog-profiling.so \ - $tmp_folder_final/$architecture-linux-musl/dd-library-php/profiling/ext/$version/datadog-profiling.so - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-alpine-linux-musl/lib/php/$version/datadog-profiling-zts.so \ - $tmp_folder_final/$architecture-linux-musl/dd-library-php/profiling/ext/$version/datadog-profiling-zts.so + $tmp_folder_final_gnu/dd-library-php/profiling/ext/$version \ + $tmp_folder_final_musl/dd-library-php/profiling/ext/$version + + ln -v \ + ./datadog-profiling/$architecture-unknown-linux-gnu/lib/php/$version/datadog-profiling.so \ + $tmp_folder_final_gnu/dd-library-php/profiling/ext/$version/datadog-profiling.so + ln -v \ + ./datadog-profiling/$architecture-unknown-linux-gnu/lib/php/$version/datadog-profiling-zts.so \ + $tmp_folder_final_gnu/dd-library-php/profiling/ext/$version/datadog-profiling-zts.so + + ln -v \ + ./datadog-profiling/$architecture-alpine-linux-musl/lib/php/$version/datadog-profiling.so \ + $tmp_folder_final_musl/dd-library-php/profiling/ext/$version/datadog-profiling.so + ln -v \ + ./datadog-profiling/$architecture-alpine-linux-musl/lib/php/$version/datadog-profiling-zts.so \ + $tmp_folder_final_musl/dd-library-php/profiling/ext/$version/datadog-profiling-zts.so done # Licenses - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-unknown-linux-gnu/LICENSE* \ - $tmp_folder_profiling/datadog-profiling/$architecture-unknown-linux-gnu/NOTICE* \ + ln -v \ + ./profiling/LICENSE* \ + ./profiling/NOTICE \ $tmp_folder_final_gnu/dd-library-php/profiling/ - cp -v \ - $tmp_folder_profiling/datadog-profiling/$architecture-alpine-linux-musl/LICENSE* \ - $tmp_folder_profiling/datadog-profiling/$architecture-alpine-linux-musl/NOTICE* \ + ln -v \ + ./profiling/LICENSE* \ + ./profiling/NOTICE \ $tmp_folder_final_musl/dd-library-php/profiling/ fi diff --git a/tooling/bin/generate-ssi-package.sh b/tooling/bin/generate-ssi-package.sh index 29d2026063..3406e6596a 100755 --- a/tooling/bin/generate-ssi-package.sh +++ b/tooling/bin/generate-ssi-package.sh @@ -10,7 +10,7 @@ packages_build_dir=$2 # '+' char is not allowed release_version_sanitized=${release_version/+/-} -tmp_folder=/tmp/bundle +tmp_folder=/tmp/ssi-bundle tmp_folder_final=$tmp_folder/final architectures=(x86_64 aarch64) @@ -32,11 +32,11 @@ for architecture in "${architectures[@]}"; do ######################## # Loader ######################## - cp libddtrace_php_${architecture}.so ${gnu}/loader/libddtrace_php.so - cp libddtrace_php_${architecture}-alpine.so ${musl}/loader/libddtrace_php.so + ln libddtrace_php_${architecture}.so ${gnu}/loader/libddtrace_php.so + ln libddtrace_php_${architecture}-alpine.so ${musl}/loader/libddtrace_php.so - cp dd_library_loader-${architecture}-linux-gnu.so ${gnu}/loader/dd_library_loader.so - cp dd_library_loader-${architecture}-linux-musl.so ${musl}/loader/dd_library_loader.so + ln dd_library_loader-${architecture}-linux-gnu.so ${gnu}/loader/dd_library_loader.so + ln dd_library_loader-${architecture}-linux-musl.so ${musl}/loader/dd_library_loader.so echo 'zend_extension=${DD_LOADER_PACKAGE_PATH}/linux-gnu/loader/dd_library_loader.so' > ${gnu}/loader/dd_library_loader.ini echo 'zend_extension=${DD_LOADER_PACKAGE_PATH}/linux-musl/loader/dd_library_loader.so' > ${musl}/loader/dd_library_loader.ini @@ -49,14 +49,14 @@ for architecture in "${architectures[@]}"; do for php_api in "${php_apis[@]}"; do mkdir -p ${gnu}/trace/ext/$php_api ${musl}/trace/ext/$php_api # gnu - cp ./standalone_${architecture}/ddtrace-$php_api.so ${gnu}/trace/ext/$php_api/ddtrace.so - cp ./standalone_${architecture}/ddtrace-$php_api-zts.so ${gnu}/trace/ext/$php_api/ddtrace-zts.so - cp ./standalone_${architecture}/ddtrace-$php_api-debug.so ${gnu}/trace/ext/$php_api/ddtrace-debug.so + ln ./standalone_${architecture}/ddtrace-$php_api.so ${gnu}/trace/ext/$php_api/ddtrace.so + ln ./standalone_${architecture}/ddtrace-$php_api-zts.so ${gnu}/trace/ext/$php_api/ddtrace-zts.so + ln ./standalone_${architecture}/ddtrace-$php_api-debug.so ${gnu}/trace/ext/$php_api/ddtrace-debug.so # musl - cp ./standalone_${architecture}/ddtrace-$php_api-alpine.so ${musl}/trace/ext/$php_api/ddtrace.so + ln ./standalone_${architecture}/ddtrace-$php_api-alpine.so ${musl}/trace/ext/$php_api/ddtrace.so if [[ ${php_api} -ge 20151012 ]]; then # zts on alpine starting 7.0 - cp ./standalone_${architecture}/ddtrace-$php_api-alpine-zts.so ${musl}/trace/ext/$php_api/ddtrace-zts.so + ln ./standalone_${architecture}/ddtrace-$php_api-alpine-zts.so ${musl}/trace/ext/$php_api/ddtrace-zts.so fi done;