Skip to content

Commit 91227e5

Browse files
Get extensions and packages versions to CI artifacts (#2553)
1 parent 882a3bd commit 91227e5

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

.circleci/continue_config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ commands:
512512
mkdir /tmp/bashenv
513513
sudo mkdir /rust
514514
sudo chmod 777 /rust
515+
mkdir /tmp/artifacts
516+
sudo chmod 777 /tmp/artifacts
515517
image=<< parameters.docker_image >>
516518
retries=$max_retries
517519
while
@@ -531,6 +533,7 @@ commands:
531533
-v $(pwd):/home/circleci/datadog \
532534
-v /tmp/bashenv:/home/circleci/bashenv \
533535
-v /rust:/rust \
536+
-v /tmp/artifacts:/tmp/artifacts \
534537
$(if [ -n "${CARGO_TARGET_DIR:-}" ]; then echo -v ${CARGO_TARGET_DIR}:${CARGO_TARGET_DIR} -e CARGO_TARGET_DIR=${CARGO_TARGET_DIR}; fi) \
535538
$image \
536539
bash -c 'echo Started; sleep 10000' 2>&1 | tee /tmp/docker.out &
@@ -1825,6 +1828,9 @@ jobs:
18251828
php_version: << parameters.switch_php_version >>
18261829
- install_extension:
18271830
lib_curl_command: << parameters.lib_curl_command >>
1831+
- run:
1832+
name: Install required packages
1833+
command: sudo apt update && sudo apt install -y jq
18281834
- <<: *STEP_COMPOSER_CACHE_RESTORE
18291835
- <<: *STEP_COMPOSER_UPDATE
18301836
- <<: *STEP_COMPOSER_TESTS_UPDATE

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,15 @@ TEST_WEB_83 := \
968968
FILTER := .
969969
MAX_RETRIES := 3
970970

971+
# Note: The "composer show" command below outputs a csv with pairs of dependency;version such as "phpunit/phpunit;9.6.17"
971972
define run_composer_with_retry
972973
for i in $$(seq 1 $(MAX_RETRIES)); do \
973974
echo "Attempting composer update (attempt $$i of $(MAX_RETRIES))..."; \
974975
$(COMPOSER) --working-dir=$1 update $2 && break || (echo "Retry $$i failed, waiting 5 seconds before next attempt..." && sleep 5); \
975-
done
976+
done \
977+
978+
mkdir -p /tmp/artifacts
979+
$(COMPOSER) --working-dir=$1 show -f json -D | grep -o '"name": "[^"]*\|"version": "[^"]*' | paste -d';' - - | sed 's/"name": //; s/"version": //' | tr -d '"' >> "/tmp/artifacts/web_versions.csv"
976980
endef
977981

978982
define run_tests_without_coverage

ext/integrations/integrations.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void dd_invoke_integration_loader_and_unhook_posthook(zend_ulong invocati
8080
success = zai_symbol_call_global((zai_str)ZAI_STRL("ddtrace\\integrations\\load_deferred_integration"), &rv, 1, &integration);
8181
}
8282

83-
if (UNEXPECTED(!success)) {
83+
if (UNEXPECTED(!success) && get_DD_TRACE_ENABLED()) {
8484
LOG(WARN,
8585
"Error loading deferred integration '%s' from DDTrace\\Integrations\\load_deferred_integration",
8686
Z_STRVAL(integration));

tests/Common/IntegrationTestCase.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,34 @@ abstract class IntegrationTestCase extends BaseTestCase
1919
public static function ddSetUpBeforeClass()
2020
{
2121
parent::ddSetUpBeforeClass();
22+
23+
$exts = get_loaded_extensions(false);
24+
$csv = '';
25+
foreach ($exts as $ext) {
26+
$csv = $csv . "ext/" . $ext . ";" . phpversion($ext) . "\n";
27+
}
28+
29+
$zendExts = get_loaded_extensions(true);
30+
foreach ($zendExts as $ext) {
31+
$csv = $csv . "ext/" . $ext . ";" . phpversion($ext) . "\n";
32+
}
33+
34+
$artifactsDir = "/tmp/artifacts";
35+
if ( !file_exists( $artifactsDir ) && !is_dir( $artifactsDir ) ) {
36+
mkdir($artifactsDir, 0777, true);
37+
}
38+
39+
file_put_contents($artifactsDir . "/extension_versions.csv", $csv);
40+
41+
$csv = '';
42+
$output = shell_exec('DD_TRACE_ENABLED=0 composer show -f json -D');
43+
$data = json_decode($output, true);
44+
45+
foreach ($data['installed'] as $package) {
46+
$csv = $csv . $package['name'] . ";" . $package['version'] . "\n";
47+
}
48+
49+
file_put_contents($artifactsDir . "/composer_versions.csv", $csv);
2250
}
2351

2452
public static function ddTearDownAfterClass()

0 commit comments

Comments
 (0)