Skip to content

Commit cd4e9ba

Browse files
morrisonlevirealFlowControlcataphractbwoebi
authored
Bump Rust to 1.87, Clang/LLVM to 20 (#3926)
* build: update Rust MSRV to 1.87 * ci: add otel exporter for better diagnostics when things go wrong * ci: limit build parallelism * bump PHP versions and reduce image size * Start using bookworm-8 images in CI * docs: explain minimal rust install * ci(appsec): adopt bookworm-8 This is going to cause breakages with lints * ci: use versioned images for shared-ext too * ci(appsec): clang 17 to clang 20 * ci(appsec): bump Rust to 1.87 * bump PHP and Rust for Windows too * fix llvm version mismatch and fix cache key * ci: attempt to build Windows images in CI * ci: copy bits of windows_git_setup * ci: windows buildx didn't support --no-cache * ci: windows didn't even have buildx, way to bury the lede * ci: avoid docker compose for windows * appsec: backport fmt lib changes for libddwaf * ci: verify the compiler shell after install * ci: windows more verification in tool images * ci: rename windows build jobs * add missing docker arg * wip windows * upd appsec tag mappings; work around problem due to gradle upgrade * wip windows * try to fix vc14 * try to fix vc14 tmp folder * sleep for a bit before deleting installer to avoid it being locked still * simplify vc14 install * adjust vc14 configure args * oops, full was too much * revert base images, vc images were replaced * revert tool images down to just MSRV bump * patch PHP sdk script * drop vc14, PHP 7.0/7.1, and fix php-8.0.30.tar.gz hash * drop the user-agent, it's causing rejections * move bookworm next to 9 * appsec: bump spdlog's fmt lib too * style(appsec): format with clang-format 20 * fix(appsec): include order for nonnull * style(appsec): fix tidy lints, batch 1 * style(appsec): fix tidy lints, batch 2 * fix RemoteConfigTests in new image * fix TelemetryTests on new images * drop legacy buster image defintions * drop legacy centos 6 image defintions * Fix libdatadog fetch * ci: restore 7.0/7.1 build images (except for Win) * xfail Zend/tests/fibers/gh19983.phpt * ci: delete more PHP 7.0/7.1 Win support * docker-compose for windows --------- Co-authored-by: Florian Engelhardt <florian.engelhardt@datadoghq.com> Co-authored-by: Gustavo André dos Santos Lopes <gustavo.lopes@datadoghq.com> Co-authored-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent 095538e commit cd4e9ba

186 files changed

Lines changed: 893 additions & 4857 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/prof_asan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
CARGO_TARGET_DIR: /tmp/build-cargo
2222
RUST_TOOLCHAIN: nightly-2025-06-13
2323
container:
24-
image: datadog/dd-trace-ci:php-${{matrix.php-version}}_bookworm-7
24+
image: datadog/dd-trace-ci:php-${{matrix.php-version}}_bookworm-8
2525
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
2626
options: --user root
2727

@@ -54,10 +54,10 @@ jobs:
5454
set -eux
5555
switch-php ${{ matrix.php-build }}
5656
cd profiling
57-
export CC=clang-19
57+
export CC=clang-20
5858
export CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
5959
export LDFLAGS='-fsanitize=address -shared-libasan'
60-
export RUSTC_LINKER=lld-17
60+
export RUSTC_LINKER=lld-20
6161
triplet=$(uname -m)-unknown-linux-gnu
6262
RUSTFLAGS='-Zsanitizer=address' cargo +${RUST_TOOLCHAIN} build -Zbuild-std=std,panic_abort --target $triplet --profile profiler-release
6363
cp -v "$CARGO_TARGET_DIR/$triplet/profiler-release/libdatadog_php_profiling.so" "$(php-config --extension-dir)/datadog-profiling.so"

.github/workflows/prof_correctness.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ permissions:
1111
jobs:
1212
prof-correctness:
1313
runs-on: ubuntu-24.04
14+
env:
15+
LLVM_VERSION: "20"
1416
strategy:
1517
fail-fast: false
1618
matrix:
@@ -46,20 +48,34 @@ jobs:
4648
~/.cargo/registry/cache/
4749
~/.cargo/git/db/
4850
target/
49-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.php-version }}-${{ matrix.phpts }}
51+
key: ${{ runner.os }}-cargo-llvm-${{ env.LLVM_VERSION }}-${{ hashFiles('**/Cargo.lock', 'profiling/rust-toolchain.toml') }}-${{ matrix.php-version }}-${{ matrix.phpts }}
5052

5153
- name: Build profiler
5254
run: |
5355
codename="$(lsb_release -cs)"
5456
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
55-
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-19 main" | sudo tee /etc/apt/sources.list.d/llvm.list
57+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${LLVM_VERSION} main" | sudo tee /etc/apt/sources.list.d/llvm.list
5658
sudo apt-get update
57-
sudo apt-get install -y clang-19 lld-19
58-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
59-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
60-
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-19 100
59+
llvm18_packages="$(dpkg-query -W -f='${binary:Package}\n' \
60+
'*clang*18*' '*llvm*18*' '*lld*18*' '*libomp*18*' \
61+
'*libc++*18*' '*libc++abi*18*' '*mlir*18*' '*flang*18*' \
62+
'*bolt*18*' '*polly*18*' 2>/dev/null || true)"
63+
if [ -n "$llvm18_packages" ]; then
64+
sudo apt-get purge -y $llvm18_packages
65+
sudo apt-get autoremove -y
66+
fi
67+
sudo apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev libclang-${LLVM_VERSION}-dev libclang-rt-${LLVM_VERSION}-dev
68+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100
69+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100
70+
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${LLVM_VERSION} 100
71+
export CC=clang-${LLVM_VERSION}
72+
export CXX=clang++-${LLVM_VERSION}
73+
export LLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM_VERSION}
74+
export LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib
75+
export LD_LIBRARY_PATH="${LIBCLANG_PATH}:${LD_LIBRARY_PATH:-}"
6176
clang --version
6277
ld.lld --version
78+
"$LLVM_CONFIG_PATH" --version
6379
cd profiling
6480
version_number=$(awk -F' = ' '$1 == "channel" { gsub(/"/, "", $2); print $2 }' rust-toolchain.toml)
6581
curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal -y --default-toolchain "$version_number"
@@ -74,7 +90,7 @@ jobs:
7490
~/.cargo/registry/cache/
7591
~/.cargo/git/db/
7692
target/
77-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.php-version }}-${{ matrix.phpts }}
93+
key: ${{ runner.os }}-cargo-llvm-${{ env.LLVM_VERSION }}-${{ hashFiles('**/Cargo.lock', 'profiling/rust-toolchain.toml') }}-${{ matrix.php-version }}-${{ matrix.phpts }}
7894

7995
- name: Run no profile test
8096
run: |

.gitlab/build-profiler.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ if [ -d '/opt/rh/devtoolset-7' ] ; then
1010
set -eo pipefail
1111
fi
1212

13-
# With clang 20, bindgen fails on aarch64:
14-
# /usr/lib/llvm20/lib/clang/20/include/arm_vector_types.h:20:9: error: unknown type name '__mfp8'
15-
# /usr/lib/llvm20/lib/clang/20/include/arm_vector_types.h:93:24: error: Neon vector size must be 64 or 128 bits
16-
# /usr/lib/llvm20/lib/clang/20/include/arm_vector_types.h:94:24: error: Neon vector size must be 64 or 128 bits
17-
# /usr/lib/llvm20/lib/clang/20/include/arm_neon.h:6374:25: error: incompatible constant for this __builtin_neon function
18-
# etc.
19-
if [ -f /sbin/apk ] && [ $(uname -m) = "aarch64" ]; then
20-
ln -sf ../lib/llvm19/bin/clang /usr/bin/clang
21-
fi
22-
2313
# On CentOS 7 aarch64, clang's resource dir isn't on the default include path,
2414
# causing bindgen to fail with "stddef.h not found".
2515
if [ -d '/opt/rh/devtoolset-7' ] && [ "$(uname -m)" = "aarch64" ]; then

.gitlab/ci-images.yml

Lines changed: 108 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ CentOS:
1717
tags: ["arch:amd64"]
1818
timeout: 4h
1919
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:29.4.0-noble
20+
variables:
21+
DDCI_CONFIGURE_OTEL_EXPORTER: "true"
2022
parallel:
2123
matrix:
2224
- PHP_VERSION:
@@ -46,6 +48,8 @@ Alpine:
4648
tags: ["arch:amd64"]
4749
timeout: 4h
4850
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:29.4.0-noble
51+
variables:
52+
DDCI_CONFIGURE_OTEL_EXPORTER: "true"
4953
parallel:
5054
matrix:
5155
- PHP_VERSION:
@@ -75,10 +79,13 @@ Bookworm:
7579
tags: ["arch:amd64"]
7680
timeout: 4h
7781
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:29.4.0-noble
82+
variables:
83+
DDCI_CONFIGURE_OTEL_EXPORTER: "true"
7884
parallel:
7985
matrix:
8086
- PHP_VERSION:
8187
- base
88+
- PHP_VERSION:
8289
- php-8.5
8390
- php-8.4
8491
- php-8.3
@@ -92,38 +99,116 @@ Bookworm:
9299
- php-7.2
93100
- php-7.1
94101
- php-7.0
102+
MAKE_JOBS: ["2"]
95103
script:
96104
- cd dockerfiles/ci/bookworm
97105
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
98106
- docker buildx bake --no-cache --pull --push $PHP_VERSION
99107

100-
Buster:
108+
.windows_image_build:
101109
stage: ci-build
102110
rules:
103111
- when: manual
104112
allow_failure: true
105113
needs: []
106-
tags: ["arch:amd64"]
107-
timeout: 4h
108-
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:29.4.0-noble
114+
tags: ["windows-v2:2019"]
115+
timeout: 6h
116+
variables:
117+
DDCI_CONFIGURE_OTEL_EXPORTER: "true"
118+
GIT_STRATEGY: none
119+
script: |
120+
# Kill leftover containers; a previous run may still hold php_ddtrace.dll open.
121+
$containers = docker ps -aq 2>$null
122+
if ($containers) { docker rm -f $containers 2>$null }
123+
124+
# Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item cannot.
125+
Write-Host "Performing workspace cleanup..."
126+
$workspace = $PWD.Path
127+
Push-Location ..
128+
cmd /c "rd /s /q ""$workspace"""
129+
if (-not (Test-Path $workspace)) {
130+
New-Item -ItemType Directory -Path $workspace -Force | Out-Null
131+
}
132+
Pop-Location
133+
$remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue
134+
if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" }
135+
Write-Host "Cleanup complete."
136+
137+
# PS 5.1 ignores $PSNativeCommandUseErrorActionPreference; use $LASTEXITCODE checks instead.
138+
$ErrorActionPreference = 'Stop'
139+
140+
# Manual git clone with proper config.
141+
Write-Host "Cloning repository..."
142+
git config --global core.longpaths true
143+
git config --global core.symlinks true
144+
git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL .
145+
if ($LASTEXITCODE -ne 0) {
146+
Write-Host "ERROR: git clone failed. Remaining workspace contents:"
147+
Get-ChildItem -Force | Select-Object Name
148+
exit $LASTEXITCODE
149+
}
150+
git checkout $env:CI_COMMIT_SHA
151+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
152+
153+
# Initialize submodules.
154+
Write-Host "Initializing submodules..."
155+
git submodule update --init --recursive
156+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
157+
Write-Host "Git setup complete."
158+
159+
# Download docker-compose to the workspace.
160+
Write-Host "Downloading docker-compose..."
161+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
162+
$dockerCompose = "$PWD\docker-compose.exe"
163+
Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/v2.36.0/docker-compose-windows-x86_64.exe" -Destination $dockerCompose
164+
165+
cd dockerfiles\ci\windows
166+
167+
$env:DOCKER_CONFIG = Join-Path $env:CI_PROJECT_DIR ".docker"
168+
New-Item -ItemType Directory -Force -Path $env:DOCKER_CONFIG | Out-Null
169+
Set-Content -Encoding ascii -Path (Join-Path $env:DOCKER_CONFIG "config.json") -Value '{"auths":{}}'
170+
171+
$env:CI_REGISTRY_TOKEN | docker login -u "$env:CI_REGISTRY_USER" --password-stdin "$env:CI_REGISTRY"
172+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
173+
174+
docker version
175+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
176+
177+
& $dockerCompose version
178+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
179+
180+
foreach ($target in ($env:WINDOWS_IMAGE_TARGETS -split ' ')) {
181+
if ([string]::IsNullOrWhiteSpace($target)) { continue }
182+
183+
Write-Host "Building Windows CI image target $target..."
184+
& $dockerCompose build --pull --no-cache $target
185+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
186+
187+
Write-Host "Pushing Windows CI image target $target..."
188+
& $dockerCompose push $target
189+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
190+
}
191+
192+
"Windows 1: Tool Images":
193+
extends: .windows_image_build
109194
parallel:
110195
matrix:
111-
- PHP_VERSION:
112-
- base
113-
- php-8.5
114-
- php-8.4
115-
- php-8.3
116-
- php-8.2
117-
- php-8.1
118-
- php-8.0
119-
- php-8.0-shared-ext
120-
- php-7.4
121-
- php-7.4-shared-ext
122-
- php-7.3
123-
- php-7.2
124-
- php-7.1
125-
- php-7.0
126-
script:
127-
- cd dockerfiles/ci/buster
128-
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
129-
- docker buildx bake --no-cache --pull --push $PHP_VERSION
196+
- WINDOWS_IMAGE_TARGETS:
197+
- "vc15"
198+
- "vs16"
199+
- "vs17"
200+
201+
"Windows 2: PHP Images":
202+
extends: .windows_image_build
203+
parallel:
204+
matrix:
205+
- WINDOWS_IMAGE_TARGETS:
206+
- "php-8.5"
207+
- "php-8.4"
208+
- "php-8.3"
209+
- "php-8.2"
210+
- "php-8.1"
211+
- "php-8.0"
212+
- "php-7.4"
213+
- "php-7.3"
214+
- "php-7.2"

0 commit comments

Comments
 (0)