Skip to content

Commit 5bc15ae

Browse files
authored
[release/v7.4] Remove UseDotnet task and use the dotnet-install script (#26170)
1 parent 5152be6 commit 5bc15ae

12 files changed

+51
-73
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
steps:
2+
- pwsh: |
3+
if (-not (Test-Path '$(RepoRoot)')) {
4+
$psRoot = '$(Build.SourcesDirectory)/PowerShell'
5+
Set-Location $psRoot -Verbose
6+
}
7+
8+
$version = Get-Content ./global.json | ConvertFrom-Json | Select-Object -ExpandProperty sdk | Select-Object -ExpandProperty version
9+
10+
Write-Verbose -Verbose "Installing .NET SDK with version $version"
11+
12+
Import-Module ./build.psm1 -Force
13+
Install-Dotnet -Version $version -Verbose
14+
15+
displayName: 'Install dotnet SDK'
16+
workingDirectory: $(RepoRoot)
17+
env:
18+
ob_restore_phase: true
19+

.pipelines/templates/linux-package-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ jobs:
8787
env:
8888
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
8989
90+
- template: /.pipelines/templates/install-dotnet.yml@self
91+
9092
- pwsh: |
9193
$packageType = '$(PackageType)'
9294
Write-Verbose -Verbose "packageType = $packageType"
@@ -103,7 +105,7 @@ jobs:
103105
Import-Module "$repoRoot/build.psm1"
104106
Import-Module "$repoRoot/tools/packaging"
105107
106-
Start-PSBootstrap -Scenario Package
108+
Start-PSBootstrap -Scenario Both
107109
108110
$psOptionsPath = "$(Pipeline.Workspace)/CoOrdinatedBuildPipeline/${unsignedDrop}/psoptions/psoptions.json"
109111

.pipelines/templates/linux.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ jobs:
6262
AnalyzeInPipeline: true
6363
Language: csharp
6464

65-
- task: UseDotNet@2
66-
inputs:
67-
useGlobalJson: true
68-
workingDirectory: $(PowerShellRoot)
69-
env:
70-
ob_restore_phase: true
65+
- template: /.pipelines/templates/install-dotnet.yml@self
7166

7267
- pwsh: |
7368
$runtime = $env:RUNTIME

.pipelines/templates/mac.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ jobs:
3939
sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell"
4040
displayName: 'Create $(Agent.TempDirectory)/PowerShell'
4141
42-
- task: UseDotNet@2
43-
displayName: 'Use .NET Core sdk'
44-
inputs:
45-
useGlobalJson: true
46-
packageType: 'sdk'
47-
workingDirectory: $(PowerShellRoot)
42+
## We cross compile for arm64, so the arch is always x64
43+
- template: /.pipelines/templates/install-dotnet.yml@self
4844

4945
- pwsh: |
5046
Import-Module $(PowerShellRoot)/build.psm1 -Force

.pipelines/templates/nupkg.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,7 @@ jobs:
9494
parameters:
9595
repoRoot: $(PowerShellRoot)
9696

97-
- task: NuGetToolInstaller@1
98-
displayName: 'Install NuGet.exe'
99-
100-
- task: UseDotNet@2
101-
displayName: 'Use .NET Core sdk'
102-
inputs:
103-
useGlobalJson: true
104-
packageType: 'sdk'
105-
workingDirectory: '$(PowerShellRoot)'
97+
- template: /.pipelines/templates/install-dotnet.yml@self
10698

10799
- pwsh: |
108100
Set-Location -Path '$(PowerShellRoot)'

.pipelines/templates/release-validate-fxdpackages.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ jobs:
6161
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/$artifactName" -Recurse
6262
displayName: 'Capture Downloaded Artifacts'
6363
64-
- task: UseDotNet@2
65-
displayName: 'Use .NET Core sdk'
66-
inputs:
67-
useGlobalJson: true
68-
packageType: 'sdk'
69-
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
64+
- template: /.pipelines/templates/install-dotnet.yml@self
7065

7166
- pwsh: |
7267
$artifactName = '$(artifactName)'

.pipelines/templates/release-validate-globaltools.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ jobs:
3838
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
3939
displayName: 'Capture Downloaded Artifacts'
4040
41-
- task: UseDotNet@2
42-
displayName: 'Use .NET Core sdk'
43-
inputs:
44-
useGlobalJson: true
45-
packageType: 'sdk'
46-
workingDirectory: $(REPOROOT)
41+
- template: /.pipelines/templates/install-dotnet.yml@self
4742

4843
- pwsh: |
4944
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"

.pipelines/templates/release-validate-sdk.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ jobs:
4646
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
4747
displayName: 'Capture Downloaded Artifacts'
4848
49-
- task: UseDotNet@2
50-
displayName: 'Use .NET Core sdk'
51-
inputs:
52-
useGlobalJson: true
53-
packageType: 'sdk'
54-
workingDirectory: $(REPOROOT)
49+
- template: /.pipelines/templates/install-dotnet.yml@self
5550

5651
- pwsh: |
5752
$repoRoot = "$(Build.SourcesDirectory)"

.pipelines/templates/testartifacts.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@ jobs:
2525
env:
2626
ob_restore_phase: true
2727

28+
- template: /.pipelines/templates/SetVersionVariables.yml@self
29+
parameters:
30+
ReleaseTagVar: $(ReleaseTagVar)
31+
2832
- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
2933
parameters:
30-
repoRoot: $(Build.SourcesDirectory)/PowerShell
34+
repoRoot: $(RepoRoot)
3135
ob_restore_phase: true
3236

33-
- task: UseDotNet@2
34-
displayName: 'Use .NET Core sdk'
35-
inputs:
36-
useGlobalJson: true
37-
packageType: 'sdk'
38-
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
39-
env:
40-
ob_restore_phase: true
37+
- template: /.pipelines/templates/install-dotnet.yml@self
4138

4239
- pwsh: |
4340
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force
@@ -93,19 +90,16 @@ jobs:
9390
env:
9491
ob_restore_phase: true
9592

93+
- template: /.pipelines/templates/SetVersionVariables.yml@self
94+
parameters:
95+
ReleaseTagVar: $(ReleaseTagVar)
96+
9697
- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
9798
parameters:
9899
repoRoot: $(Build.SourcesDirectory)/PowerShell
99100
ob_restore_phase: true
100101

101-
- task: UseDotNet@2
102-
displayName: 'Use .NET Core sdk'
103-
inputs:
104-
useGlobalJson: true
105-
packageType: 'sdk'
106-
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
107-
env:
108-
ob_restore_phase: true
102+
- template: /.pipelines/templates/install-dotnet.yml@self
109103

110104
- pwsh: |
111105
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force

.pipelines/templates/windows-hosted-build.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ jobs:
6363
AnalyzeInPipeline: true
6464
Language: csharp
6565

66-
- task: UseDotNet@2
67-
inputs:
68-
useGlobalJson: true
69-
workingDirectory: $(PowerShellRoot)
70-
env:
71-
ob_restore_phase: true
66+
- template: /.pipelines/templates/install-dotnet.yml@self
7267

7368
- pwsh: |
7469
$runtime = switch ($env:Architecture)
@@ -142,6 +137,7 @@ jobs:
142137
}
143138
144139
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
140+
Find-Dotnet
145141
146142
## Build global tool
147143
Write-Verbose -Message "Building PowerShell global tool for Windows.x64" -Verbose
@@ -237,6 +233,9 @@ jobs:
237233
After that, we repack using Compress-Archive and rename it back to a nupkg.
238234
#>
239235
236+
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
237+
Find-Dotnet
238+
240239
$packagingStrings = Import-PowerShellDataFile "$(PowerShellRoot)\tools\packaging\packaging.strings.psd1"
241240
242241
$outputPath = Join-Path '$(ob_outputDirectory)' 'globaltool'

0 commit comments

Comments
 (0)