From 9023c03ee855af430b7997541fefe836b6571e7e Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 16 Oct 2025 09:51:40 -0700 Subject: [PATCH] Use vcpkg supplied by eng/common (#6771) * Use vcpkg supplied by eng/common * / * Remove Set-VcpkgWriteModeCache.ps1 in favor of eng/common version * Use vcpkg versions from https://github.com/Azure/azure-sdk-for-cpp/pull/6756/files --- cmake-modules/AzureVcpkg.cmake | 2 +- .../templates/jobs/archetype-sdk-client.yml | 10 ++++- eng/pipelines/templates/jobs/ci.tests.yml | 10 ++++- .../templates/jobs/cmake-generate.tests.yml | 10 ++++- eng/pipelines/templates/jobs/live.tests.yml | 10 ++++- eng/pipelines/templates/steps/vcpkg.yml | 26 ----------- eng/scripts/Set-VcpkgWriteModeCache.ps1 | 44 ------------------- vcpkg.json | 2 +- 8 files changed, 38 insertions(+), 76 deletions(-) delete mode 100644 eng/pipelines/templates/steps/vcpkg.yml delete mode 100644 eng/scripts/Set-VcpkgWriteModeCache.ps1 diff --git a/cmake-modules/AzureVcpkg.cmake b/cmake-modules/AzureVcpkg.cmake index fa27fb906..901938f72 100644 --- a/cmake-modules/AzureVcpkg.cmake +++ b/cmake-modules/AzureVcpkg.cmake @@ -18,7 +18,7 @@ macro(az_vcpkg_integrate) message("AZURE_SDK_DISABLE_AUTO_VCPKG is not defined. Fetch a local copy of vcpkg.") # GET VCPKG FROM SOURCE # User can set env var AZURE_SDK_VCPKG_COMMIT to pick the VCPKG commit to fetch - set(VCPKG_COMMIT_STRING 120deac3062162151622ca4860575a33844ba10b) # default SDK tested commit + set(VCPKG_COMMIT_STRING 4334d8b4c8916018600212ab4dd4bbdc343065d1) # default SDK tested commit if(DEFINED ENV{AZURE_SDK_VCPKG_COMMIT}) message("AZURE_SDK_VCPKG_COMMIT is defined. Using that instead of the default.") set(VCPKG_COMMIT_STRING "$ENV{AZURE_SDK_VCPKG_COMMIT}") # default SDK tested commit diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 426cb3491..4254376c3 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -142,7 +142,15 @@ jobs: workingDirectory: $(Agent.TempDirectory) displayName: Download and Install Doxygen - - template: /eng/pipelines/templates/steps/vcpkg.yml + - template: /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml + + - script: vcpkg --version + condition: >- + and( + succeeded(), + not(eq(variables['Agent.OS'], 'Darwin')) + ) + displayName: vcpkg --version - template: /eng/pipelines/templates/steps/cmake-build.yml parameters: diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 779d7cc12..bf53972a4 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -135,7 +135,15 @@ jobs: ) displayName: Xcode version - - template: /eng/pipelines/templates/steps/vcpkg.yml + - template: /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml + + - script: vcpkg --version + condition: >- + and( + succeeded(), + not(eq(variables['Agent.OS'], 'Darwin')) + ) + displayName: vcpkg --version # Validate all the files are formatted correctly according to the # .clang-format file. This step runs on linux only and assumes that diff --git a/eng/pipelines/templates/jobs/cmake-generate.tests.yml b/eng/pipelines/templates/jobs/cmake-generate.tests.yml index 0fc4395b1..121af5fd6 100644 --- a/eng/pipelines/templates/jobs/cmake-generate.tests.yml +++ b/eng/pipelines/templates/jobs/cmake-generate.tests.yml @@ -87,7 +87,15 @@ jobs: condition: and(succeeded(), ne(variables['BrewDependencies'], '')) displayName: Install dependencies from brew - - template: /eng/pipelines/templates/steps/vcpkg.yml + - template: /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml + + - script: vcpkg --version + condition: >- + and( + succeeded(), + not(eq(variables['Agent.OS'], 'Darwin')) + ) + displayName: vcpkg --version - script: cmake --version displayName: cmake --version diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index 6cad6d4b2..ec63446b7 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -135,7 +135,15 @@ jobs: condition: and(succeededOrFailed(), ne(variables['AptDependencies'], '')) displayName: Install dependencies from apt - - template: /eng/pipelines/templates/steps/vcpkg.yml + - template: /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml + + - script: vcpkg --version + condition: >- + and( + succeeded(), + not(eq(variables['Agent.OS'], 'Darwin')) + ) + displayName: vcpkg --version - script: | dotnet tool install -g dotnet-reportgenerator-globaltool diff --git a/eng/pipelines/templates/steps/vcpkg.yml b/eng/pipelines/templates/steps/vcpkg.yml deleted file mode 100644 index ea3612f92..000000000 --- a/eng/pipelines/templates/steps/vcpkg.yml +++ /dev/null @@ -1,26 +0,0 @@ -steps: - - pwsh: | - Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,,read" - Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,,read" - displayName: Set Vcpkg Variables - - - script: vcpkg --version - condition: >- - and( - succeeded(), - not(eq(variables['Agent.OS'], 'Darwin')) - ) - displayName: vcpkg --version - - - ${{if eq(variables['System.TeamProject'], 'internal') }}: - - task: AzurePowerShell@5 - displayName: Set Vcpkg Write-mode Cache - inputs: - azureSubscription: 'Azure SDK Artifacts' - ScriptType: FilePath - ScriptPath: eng/scripts/Set-VcpkgWriteModeCache.ps1 - azurePowerShellVersion: LatestVersion - pwsh: true - # This step is idempotent and can be run multiple times in cases of - # failure and partial execution. - retryCountOnTaskFailure: 3 diff --git a/eng/scripts/Set-VcpkgWriteModeCache.ps1 b/eng/scripts/Set-VcpkgWriteModeCache.ps1 deleted file mode 100644 index bae52225c..000000000 --- a/eng/scripts/Set-VcpkgWriteModeCache.ps1 +++ /dev/null @@ -1,44 +0,0 @@ -param( - [string] $StorageAccountName = 'azuresdkartifacts', - [string] $StorageContainerName = 'public-vcpkg-container' -) - -."$PSScriptRoot/../common/scripts/Helpers/PSModule-Helpers.ps1" - -Write-Host "`$env:PSModulePath = $($env:PSModulePath)" - -# Work around double backslash -if ($IsWindows) { - $hostedAgentModulePath = $env:SystemDrive + "\\Modules" - $moduleSeperator = ";" -} else { - $hostedAgentModulePath = "/usr/share" - $moduleSeperator = ":" -} -$modulePaths = $env:PSModulePath -split $moduleSeperator -$modulePaths = $modulePaths.Where({ !$_.StartsWith($hostedAgentModulePath) }) -$AzModuleCachePath = (Get-ChildItem "$hostedAgentModulePath/az_*" -Attributes Directory) -join $moduleSeperator -if ($AzModuleCachePath -and $env.PSModulePath -notcontains $AzModuleCachePath) { - $modulePaths += $AzModuleCachePath -} - -$env:PSModulePath = $modulePaths -join $moduleSeperator - -Install-ModuleIfNotInstalled "Az.Storage" "4.3.0" | Import-Module - -$ctx = New-AzStorageContext ` - -StorageAccountName $StorageAccountName ` - -UseConnectedAccount - -$vcpkgBinarySourceSas = New-AzStorageContainerSASToken ` - -Name $StorageContainerName ` - -Permission "rwcl" ` - -Context $ctx ` - -ExpiryTime (Get-Date).AddHours(1) - -Write-Host "Ensure redaction of SAS tokens in logs" -Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas" - -Write-Host "Setting vcpkg binary cache to read and write" -Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite" -Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite" diff --git a/vcpkg.json b/vcpkg.json index 43465df6a..e315fc165 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "name": "azure-sdk-for-cpp", "version": "1.5.0", - "builtin-baseline": "120deac3062162151622ca4860575a33844ba10b", + "builtin-baseline": "4334d8b4c8916018600212ab4dd4bbdc343065d1", "dependencies": [ { "name": "curl"