Skip to content

Commit 61ce3a3

Browse files
[release/v7.4]Add UseDotnet task for installing dotnet (#25080)
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
1 parent 78e2a13 commit 61ce3a3

30 files changed

Lines changed: 337 additions & 188 deletions

.github/actions/test/linux-packaging/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
- name: Bootstrap
2828
run: |-
2929
Import-Module ./build.psm1
30-
Start-PSBootstrap -Package
30+
Start-PSBootstrap -Scenario Package
3131
shell: pwsh
3232
- name: Capture Artifacts Directory
3333
continue-on-error: true

.github/actions/test/windows/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ runs:
3131
run: Get-ChildItem "${{ github.workspace }}\build\*" -Recurse
3232
shell: pwsh
3333

34+
- uses: actions/setup-dotnet@v4
35+
with:
36+
global-json-file: .\global.json
37+
3438
- name: Bootstrap
3539
shell: powershell
3640
run: |-
@@ -50,7 +54,6 @@ runs:
5054
if: success()
5155
run: |-
5256
Import-Module .\build.psm1 -force
53-
Start-PSBootstrap
5457
Import-Module .\tools\ci.psm1
5558
Restore-PSOptions -PSOptionsPath '${{ github.workspace }}\build\psoptions.json'
5659
$options = (Get-PSOptions)

.github/workflows/linux-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
uses: actions/checkout@v4.1.0
7878
with:
7979
fetch-depth: 1000
80+
8081
- name: Build
8182
uses: "./.github/actions/build/ci"
8283
linux_test_unelevated_ci:
@@ -187,6 +188,10 @@ jobs:
187188
with:
188189
fetch-depth: '0'
189190

191+
- uses: actions/setup-dotnet@v4
192+
with:
193+
global-json-file: ./global.json
194+
190195
# Initializes the CodeQL tools for scanning.
191196
- name: Initialize CodeQL
192197
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9

.github/workflows/macos-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
if: success() || failure()
175175
run: |-
176176
import-module ./build.psm1
177-
start-psbootstrap -package
177+
start-psbootstrap -Scenario package
178178
shell: pwsh
179179
ready_to_merge:
180180
name: macos ready to merge

.pipelines/templates/compliance/apiscan.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,12 @@ jobs:
6161
parameters:
6262
repoRoot: '$(repoRoot)'
6363

64-
- pwsh: |
65-
Import-Module .\build.psm1 -force
66-
Start-PSBootstrap
67-
workingDirectory: '$(repoRoot)'
68-
retryCountOnTaskFailure: 2
69-
displayName: 'Bootstrap'
70-
env:
71-
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
64+
- task: UseDotNet@2
65+
displayName: 'Use .NET Core sdk'
66+
inputs:
67+
useGlobalJson: true
68+
packageType: 'sdk'
69+
workingDirectory: $(Build.SourcesDirectory)"
7270

7371
- pwsh: |
7472
Import-Module .\build.psm1 -force

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
Import-Module "$repoRoot/build.psm1"
104104
Import-Module "$repoRoot/tools/packaging"
105105
106-
Start-PSBootstrap -Package
106+
Start-PSBootstrap -Scenario Package
107107
108108
$psOptionsPath = "$(Pipeline.Workspace)/CoOrdinatedBuildPipeline/${unsignedDrop}/psoptions/psoptions.json"
109109

.pipelines/templates/linux.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ 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
71+
6572
- pwsh: |
6673
$runtime = $env:RUNTIME
6774
@@ -75,7 +82,6 @@ jobs:
7582
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
7683
$buildWithSymbolsPath = New-Item -ItemType Directory -Path $(Pipeline.Workspace)/Symbols_$(Runtime) -Force
7784
78-
Start-PSBootstrap
7985
$null = New-Item -ItemType Directory -Path $buildWithSymbolsPath -Force -Verbose
8086
8187
$ReleaseTagParam = @{}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
Write-Verbose -Message "LTS Release: $LTS" -Verbose
121121
}
122122
123-
Start-PSBootstrap -Package
123+
Start-PSBootstrap -Scenario Package
124124
125125
$macosRuntime = "osx-$buildArch"
126126

.pipelines/templates/mac.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ 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)
48+
4249
- pwsh: |
4350
Import-Module $(PowerShellRoot)/build.psm1 -Force
44-
Start-PSBootstrap -Package
51+
Start-PSBootstrap -Scenario Package
4552
displayName: 'Bootstrap VM'
4653
env:
4754
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)

.pipelines/templates/nupkg.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,17 @@ jobs:
9797
- task: NuGetToolInstaller@1
9898
displayName: 'Install NuGet.exe'
9999

100+
- task: UseDotNet@2
101+
displayName: 'Use .NET Core sdk'
102+
inputs:
103+
useGlobalJson: true
104+
packageType: 'sdk'
105+
workingDirectory: '$(PowerShellRoot)'
106+
100107
- pwsh: |
101108
Set-Location -Path '$(PowerShellRoot)'
102109
Import-Module "$(PowerShellRoot)/build.psm1" -Force
103110
104-
Start-PSBootstrap -Verbose
105-
106111
$sharedModules = @('Microsoft.PowerShell.Commands.Management',
107112
'Microsoft.PowerShell.Commands.Utility',
108113
'Microsoft.PowerShell.ConsoleHost',

0 commit comments

Comments
 (0)