[release/v7.5] Remove UseDotnet task and use the dotnet-install script (#26169)

This commit is contained in:
PowerShell Team Bot
2025-10-09 13:54:31 -07:00
committed by GitHub
parent 0a40434148
commit bf11519f6f
13 changed files with 57 additions and 73 deletions
@@ -27,6 +27,9 @@ parameters: # parameters are shown up in ADO UI in a build queue time
- name: OfficialBuild
type: boolean
default: false
- name: disableNetworkIsolation
type: boolean
default: false
name: pkgs-$(BUILD.SOURCEBRANCHNAME)-prod.${{ parameters.OfficialBuild }}-$(Build.BuildId)
@@ -66,6 +69,8 @@ variables:
- group: MSIXSigningProfile
- name: templateFile
value: ${{ iif ( parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@onebranchTemplates' ) }}
- name: disableNetworkIsolation
value: ${{ parameters.disableNetworkIsolation }}
resources:
pipelines:
@@ -96,6 +101,7 @@ extends:
Network: KS3
linuxEsrpSigning: true
incrementalSDLBinaryAnalysis: true
disableNetworkIsolation: ${{ variables.disableNetworkIsolation }}
globalSdl:
disableLegacyManifest: true
# disabled Armorty as we dont have any ARM templates to scan. It fails on some sample ARM templates.
+19
View File
@@ -0,0 +1,19 @@
steps:
- pwsh: |
if (-not (Test-Path '$(RepoRoot)')) {
$psRoot = '$(Build.SourcesDirectory)/PowerShell'
Set-Location $psRoot -Verbose
}
$version = Get-Content ./global.json | ConvertFrom-Json | Select-Object -ExpandProperty sdk | Select-Object -ExpandProperty version
Write-Verbose -Verbose "Installing .NET SDK with version $version"
Import-Module ./build.psm1 -Force
Install-Dotnet -Version $version -Verbose
displayName: 'Install dotnet SDK'
workingDirectory: $(RepoRoot)
env:
ob_restore_phase: true
+3 -1
View File
@@ -87,6 +87,8 @@ jobs:
env:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$packageType = '$(PackageType)'
Write-Verbose -Verbose "packageType = $packageType"
@@ -103,7 +105,7 @@ jobs:
Import-Module "$repoRoot/build.psm1"
Import-Module "$repoRoot/tools/packaging"
Start-PSBootstrap -Scenario Package
Start-PSBootstrap -Scenario Both
$psOptionsPath = "$(Pipeline.Workspace)/CoOrdinatedBuildPipeline/${unsignedDrop}/psoptions/psoptions.json"
+1 -6
View File
@@ -62,12 +62,7 @@ jobs:
AnalyzeInPipeline: true
Language: csharp
- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(PowerShellRoot)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$runtime = $env:RUNTIME
+2 -6
View File
@@ -39,12 +39,8 @@ jobs:
sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell"
displayName: 'Create $(Agent.TempDirectory)/PowerShell'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(PowerShellRoot)
## We cross compile for arm64, so the arch is always x64
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
Import-Module $(PowerShellRoot)/build.psm1 -Force
+1 -9
View File
@@ -94,15 +94,7 @@ jobs:
parameters:
repoRoot: $(PowerShellRoot)
- task: NuGetToolInstaller@1
displayName: 'Install NuGet.exe'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: '$(PowerShellRoot)'
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
Set-Location -Path '$(PowerShellRoot)'
@@ -61,12 +61,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/$artifactName" -Recurse
displayName: 'Capture Downloaded Artifacts'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$artifactName = '$(artifactName)'
@@ -38,12 +38,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
displayName: 'Capture Downloaded Artifacts'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(REPOROOT)
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
@@ -46,12 +46,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
displayName: 'Capture Downloaded Artifacts'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(REPOROOT)
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$repoRoot = "$(Build.SourcesDirectory)"
+11 -17
View File
@@ -25,19 +25,16 @@ jobs:
env:
ob_restore_phase: true
- template: /.pipelines/templates/SetVersionVariables.yml@self
parameters:
ReleaseTagVar: $(ReleaseTagVar)
- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
parameters:
repoRoot: $(Build.SourcesDirectory)/PowerShell
repoRoot: $(RepoRoot)
ob_restore_phase: true
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force
@@ -93,19 +90,16 @@ jobs:
env:
ob_restore_phase: true
- template: /.pipelines/templates/SetVersionVariables.yml@self
parameters:
ReleaseTagVar: $(ReleaseTagVar)
- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
parameters:
repoRoot: $(Build.SourcesDirectory)/PowerShell
ob_restore_phase: true
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force
@@ -63,12 +63,7 @@ jobs:
AnalyzeInPipeline: true
Language: csharp
- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(PowerShellRoot)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$runtime = switch ($env:Architecture)
@@ -142,6 +137,7 @@ jobs:
}
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
Find-Dotnet
## Build global tool
Write-Verbose -Message "Building PowerShell global tool for Windows.x64" -Verbose
@@ -237,6 +233,9 @@ jobs:
After that, we repack using Compress-Archive and rename it back to a nupkg.
#>
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
Find-Dotnet
$packagingStrings = Import-PowerShellDataFile "$(PowerShellRoot)\tools\packaging\packaging.strings.psd1"
$outputPath = Join-Path '$(ob_outputDirectory)' 'globaltool'
@@ -78,12 +78,7 @@ jobs:
env:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(REPOROOT)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self
- pwsh: |
$msixUrl = '$(makeappUrl)'
@@ -112,7 +107,9 @@ jobs:
Import-Module "$repoRoot\build.psm1"
Import-Module "$repoRoot\tools\packaging"
Start-PSBootstrap -Scenario Package
Start-PSBootstrap -Scenario Both
Find-Dotnet
$signedFilesPath, $psoptionsFilePath = if ($env:RUNTIME -eq 'minsize') {
"$(Pipeline.Workspace)\CoOrdinatedBuildPipeline\drop_windows_build_windows_x64_${runtime}\$signedFolder"
+2 -3
View File
@@ -2081,8 +2081,8 @@ function Install-Dotnet {
# Note that when it is null, Invoke-Expression (but not &) must be used to interpolate properly
$sudo = if (!$NoSudo) { "sudo" }
# $installObtainUrl = "https://dot.net/v1"
$installObtainUrl = "https://dotnet.microsoft.com/download/dotnet/scripts/v1"
$installObtainUrl = "https://builds.dotnet.microsoft.com/dotnet/scripts/v1"
#$installObtainUrl = "https://dotnet.microsoft.com/download/dotnet/scripts/v1"
$uninstallObtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"
# Install for Linux and OS X
@@ -2173,7 +2173,6 @@ function Install-Dotnet {
$installArgs += @{ SkipNonVersionedFiles = $true }
$installArgs | Out-String | Write-Verbose -Verbose
& ./$installScript @installArgs
}
else {