Skip to content

Commit 7f7b873

Browse files
authored
test(CI): manually handle git operation for windows jobs (#3634)
* test(CI): add aggressive git cleanup on windows runner Signed-off-by: Alexandre Rulleau <[email protected]> * test(CI): add manual cleanup in before_script step Signed-off-by: Alexandre Rulleau <[email protected]> --------- Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 5c4a19a commit 7f7b873

3 files changed

Lines changed: 41 additions & 13 deletions

File tree

.gitlab/generate-package.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,18 +488,32 @@
488488
IMAGE: "<?= $image ?>"
489489
ABI_NO: "<?= $abi_no ?>"
490490
PHP_VERSION: "<?= $major_minor ?>"
491-
GIT_STRATEGY: clone
492-
GIT_CONFIG_COUNT: 2
493-
GIT_CONFIG_KEY_0: core.longpaths
494-
GIT_CONFIG_VALUE_0: true
495-
GIT_CONFIG_KEY_1: core.symlinks
496-
GIT_CONFIG_VALUE_1: true
491+
GIT_STRATEGY: none
497492
CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID}
498493
script: |
494+
# Aggressive Git cleanup
495+
Write-Host "Performing aggressive workspace cleanup with cmd.exe..."
496+
cmd /c "if exist .git rmdir /s /q .git" 2>$null
497+
cmd /c "for /d %d in (*) do @rmdir /s /q ""%d""" 2>$null
498+
cmd /c "del /f /s /q *" 2>$null
499+
Write-Host "Cleanup complete."
500+
499501
# Make sure we actually fail if a command fails
500502
$ErrorActionPreference = 'Stop'
501503
$PSNativeCommandUseErrorActionPreference = $true
502504

505+
# Manual git clone with proper config
506+
Write-Host "Cloning repository..."
507+
git config --global core.longpaths true
508+
git config --global core.symlinks true
509+
git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL .
510+
git checkout $env:CI_COMMIT_SHA
511+
512+
# Initialize submodules
513+
Write-Host "Initializing submodules..."
514+
git submodule update --init --recursive
515+
Write-Host "Git setup complete."
516+
503517
mkdir extensions_x86_64
504518
mkdir extensions_x86_64_debugsymbols
505519

.gitlab/generate-tracer.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,33 @@ function before_script_steps($with_docker_auth = false) {
118118
- PHP_MAJOR_MINOR: <?= json_encode($windows_minor_major_targets) ?>
119119

120120
variables:
121-
GIT_CONFIG_COUNT: 2
122-
GIT_CONFIG_KEY_0: core.longpaths
123-
GIT_CONFIG_VALUE_0: true
124-
GIT_CONFIG_KEY_1: core.symlinks
125-
GIT_CONFIG_VALUE_1: true
126121
CONTAINER_NAME: $CI_JOB_NAME_SLUG
127-
GIT_STRATEGY: clone
128-
GIT_CLEAN_FLAGS: -ffdxq
122+
GIT_STRATEGY: none
129123
IMAGE: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_windows"
130124
script: |
125+
# Agressive Git cleanup
126+
Write-Host "Performing aggressive workspace cleanup with cmd.exe..."
127+
cmd /c "if exist .git rmdir /s /q .git" 2>$null
128+
cmd /c "for /d %d in (*) do @rmdir /s /q ""%d""" 2>$null
129+
cmd /c "del /f /s /q *" 2>$null
130+
Write-Host "Cleanup complete."
131+
131132
# Make sure we actually fail if a command fails
132133
$ErrorActionPreference = 'Stop'
133134
$PSNativeCommandUseErrorActionPreference = $true
134135

136+
# Manual git clone with proper config
137+
Write-Host "Cloning repository..."
138+
git config --global core.longpaths true
139+
git config --global core.symlinks true
140+
git clone --branch $env:CI_COMMIT_REF_NAME $env:CI_REPOSITORY_URL .
141+
git checkout $env:CI_COMMIT_SHA
142+
143+
# Initialize submodules
144+
Write-Host "Initializing submodules..."
145+
git submodule update --init --recursive
146+
Write-Host "Git setup complete."
147+
135148
mkdir dumps
136149

137150
$names = @('httpbin-integration','request-replayer', $env:CONTAINER_NAME)

dockerfiles/ci/xfail_tests/7.1.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ ext/simplexml/tests/bug72971_2.phpt
257257
ext/simplexml/tests/simplexml_load_file.phpt
258258
ext/soap/tests/bug71610.phpt
259259
ext/soap/tests/bugs/bug28751.phpt
260+
ext/soap/tests/bugs/bug76348.phpt
260261
ext/sockets/tests/socket_connect_params.phpt
261262
ext/sockets/tests/socket_create_listen-nobind.phpt
262263
ext/sockets/tests/socket_create_pair.phpt

0 commit comments

Comments
 (0)