From 7cbec739716f3d2fe7d5228b799342f9276b42da Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Wed, 26 Feb 2025 21:17:00 -0500
Subject: [PATCH] GitLab CI: do not checkout own copy of vcpkg, use the one
 that comes with the builder image

---
 .gitlab/ci/jobs/windows-x64.yml | 32 ++------------------------------
 .gitlab/ci/jobs/windows-x86.yml | 32 ++------------------------------
 2 files changed, 4 insertions(+), 60 deletions(-)

diff --git a/.gitlab/ci/jobs/windows-x64.yml b/.gitlab/ci/jobs/windows-x64.yml
index 73791e82a2..36f12e308d 100644
--- a/.gitlab/ci/jobs/windows-x64.yml
+++ b/.gitlab/ci/jobs/windows-x64.yml
@@ -21,11 +21,6 @@ Windows x64:
         - build/apt-cache
       unprotect: true
 
-    - key: vcpkg-root
-      paths:
-        - build/vcpkg-root
-      unprotect: true
-
     - key: vcpkg-binary-cache-x64-mingw-static
       paths:
         - build/vcpkg-binary-cache
@@ -46,20 +41,9 @@ Windows x64:
   script:
     - |
         # vcpkg
-        echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
-
-        if [ -d "build/vcpkg-root" ]; then
-          pushd build/vcpkg-root
-          git fetch https://github.com/Microsoft/vcpkg master
-          git reset --hard FETCH_HEAD
-          popd
-        else
-          mkdir -p build
-          git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
-        fi
+        echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KSetting vcpkg cache"
 
-        export VCPKG_ROOT=$(pwd)/build/vcpkg-root
-        export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
+        export VCPKG_DEFAULT_BINARY_CACHE="$(pwd)/build/vcpkg-binary-cache"
 
         mkdir -p "build/vcpkg-binary-cache"
 
@@ -106,18 +90,6 @@ Windows x64:
           # apt_clean
           echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
 
-    - - |
-          # vcpkg_clean
-          echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
-
-          if [ -d "build/vcpkg-root" ]; then
-            pushd "build/vcpkg-root"
-            git clean -f
-            popd
-          fi
-
-          echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
-
     - - |
           # ccache_stats
           echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
diff --git a/.gitlab/ci/jobs/windows-x86.yml b/.gitlab/ci/jobs/windows-x86.yml
index 9a33364b28..7a298731d1 100644
--- a/.gitlab/ci/jobs/windows-x86.yml
+++ b/.gitlab/ci/jobs/windows-x86.yml
@@ -17,11 +17,6 @@ Windows x86:
         - build/apt-cache
       unprotect: true
 
-    - key: vcpkg-root
-      paths:
-        - build/vcpkg-root
-      unprotect: true
-
     - key: vcpkg-binary-cache-x86-mingw-static
       paths:
         - build/vcpkg-binary-cache
@@ -42,20 +37,9 @@ Windows x86:
   script:
     - |
         # vcpkg
-        echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg"
-
-        if [ -d "build/vcpkg-root" ]; then
-          pushd build/vcpkg-root
-          git fetch https://github.com/Microsoft/vcpkg master
-          git reset --hard FETCH_HEAD
-          popd
-        else
-          mkdir -p build
-          git clone https://github.com/Microsoft/vcpkg build/vcpkg-root
-        fi
+        echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KSetting vcpkg cache"
 
-        export VCPKG_ROOT=$(pwd)/build/vcpkg-root
-        export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite"
+        export VCPKG_DEFAULT_BINARY_CACHE="$(pwd)/build/vcpkg-binary-cache"
 
         mkdir -p "build/vcpkg-binary-cache"
 
@@ -102,18 +86,6 @@ Windows x86:
           # apt_clean
           echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
 
-    - - |
-          # vcpkg_clean
-          echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root"
-
-          if [ -d "build/vcpkg-root" ]; then
-            pushd "build/vcpkg-root"
-            git clean -f
-            popd
-          fi
-
-          echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K"
-
     - - |
           # ccache_stats
           echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
-- 
GitLab