From d86cf7730ee94190ae81b191ec1c27bd50d757f5 Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Tue, 18 Jun 2024 10:37:06 +0200
Subject: [PATCH] [scr] Made CI build dir names unique

---
 scripts/ci/extends/template-build-linux.yml | 2 +-
 scripts/ci/extends/template-build-win.yml   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/ci/extends/template-build-linux.yml b/scripts/ci/extends/template-build-linux.yml
index b6242a809a4..b1032fe2471 100644
--- a/scripts/ci/extends/template-build-linux.yml
+++ b/scripts/ci/extends/template-build-linux.yml
@@ -11,7 +11,7 @@
     - rm -rf $build_dir_full
     - mkdir -p $build_dir_full build
     - if [[ "$OSTYPE" == "darwin"* ]] ; then readlink_cmd=greadlink; else readlink_cmd=readlink; fi
-    - ln -s `$readlink_cmd -f $build_dir_full` build/${CMAKE_PRESET}
+    - ln -s `$readlink_cmd -f $build_dir_full` build/${CMAKE_PRESET}-${CI_JOB_NAME_SLUG}-${CI_JOB_ID}
     - ([[ $BUILD_CTEST_LARGE_ON_MASTER && "${CI_COMMIT_BRANCH}" == "master" ]]) && export BUILD_CTEST_LARGE=true
     - cmake --preset=$CMAKE_PRESET --log-level=VERBOSE -Wno-dev $CMAKE_ARGS
     # Activate .venv via .envrc
diff --git a/scripts/ci/extends/template-build-win.yml b/scripts/ci/extends/template-build-win.yml
index aca415906b3..e9d1fe363f8 100644
--- a/scripts/ci/extends/template-build-win.yml
+++ b/scripts/ci/extends/template-build-win.yml
@@ -8,12 +8,13 @@
   variables:
   script:
     - $build_directory_full = "..\build\" + $env:CMAKE_PRESET
+    - $artifacts_dir = "build\" + $env:CMAKE_PRESET + "-" + $env:CI_JOB_NAME_SLUG + "-" + $env:CI_JOB_ID
     - $log_file = $build_directory_full + "\make.txt"
     - (rm -r -fo $build_directory_full)
     - cmd /c if not exist $build_directory_full mkdir $build_directory_full
-    - mkdir build
+    - mkdir build  # We are inside the OGS source directory, now. This "build" dir will be, too.
     # Create symlink https://stackoverflow.com/a/34905638/80480
-    - cmd /c mklink /D build\$env:CMAKE_PRESET $env:CI_PROJECT_DIR\$build_directory_full
+    - cmd /c mklink /D $artifacts_dir $env:CI_PROJECT_DIR\$build_directory_full
     - $cmake_cmd = "cmake --preset=$env:CMAKE_PRESET --log-level=VERBOSE -Wno-dev $env:CMAKE_ARGS"
     - $cmake_cmd
     - Invoke-Expression $cmake_cmd
-- 
GitLab