Skip to content

Commit

Permalink
Pin to .NET8 SDK (#9825)
Browse files Browse the repository at this point in the history
* Pin to .NET8 SDK

* Pin to .NET8 SDK

* Install .net sdk not runtime

* Install .net sdk for initialize pipeline

* Handle rate limiting as warning, continue

* Improve warning message
  • Loading branch information
jviau authored Jan 24, 2024
1 parent d9b24ac commit 57c4637
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ jobs:
demands:
- ImageOverride -equals MMS2019TLS
steps:
- task: UseDotNet@2 # The pinned SDK we use to build
displayName: 'Install .NET SDK from global.json'
inputs:
packageType: sdk
useGlobalJson: true
- task: PowerShell@2
displayName: 'Initialize'
name: Initialize
inputs:
filePath: '$(Build.Repository.LocalPath)\build\initialize-pipeline.ps1'
showWarnings: true

- job: BuildArtifacts
dependsOn: InitializePipeline
Expand Down
22 changes: 14 additions & 8 deletions build/initialize-pipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ Write-Host "BUILD_REASON: '$buildReason'"
Write-Host "BUILD_SOURCEBRANCH: '$sourceBranch'"

if ($buildReason -eq "PullRequest") {
# parse PR title to see if we should pack this
$response = Invoke-RestMethod api.github.com/repos/$env:BUILD_REPOSITORY_ID/pulls/$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
$title = $response.title.ToLowerInvariant()
Write-Host "Pull request '$title'"
if ($title.Contains("[pack]")) {
Write-Host "##vso[task.setvariable variable=BuildArtifacts;isOutput=true]true"
Write-Host "Setting 'BuildArtifacts' to true."
try {
# parse PR title to see if we should pack this
$response = Invoke-RestMethod api.github.com/repos/$env:BUILD_REPOSITORY_ID/pulls/$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
$title = $response.title.ToLowerInvariant()
Write-Host "Pull request '$title'"
if ($title.Contains("[pack]")) {
Write-Host "##vso[task.setvariable variable=BuildArtifacts;isOutput=true]true"
Write-Host "Setting 'BuildArtifacts' to true."
}
}
catch {
Write-Warning "Failed to get pull request title. Artifacts will not be built or packed."
Write-Warning $_
}
}

Expand All @@ -27,4 +33,4 @@ Import-Module $PSScriptRoot\Get-AzureFunctionsVersion -Force
$version = Get-AzureFunctionsVersion $buildNumber $buildNumber

Write-Host "Site extension version: $version"
Write-Host "##vso[build.updatebuildnumber]$version"
Write-Host "##vso[build.updatebuildnumber]$version"
24 changes: 11 additions & 13 deletions build/install-dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
steps:
- task: PowerShell@2
- task: UseDotNet@2 # Needed by some of our test resources
displayName: 'Install .NET 3.1'
inputs:
targetType: 'inline'
script: |
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
./dotnet-install.ps1 -InstallDir 'C:\Program Files\dotnet' -Verbose -Channel 3.1
- task: PowerShell@2
packageType: sdk
version: 3.1.x
- task: UseDotNet@2 # Needed by our projects and CI steps
displayName: 'Install .NET 6'
inputs:
targetType: 'inline'
script: |
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
# Official release versions can be found at: https://dotnet.microsoft.com/download/dotnet/6.0
# Newer versions can be found at: https://github.com/dotnet/installer#installers-and-binaries
./dotnet-install.ps1 -InstallDir 'C:\Program Files\dotnet' -Verbose -Channel 6.0
& dotnet --info
packageType: sdk
version: 6.x
- task: UseDotNet@2 # The pinned SDK we use to build
displayName: 'Install .NET SDK from global.json'
inputs:
packageType: sdk
useGlobalJson: true
10 changes: 10 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"sdk": {
"version": "8.0.101",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.56",
"Microsoft.Build.Traversal": "4.1.0"
}
}

0 comments on commit 57c4637

Please sign in to comment.