From ad30d104d6934c9a5b1310ccdcd7e287f5d24f1b Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 18 Apr 2024 15:11:36 -0700 Subject: [PATCH] Revert win2022 image back to latest and add msvc version mitigation (#5539) * Revert win2022 image back to latest * Workaround fix for MSVC SxS issue --- .vscode/cspell.json | 2 ++ .../templates/jobs/archetype-sdk-client.yml | 4 ++++ eng/pipelines/templates/jobs/ci.tests.yml | 2 ++ .../templates/jobs/cmake-generate.tests.yml | 2 ++ eng/pipelines/templates/jobs/live.tests.yml | 2 ++ .../templates/steps/install-cmake.yml | 17 +++++---------- eng/pipelines/templates/steps/setup-msvc.yml | 21 +++++++++++++++++++ eng/pipelines/templates/variables/image.yml | 2 +- 8 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 eng/pipelines/templates/steps/setup-msvc.yml diff --git a/.vscode/cspell.json b/.vscode/cspell.json index ff9a58b4c..7a28a0f90 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -65,6 +65,7 @@ "AMQPS", "amqpvalue", "AMQPVALUE", + "ATLMFC", "australiacentral", "australiaeast", "authcid", @@ -206,6 +207,7 @@ "Ragrs", "Ragzrs", "Reconnector", + "Redist", "rehydrated", "Reitz", "retriable", diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 8b50977a7..232a58522 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -200,6 +200,10 @@ jobs: workingDirectory: $(Agent.TempDirectory) displayName: Download and Install Doxygen + - template: /eng/pipelines/templates/steps/install-cmake.yml + + - template: /eng/pipelines/templates/steps/setup-msvc.yml + - template: /eng/pipelines/templates/steps/vcpkg.yml - template: /eng/pipelines/templates/steps/cmake-build.yml diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index d39e8cf00..198247784 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -111,6 +111,8 @@ jobs: - template: /eng/pipelines/templates/steps/fix-1es-image-apt-azure-sources.yml + - template: /eng/pipelines/templates/steps/setup-msvc.yml + - template: /eng/pipelines/templates/steps/install-cmake.yml - pwsh: sudo apt update && sudo apt install -y $(AptDependencies) diff --git a/eng/pipelines/templates/jobs/cmake-generate.tests.yml b/eng/pipelines/templates/jobs/cmake-generate.tests.yml index ac8b199b4..74a418139 100644 --- a/eng/pipelines/templates/jobs/cmake-generate.tests.yml +++ b/eng/pipelines/templates/jobs/cmake-generate.tests.yml @@ -77,6 +77,8 @@ jobs: - template: /eng/pipelines/templates/steps/fix-1es-image-apt-azure-sources.yml + - template: /eng/pipelines/templates/steps/setup-msvc.yml + - template: /eng/pipelines/templates/steps/install-cmake.yml - pwsh: sudo apt update && sudo apt install -y $(AptDependencies) diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index c54ea3aa4..2558c21a7 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -104,6 +104,8 @@ jobs: - template: /eng/pipelines/templates/steps/fix-1es-image-apt-azure-sources.yml + - template: /eng/pipelines/templates/steps/setup-msvc.yml + - template: /eng/pipelines/templates/steps/install-cmake.yml # Add g++5 repo to ubuntu diff --git a/eng/pipelines/templates/steps/install-cmake.yml b/eng/pipelines/templates/steps/install-cmake.yml index e102f4c71..c30e5ca78 100644 --- a/eng/pipelines/templates/steps/install-cmake.yml +++ b/eng/pipelines/templates/steps/install-cmake.yml @@ -1,3 +1,6 @@ +# This temporary fix resolves an issue with CMake and vcpkg. When Linux and +# Windows agents have a later version of CMake installed this can be removed. + parameters: Version: '3.29.2' @@ -9,21 +12,11 @@ steps: && sudo ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ && sudo rm cmakeinstall.sh displayName: Install Cmake ${{ parameters.Version }} (Linux) - condition: eq(variables['Agent.OS'], 'Linux') + condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - pwsh: | - $tempFile = New-TemporaryFile; - systeminfo.exe /fo csv > $tempFile - $osName = (Import-Csv $tempFile).'OS Name' - - Write-Host "OS Name: $osName" - if (!($osName -like '*2019*')) { - Write-Host "OS is not Windows Server 2019, skipping CMake installation" - exit 0 - } - Write-Host "Installing CMake ${{ parameters.Version }}" Invoke-WebRequest -Uri https://github.com/Kitware/CMake/releases/download/v${{ parameters.Version }}/cmake-${{ parameters.Version }}-windows-x86_64.msi -OutFile cmake.msi msiexec.exe /i cmake.msi | Wait-Process displayName: Install Cmake ${{ parameters.Version }} (Windows) - condition: eq(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) diff --git a/eng/pipelines/templates/steps/setup-msvc.yml b/eng/pipelines/templates/steps/setup-msvc.yml new file mode 100644 index 000000000..3a94c1ca5 --- /dev/null +++ b/eng/pipelines/templates/steps/setup-msvc.yml @@ -0,0 +1,21 @@ +# This temporary fix resolves an issue on Win2022 machines that have multiple +# MSVC versions installed side-by-side. When this issue is resolved, remove this +# template and references: +# https://github.com/actions/runner-images/issues/9701 + +steps: + - pwsh: | + $tempFile = New-TemporaryFile; + systeminfo.exe /fo csv > $tempFile + $osName = (Import-Csv $tempFile).'OS Name' + + Write-Host "OS Name: $osName" + if (!($osName -like '*2022*')) { + Write-Host "OS is not Windows Server 2022, skipping MSVC changes" + exit 0 + } + + Remove-item 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\Microsoft.VCToolsVersion.v143.default.*' -Force + Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\' -Name | Write-Host + displayName: Setup MSVC + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) diff --git a/eng/pipelines/templates/variables/image.yml b/eng/pipelines/templates/variables/image.yml index 79d1f392c..cef2b9dfc 100644 --- a/eng/pipelines/templates/variables/image.yml +++ b/eng/pipelines/templates/variables/image.yml @@ -17,7 +17,7 @@ variables: - name: LINUXNEXTVMIMAGE value: azsdk-pool-mms-ubuntu-2204-1espt - name: WINDOWSVMIMAGE - value: 1espt-win-2022-cpp-rollback + value: azsdk-pool-mms-win-2022-1espt - name: WINDOWSPREVIOUSVMIMAGE value: azsdk-pool-mms-win-2019-1espt - name: MACVMIMAGE