From 1c18dd111918f5d52493e41628c74671444a03fd Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Fri, 6 Mar 2026 17:06:14 +0100 Subject: [PATCH 1/6] ci: fix Windows workspace cleanup and fail-fast for git operations The cmd.exe "for /d" loop used to clean the workspace skips directory entries during deletion (enumerates and deletes in the same pass), leaving artifact output dirs from previous runs. When git clone then fails because the workspace isn't empty, $PSNativeCommandUseErrorActionPreference = $true is silently ignored on Windows PowerShell 5.1 (requires PS 7.3+), so the script continues without source code and phpize.bat fails with exit 10. Fixes: - Replace cmd.exe cleanup loop with PowerShell-native Get-ChildItem | Remove-Item which handles each entry independently and tolerates locked files - Add WARNING log line if any items could not be removed (aids debugging) - Remove $PSNativeCommandUseErrorActionPreference (no-op on PS 5.1) - Add explicit $LASTEXITCODE checks after git clone, checkout, and submodule init Applied to both generate-package.php (compile extension windows) and generate-tracer.php (windows test_c). --- .gitlab/generate-package.php | 23 ++++++++++++++++------- .gitlab/generate-tracer.php | 23 ++++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index 63a6c1da76..a243005193 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -506,27 +506,36 @@ GIT_STRATEGY: none CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID} script: | - # Aggressive Git cleanup - Write-Host "Performing aggressive workspace cleanup with cmd.exe..." - cmd /c "if exist .git rmdir /s /q .git" 2>$null - cmd /c "for /d %d in (*) do @rmdir /s /q ""%d""" 2>$null - cmd /c "del /f /s /q *" 2>$null + # Reliable workspace cleanup using PowerShell native cmdlets. + # cmd.exe "for /d" loops skip entries during deletion (well-known Windows antipattern) — don't use them. + Write-Host "Performing workspace cleanup..." + Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue + $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue + if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." - # Make sure we actually fail if a command fails + # Fail fast on PowerShell cmdlet errors (works on PS 5.1+). $ErrorActionPreference = 'Stop' - $PSNativeCommandUseErrorActionPreference = $true + # Note: $PSNativeCommandUseErrorActionPreference requires PS 7.3+ and is silently ignored on PS 5.1 + # (Windows Server 2019 default). Use explicit $LASTEXITCODE checks for native commands instead. # Manual git clone with proper config Write-Host "Cloning repository..." git config --global core.longpaths true git config --global core.symlinks true git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL . + if ($LASTEXITCODE -ne 0) { + Write-Host "ERROR: git clone failed. Remaining workspace contents:" + Get-ChildItem -Force | Select-Object Name + exit $LASTEXITCODE + } git checkout $env:CI_COMMIT_SHA + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Initialize submodules Write-Host "Initializing submodules..." git submodule update --init --recursive + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Git setup complete." mkdir extensions_x86_64 diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index acefb64738..466348ca82 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -122,27 +122,36 @@ function before_script_steps($with_docker_auth = false) { GIT_STRATEGY: none IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows" script: | - # Agressive Git cleanup - Write-Host "Performing aggressive workspace cleanup with cmd.exe..." - cmd /c "if exist .git rmdir /s /q .git" 2>$null - cmd /c "for /d %d in (*) do @rmdir /s /q ""%d""" 2>$null - cmd /c "del /f /s /q *" 2>$null + # Reliable workspace cleanup using PowerShell native cmdlets. + # cmd.exe "for /d" loops skip entries during deletion (well-known Windows antipattern) — don't use them. + Write-Host "Performing workspace cleanup..." + Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue + $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue + if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." - # Make sure we actually fail if a command fails + # Fail fast on PowerShell cmdlet errors (works on PS 5.1+). $ErrorActionPreference = 'Stop' - $PSNativeCommandUseErrorActionPreference = $true + # Note: $PSNativeCommandUseErrorActionPreference requires PS 7.3+ and is silently ignored on PS 5.1 + # (Windows Server 2019 default). Use explicit $LASTEXITCODE checks for native commands instead. # Manual git clone with proper config Write-Host "Cloning repository..." git config --global core.longpaths true git config --global core.symlinks true git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL . + if ($LASTEXITCODE -ne 0) { + Write-Host "ERROR: git clone failed. Remaining workspace contents:" + Get-ChildItem -Force | Select-Object Name + exit $LASTEXITCODE + } git checkout $env:CI_COMMIT_SHA + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Initialize submodules Write-Host "Initializing submodules..." git submodule update --init --recursive + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Git setup complete." mkdir dumps From b7d680be21dbe65bb16e4d3c3225cbe023f2f351 Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Fri, 6 Mar 2026 17:17:58 +0100 Subject: [PATCH 2/6] ci: use cmd.exe rd to handle junction points during Windows workspace cleanup PowerShell 5.1's Remove-Item -Recurse throws "mismatch between the tag specified in the request and the tag present in the reparse point" when the workspace contains Windows junction points (created by switch-php, e.g. /php <<===>> /php-nts) or NTFS symlinks (from core.symlinks=true git clone). This caused the entire cleanup to fail silently, leaving the full previous repo tree in place and making git clone fail again. Fix: navigate to the parent directory and run cmd.exe "rd /s /q" on the whole workspace directory. cmd.exe rd removes junction entries without following them into their targets, avoiding the reparse point issue entirely. The directory is then recreated empty before returning. --- .gitlab/generate-package.php | 15 ++++++++++++--- .gitlab/generate-tracer.php | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index a243005193..a7e3464488 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -506,10 +506,19 @@ GIT_STRATEGY: none CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID} script: | - # Reliable workspace cleanup using PowerShell native cmdlets. - # cmd.exe "for /d" loops skip entries during deletion (well-known Windows antipattern) — don't use them. + # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole + # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the + # junction entry without following it into its target), unlike PowerShell's Remove-Item + # -Recurse which throws reparse point mismatch errors on PS 5.1 when the workspace + # contains junctions (e.g. created by switch-php) or NTFS symlinks (from core.symlinks clone). Write-Host "Performing workspace cleanup..." - Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue + $workspace = $PWD.Path + Push-Location .. + cmd /c "rd /s /q ""$workspace""" + if (-not (Test-Path $workspace)) { + New-Item -ItemType Directory -Path $workspace -Force | Out-Null + } + Pop-Location $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index 466348ca82..e6d63386a5 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -122,10 +122,19 @@ function before_script_steps($with_docker_auth = false) { GIT_STRATEGY: none IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows" script: | - # Reliable workspace cleanup using PowerShell native cmdlets. - # cmd.exe "for /d" loops skip entries during deletion (well-known Windows antipattern) — don't use them. + # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole + # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the + # junction entry without following it into its target), unlike PowerShell's Remove-Item + # -Recurse which throws reparse point mismatch errors on PS 5.1 when the workspace + # contains junctions (e.g. created by switch-php) or NTFS symlinks (from core.symlinks clone). Write-Host "Performing workspace cleanup..." - Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue + $workspace = $PWD.Path + Push-Location .. + cmd /c "rd /s /q ""$workspace""" + if (-not (Test-Path $workspace)) { + New-Item -ItemType Directory -Path $workspace -Force | Out-Null + } + Pop-Location $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." From 57a26639ced76f1f53a85deb73c15e04502dfa14 Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Wed, 11 Mar 2026 16:00:55 +0100 Subject: [PATCH 3/6] ci: kill leftover Docker containers before Windows workspace cleanup php_ddtrace.dll (and other workspace files) are locked with "Access is denied" when a Docker container from a previous job run is still alive with the workspace volume mounted. This causes rd /s /q to fail and git clone to fail again. Fix: force-remove all running containers (docker rm -f $(docker ps -aq)) before the rd /s /q workspace cleanup, releasing all file handles. --- .gitlab/generate-package.php | 6 ++++++ .gitlab/generate-tracer.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index a7e3464488..6794af2156 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -506,6 +506,12 @@ GIT_STRATEGY: none CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID} script: | + # Force-remove all running Docker containers before touching the workspace. + # A container from a previous job run may still be alive with the workspace volume mounted, + # holding an open handle on php_ddtrace.dll — which makes rd /s /q fail with "Access is denied". + $containers = docker ps -aq 2>$null + if ($containers) { docker rm -f $containers 2>$null } + # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the # junction entry without following it into its target), unlike PowerShell's Remove-Item diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index e6d63386a5..f4a4b03e07 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -122,6 +122,12 @@ function before_script_steps($with_docker_auth = false) { GIT_STRATEGY: none IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows" script: | + # Force-remove all running Docker containers before touching the workspace. + # A container from a previous job run may still be alive with the workspace volume mounted, + # holding an open handle on php_ddtrace.dll — which makes rd /s /q fail with "Access is denied". + $containers = docker ps -aq 2>$null + if ($containers) { docker rm -f $containers 2>$null } + # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the # junction entry without following it into its target), unlike PowerShell's Remove-Item From c28660863d3775830196a369a8914153b298c4a2 Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Thu, 12 Mar 2026 13:35:07 +0100 Subject: [PATCH 4/6] ci: trim verbose comments in Windows workspace cleanup scripts --- .gitlab/generate-package.php | 14 +++----------- .gitlab/generate-tracer.php | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index 6794af2156..206acd5848 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -506,17 +506,11 @@ GIT_STRATEGY: none CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID} script: | - # Force-remove all running Docker containers before touching the workspace. - # A container from a previous job run may still be alive with the workspace volume mounted, - # holding an open handle on php_ddtrace.dll — which makes rd /s /q fail with "Access is denied". + # Kill leftover containers — a previous run may still hold php_ddtrace.dll open. $containers = docker ps -aq 2>$null if ($containers) { docker rm -f $containers 2>$null } - # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole - # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the - # junction entry without following it into its target), unlike PowerShell's Remove-Item - # -Recurse which throws reparse point mismatch errors on PS 5.1 when the workspace - # contains junctions (e.g. created by switch-php) or NTFS symlinks (from core.symlinks clone). + # Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item can't. Write-Host "Performing workspace cleanup..." $workspace = $PWD.Path Push-Location .. @@ -529,10 +523,8 @@ if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." - # Fail fast on PowerShell cmdlet errors (works on PS 5.1+). + # Make sure we actually fail if a command fails $ErrorActionPreference = 'Stop' - # Note: $PSNativeCommandUseErrorActionPreference requires PS 7.3+ and is silently ignored on PS 5.1 - # (Windows Server 2019 default). Use explicit $LASTEXITCODE checks for native commands instead. # Manual git clone with proper config Write-Host "Cloning repository..." diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index f4a4b03e07..2f0065eaa8 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -122,17 +122,11 @@ function before_script_steps($with_docker_auth = false) { GIT_STRATEGY: none IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows" script: | - # Force-remove all running Docker containers before touching the workspace. - # A container from a previous job run may still be alive with the workspace volume mounted, - # holding an open handle on php_ddtrace.dll — which makes rd /s /q fail with "Access is denied". + # Kill leftover containers — a previous run may still hold php_ddtrace.dll open. $containers = docker ps -aq 2>$null if ($containers) { docker rm -f $containers 2>$null } - # Reliable workspace cleanup: navigate to parent and use cmd.exe "rd /s /q" on the whole - # workspace directory. cmd.exe rd correctly handles Windows junction points (removes the - # junction entry without following it into its target), unlike PowerShell's Remove-Item - # -Recurse which throws reparse point mismatch errors on PS 5.1 when the workspace - # contains junctions (e.g. created by switch-php) or NTFS symlinks (from core.symlinks clone). + # Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item can't. Write-Host "Performing workspace cleanup..." $workspace = $PWD.Path Push-Location .. @@ -145,10 +139,8 @@ function before_script_steps($with_docker_auth = false) { if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } Write-Host "Cleanup complete." - # Fail fast on PowerShell cmdlet errors (works on PS 5.1+). + # Make sure we actually fail if a command fails $ErrorActionPreference = 'Stop' - # Note: $PSNativeCommandUseErrorActionPreference requires PS 7.3+ and is silently ignored on PS 5.1 - # (Windows Server 2019 default). Use explicit $LASTEXITCODE checks for native commands instead. # Manual git clone with proper config Write-Host "Cloning repository..." From d8abbcf21ba7a9c5efef089559d8e2a23a098b0e Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Thu, 12 Mar 2026 16:02:33 +0100 Subject: [PATCH 5/6] ci: extract Windows workspace cleanup to shared function in generate-common.php --- .gitlab/generate-common.php | 43 ++++++++++++++++++++++++++++++++++++ .gitlab/generate-package.php | 39 +------------------------------- .gitlab/generate-tracer.php | 39 +------------------------------- 3 files changed, 45 insertions(+), 76 deletions(-) diff --git a/.gitlab/generate-common.php b/.gitlab/generate-common.php index 009673d1e9..6acaf10953 100644 --- a/.gitlab/generate-common.php +++ b/.gitlab/generate-common.php @@ -45,6 +45,49 @@ function dockerhub_login() { + # Kill leftover containers — a previous run may still hold php_ddtrace.dll open. + $containers = docker ps -aq 2>$null + if ($containers) { docker rm -f $containers 2>$null } + + # Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item can't. + Write-Host "Performing workspace cleanup..." + $workspace = $PWD.Path + Push-Location .. + cmd /c "rd /s /q ""$workspace""" + if (-not (Test-Path $workspace)) { + New-Item -ItemType Directory -Path $workspace -Force | Out-Null + } + Pop-Location + $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue + if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } + Write-Host "Cleanup complete." + + # PS 5.1 ignores $PSNativeCommandUseErrorActionPreference — use $LASTEXITCODE checks instead. + $ErrorActionPreference = 'Stop' + + # Manual git clone with proper config + Write-Host "Cloning repository..." + git config --global core.longpaths true + git config --global core.symlinks true + git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL . + if ($LASTEXITCODE -ne 0) { + Write-Host "ERROR: git clone failed. Remaining workspace contents:" + Get-ChildItem -Force | Select-Object Name + exit $LASTEXITCODE + } + git checkout $env:CI_COMMIT_SHA + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + # Initialize submodules + Write-Host "Initializing submodules..." + git submodule update --init --recursive + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Write-Host "Git setup complete." + default: retry: diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index 206acd5848..d62896e176 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -506,44 +506,7 @@ GIT_STRATEGY: none CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID} script: | - # Kill leftover containers — a previous run may still hold php_ddtrace.dll open. - $containers = docker ps -aq 2>$null - if ($containers) { docker rm -f $containers 2>$null } - - # Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item can't. - Write-Host "Performing workspace cleanup..." - $workspace = $PWD.Path - Push-Location .. - cmd /c "rd /s /q ""$workspace""" - if (-not (Test-Path $workspace)) { - New-Item -ItemType Directory -Path $workspace -Force | Out-Null - } - Pop-Location - $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue - if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } - Write-Host "Cleanup complete." - - # Make sure we actually fail if a command fails - $ErrorActionPreference = 'Stop' - - # Manual git clone with proper config - Write-Host "Cloning repository..." - git config --global core.longpaths true - git config --global core.symlinks true - git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL . - if ($LASTEXITCODE -ne 0) { - Write-Host "ERROR: git clone failed. Remaining workspace contents:" - Get-ChildItem -Force | Select-Object Name - exit $LASTEXITCODE - } - git checkout $env:CI_COMMIT_SHA - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Initialize submodules - Write-Host "Initializing submodules..." - git submodule update --init --recursive - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - Write-Host "Git setup complete." + mkdir extensions_x86_64 mkdir extensions_x86_64_debugsymbols diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index 2f0065eaa8..1969953aea 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -122,44 +122,7 @@ function before_script_steps($with_docker_auth = false) { GIT_STRATEGY: none IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows" script: | - # Kill leftover containers — a previous run may still hold php_ddtrace.dll open. - $containers = docker ps -aq 2>$null - if ($containers) { docker rm -f $containers 2>$null } - - # Use cmd.exe rd from the parent dir: handles junctions/symlinks that PS5.1 Remove-Item can't. - Write-Host "Performing workspace cleanup..." - $workspace = $PWD.Path - Push-Location .. - cmd /c "rd /s /q ""$workspace""" - if (-not (Test-Path $workspace)) { - New-Item -ItemType Directory -Path $workspace -Force | Out-Null - } - Pop-Location - $remaining = Get-ChildItem -Path . -Force -ErrorAction SilentlyContinue - if ($remaining) { Write-Host "WARNING: could not remove: $($remaining.Name -join ', ')" } - Write-Host "Cleanup complete." - - # Make sure we actually fail if a command fails - $ErrorActionPreference = 'Stop' - - # Manual git clone with proper config - Write-Host "Cloning repository..." - git config --global core.longpaths true - git config --global core.symlinks true - git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL . - if ($LASTEXITCODE -ne 0) { - Write-Host "ERROR: git clone failed. Remaining workspace contents:" - Get-ChildItem -Force | Select-Object Name - exit $LASTEXITCODE - } - git checkout $env:CI_COMMIT_SHA - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Initialize submodules - Write-Host "Initializing submodules..." - git submodule update --init --recursive - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - Write-Host "Git setup complete." + mkdir dumps From b0d2cdeb0a3e60e832e1f1105903f5d8c02c7107 Mon Sep 17 00:00:00 2001 From: Alexandre Rulleau Date: Thu, 12 Mar 2026 16:59:32 +0100 Subject: [PATCH 6/6] ci: fix verify windows job by preserving artifacts across workspace cleanup Applies the same GIT_STRATEGY: none + manual clone pattern to the verify windows job, saving/restoring the packages/ artifact around the workspace cleanup to avoid git checkout failures on locked/junction files. --- .gitlab/generate-common.php | 11 +++++++++++ .gitlab/generate-package.php | 13 +++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitlab/generate-common.php b/.gitlab/generate-common.php index 6acaf10953..24850a6293 100644 --- a/.gitlab/generate-common.php +++ b/.gitlab/generate-common.php @@ -88,6 +88,17 @@ function windows_git_setup() { + # Preserve artifact packages before workspace cleanup, then restore after clone. + Move-Item packages $env:TEMP\dd-artifacts-packages -Force -ErrorAction SilentlyContinue + + if (Test-Path "$env:TEMP\dd-artifacts-packages") { + Move-Item $env:TEMP\dd-artifacts-packages packages -Force + } + default: retry: diff --git a/.gitlab/generate-package.php b/.gitlab/generate-package.php index d62896e176..6fb5b1aaf8 100644 --- a/.gitlab/generate-package.php +++ b/.gitlab/generate-package.php @@ -1086,19 +1086,16 @@ stage: verify tags: [ "windows-v2:2019"] variables: - GIT_CONFIG_COUNT: 2 - GIT_CONFIG_KEY_0: core.longpaths - GIT_CONFIG_VALUE_0: true - GIT_CONFIG_KEY_1: core.symlinks - GIT_CONFIG_VALUE_1: true + GIT_STRATEGY: none needs: - job: "package extension windows" artifacts: true - job: datadog-setup.php artifacts: true - before_script: - - mkdir build - - move packages build + before_script: | + + mkdir build + move packages build script: - Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) # chocolatey install - .\dockerfiles\verify_packages\verify_windows.ps1