Skip to content

Commit 3a4696d

Browse files
committed
test(CI): add manual cleanup in before_script step
Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 93d36b4 commit 3a4696d

2 files changed

Lines changed: 40 additions & 14 deletions

File tree

.gitlab/generate-package.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,19 +488,32 @@
488488
IMAGE: "<?= $image ?>"
489489
ABI_NO: "<?= $abi_no ?>"
490490
PHP_VERSION: "<?= $major_minor ?>"
491-
GIT_STRATEGY: clone
492-
GIT_CLEAN_FLAGS: -ffdx
493-
GIT_CONFIG_COUNT: 2
494-
GIT_CONFIG_KEY_0: core.longpaths
495-
GIT_CONFIG_VALUE_0: true
496-
GIT_CONFIG_KEY_1: core.symlinks
497-
GIT_CONFIG_VALUE_1: true
491+
GIT_STRATEGY: none
498492
CONTAINER_NAME: ${CI_JOB_NAME_SLUG}-${CI_JOB_ID}
499493
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+
500501
# Make sure we actually fail if a command fails
501502
$ErrorActionPreference = 'Stop'
502503
$PSNativeCommandUseErrorActionPreference = $true
503504

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+
504517
mkdir extensions_x86_64
505518
mkdir extensions_x86_64_debugsymbols
506519

.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)

0 commit comments

Comments
 (0)