Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .gitlab/windows/build/lint/windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.lint_windows_base:
stage: lint
needs: ["go_deps", "go_tools_deps"]
extends: .windows_docker_default
extends: [.windows_docker_default, .bazel:defs:cache:windows]
script:
- $ErrorActionPreference = "Stop"
- !reference [.sanitize_goproxy_windows]
Expand All @@ -11,11 +11,9 @@
# Windows jobs are using either 8Gb or 16Gb of memory so we can limit memory to 16Gb on this job because even if we decided to limit to 10Gb for instance,
# it would leave 6Gb free but we could not fit another job with these 6Gb remaining.
- >
docker run --rm
.\tools\ci\docker-run-with-bazel-cache.ps1
-m 24576M
--storage-opt "size=50GB"
-v "$(Get-Location):c:\mnt"
-e CI
-e GITLAB_CI
-e DDA_FEATURE_FLAGS_CI_SSM_KEY_WINDOWS="${DDA_FEATURE_FLAGS_CI_SSM_KEY_WINDOWS}"
-e AWS_NETWORKING=true
Expand Down
5 changes: 2 additions & 3 deletions .gitlab/windows/test/integration_test/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- !reference [.except_mergequeue]
- when: on_success
needs: ["go_deps", "go_tools_deps"]
extends: .windows_docker_default
extends: [.windows_docker_default, .bazel:defs:cache:windows]
before_script:
- $tmpfile = [System.IO.Path]::GetTempFileName()
- (& "$CI_PROJECT_DIR\tools\ci\fetch_secret.ps1" -parameterName "$Env:VCPKG_BLOB_SAS_URL" -parameterField url -tempFile "$tmpfile")
Expand All @@ -18,10 +18,9 @@
# we pass in CI_JOB_URL and CI_JOB_NAME so that they can be added to additional tags
# inside JUNIT_TAR and then later used by datadog-ci
- >
docker run --rm
.\tools\ci\docker-run-with-bazel-cache.ps1
-m 16384M
-v "$(Get-Location):c:\mnt"
-e CI
-e GITLAB_CI
-e DDA_FEATURE_FLAGS_CI_SSM_KEY_WINDOWS="${DDA_FEATURE_FLAGS_CI_SSM_KEY_WINDOWS}"
-e CI_JOB_URL
Expand Down
18 changes: 10 additions & 8 deletions tools/bazel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ exit /b 2
:: Ensure `XDG_CACHE_HOME` denotes a directory
if not defined DOTNET_RUNNING_IN_CONTAINER >nul 2>&1 sc query CExecSvc && set DOTNET_RUNNING_IN_CONTAINER=1
if not exist "%XDG_CACHE_HOME%" (
if defined CI (
>&2 echo 🔴 XDG_CACHE_HOME ^(!XDG_CACHE_HOME!^) must denote a directory in CI!
exit /b 2
)
if defined CI goto :error_xdg_cache_home_must_exist
if defined DOTNET_RUNNING_IN_CONTAINER (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are modifying this file, could you maybe drop this hint from batch script? Sharing caches between the host and a Windows container simply doesn't work, Bazel doesn't like junctions, apparently

@rdesgroppes rdesgroppes Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll do, but in a distinct PR to be reverted independently if need be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>&2 echo 💡 To persist caches across restarts, please set XDG_CACHE_HOME pointing to a mounted directory, e.g.:
>&2 echo docker.exe run --env=XDG_CACHE_HOME=C:\cache --volume="$HOME\.cache:C:\cache" ...
Expand All @@ -25,10 +22,7 @@ if not exist "%XDG_CACHE_HOME%" (
set "extra_args="
if defined XDG_CACHE_HOME (
set "XDG_CACHE_HOME=!XDG_CACHE_HOME:/=\!"
if "!XDG_CACHE_HOME:~1,2!" neq ":\" if "!XDG_CACHE_HOME:~0,2!" neq "\\" (
>&2 echo 🔴 XDG_CACHE_HOME ^(!XDG_CACHE_HOME!^) must denote an absolute path!
exit /b 2
)
if "!XDG_CACHE_HOME:~1,2!" neq ":\" if "!XDG_CACHE_HOME:~0,2!" neq "\\" goto :error_xdg_cache_home_must_be_absolute
set "GOCACHE=!XDG_CACHE_HOME!\go-build"
set "GOMODCACHE=!XDG_CACHE_HOME!\go\mod"
set "PIP_CACHE_DIR=!XDG_CACHE_HOME!\pip"
Expand Down Expand Up @@ -83,6 +77,14 @@ if defined args if defined extra_args call :insert_extra_args
"%BAZEL_REAL%" !startup_options! !args!
exit /b !errorlevel!

:error_xdg_cache_home_must_exist
>&2 echo 🔴 XDG_CACHE_HOME ^(!XDG_CACHE_HOME!^) must denote a directory in CI
exit /b 2

:error_xdg_cache_home_must_be_absolute
>&2 echo 🔴 XDG_CACHE_HOME ^(!XDG_CACHE_HOME!^) must denote an absolute path
exit /b 2

:: "--startup cmd ..." -> "--startup cmd --config=ci ..."
:insert_extra_args
set "startup_args="
Expand Down
Loading