ci/vs2019: Split install of vs2019 and choco into separate Docker image
authorYonggang Luo <luoyonggang@gmail.com>
Fri, 10 Jun 2022 09:32:13 +0000 (17:32 +0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 14 Jun 2022 21:14:34 +0000 (21:14 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16934>

.gitlab-ci/container/gitlab-ci.yml
.gitlab-ci/image-tags.yml
.gitlab-ci/windows/Dockerfile_build
.gitlab-ci/windows/Dockerfile_vs [new file with mode: 0644]

index d1b1f07..8257aa1 100644 (file)
@@ -366,16 +366,36 @@ debian/arm_test:
   script:
     - .\.gitlab-ci\windows\mesa_container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $MESA_IMAGE $MESA_UPSTREAM_IMAGE ${DOCKERFILE} ${MESA_BASE_IMAGE}
 
+windows_vs2019:
+  inherit:
+    default: false
+  extends:
+    - .windows_container_build
+  variables:
+    MESA_IMAGE_PATH: &windows_vs_image_path ${WINDOWS_X64_VS_PATH}
+    MESA_IMAGE_TAG: &windows_vs_image_tag ${WINDOWS_X64_VS_TAG}
+    DOCKERFILE: Dockerfile_vs
+    MESA_BASE_IMAGE: "mcr.microsoft.com/windows/server:ltsc2022"
+
 windows_build_vs2019:
   inherit:
     default: false
   extends:
     - .windows_container_build
+  rules:
+    - if: '$MICROSOFT_FARM == "offline"'
+      when: never
+    - !reference [.ci-run-policy, rules]
   variables:
     MESA_IMAGE_PATH: &windows_build_image_path ${WINDOWS_X64_BUILD_PATH}
     MESA_IMAGE_TAG: &windows_build_image_tag ${WINDOWS_X64_BUILD_TAG}
     DOCKERFILE: Dockerfile_build
+    MESA_BASE_IMAGE_PATH: *windows_vs_image_path
+    MESA_BASE_IMAGE_TAG: *windows_vs_image_tag
+    MESA_BASE_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_BASE_IMAGE_PATH}:${MESA_BASE_IMAGE_TAG}"
   timeout: 2h 30m # LLVM takes ages
+  needs:
+    - windows_vs2019
 
 windows_test_vs2019:
   inherit:
@@ -391,11 +411,11 @@ windows_test_vs2019:
     MESA_IMAGE_TAG: &windows_test_image_tag ${WINDOWS_X64_BUILD_TAG}--${WINDOWS_X64_TEST_TAG}
     DOCKERFILE: Dockerfile_test
     # Right now this only needs the VS install to get DXIL.dll. Maybe see about decoupling this at some point
-    MESA_BASE_IMAGE_PATH: *windows_build_image_path
-    MESA_BASE_IMAGE_TAG: *windows_build_image_tag
+    MESA_BASE_IMAGE_PATH: *windows_vs_image_path
+    MESA_BASE_IMAGE_TAG: *windows_vs_image_tag
     MESA_BASE_IMAGE: "$CI_REGISTRY_IMAGE/${MESA_BASE_IMAGE_PATH}:${MESA_BASE_IMAGE_TAG}"
   needs:
-    - windows_build_vs2019
+    - windows_vs2019
 
 .use-windows_build_vs2019:
   inherit:
index e1f963b..94a20f9 100644 (file)
@@ -14,8 +14,11 @@ variables:
    FEDORA_X86_BUILD_TAG: "2022-04-24-spirv-tools-5"
    KERNEL_ROOTFS_TAG: "2022-06-09-piglit-update"
 
+   WINDOWS_X64_VS_PATH: "windows/x64_vs"
+   WINDOWS_X64_VS_TAG: "2022-06-10-vs"
+
    WINDOWS_X64_BUILD_PATH: "windows/x64_build"
-   WINDOWS_X64_BUILD_TAG: "2022-27-05-server_2022"
+   WINDOWS_X64_BUILD_TAG: "2022-06-10-vs"
 
    WINDOWS_X64_TEST_PATH: "windows/x64_test"
-   WINDOWS_X64_TEST_TAG: "2022-07-06-server_2022"
+   WINDOWS_X64_TEST_TAG: "2022-06-10-vs"
index 23e3ba1..3772c16 100644 (file)
@@ -1,21 +1,11 @@
 # escape=`
 
-FROM mcr.microsoft.com/windows/server:ltsc2022
+ARG base_image
+FROM ${base_image}
 
-# https://www.thomasmaurer.ch/2019/07/how-to-install-and-update-powershell-7/
-# Wrapping the following command in cmd.exe
-# iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
-RUN powershell -ExecutionPolicy RemoteSigned -Command "$ErrorActionPreference = 'Stop'; iex ""& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"""
-
-# Make sure any failure in PowerShell scripts is fatal
-SHELL ["pwsh", "-ExecutionPolicy", "RemoteSigned", "-Command", "$ErrorActionPreference = 'Stop';"]
-
-COPY mesa_deps_vs2019.ps1 C:\
-RUN C:\mesa_deps_vs2019.ps1
-COPY mesa_vs_init.ps1 C:\
-
-ENV VULKAN_SDK_VERSION='1.3.211.0'
-COPY mesa_deps_choco.ps1 C:\
-RUN C:\mesa_deps_choco.ps1
 COPY mesa_deps_build.ps1 C:\
 RUN C:\mesa_deps_build.ps1
+
+# When building, `--isolation=process` can leverage all cores and memory
+# docker build --isolation=process -f .\Dockerfile_build -t mesa_dep --build-arg base_image=mesa_vs .
+
diff --git a/.gitlab-ci/windows/Dockerfile_vs b/.gitlab-ci/windows/Dockerfile_vs
new file mode 100644 (file)
index 0000000..95c4563
--- /dev/null
@@ -0,0 +1,29 @@
+# escape=`
+
+ARG base_image
+FROM ${base_image}
+
+# https://www.thomasmaurer.ch/2019/07/how-to-install-and-update-powershell-7/
+# Wrapping the following command in cmd.exe
+# iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
+RUN powershell -ExecutionPolicy RemoteSigned -Command "$ErrorActionPreference = 'Stop'; iex ""& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"""
+
+# Make sure any failure in PowerShell scripts is fatal
+SHELL ["pwsh", "-ExecutionPolicy", "RemoteSigned", "-Command", "$ErrorActionPreference = 'Stop';"]
+RUN Write-Output $PSVersionTable $ErrorActionPreference
+
+COPY mesa_deps_vs2019.ps1 C:\
+RUN C:\mesa_deps_vs2019.ps1
+COPY mesa_vs_init.ps1 C:\
+
+ENV VULKAN_SDK_VERSION='1.3.211.0'
+COPY mesa_deps_choco.ps1 C:\
+RUN C:\mesa_deps_choco.ps1
+
+# Example usage:
+# `base_image` should use windows image that can be run with `--isolation=process` option,
+# since the resulting container will want to be used that way be later containers in the build process.
+# Only --isolation=hyperv can succeed building this container locally,
+#   --isolation=process have network issue when installing Visual Studio and choco will crash
+# docker build --isolation=hyperv -f .\Dockerfile_vs -t mesa_vs --build-arg base_image="mcr.microsoft.com/windows:10.0.19041.1415" .
+