Use NuGetAuthenticate in AzP instead of hand installation

This works around microsoft/artifacts-credprovider#244
This commit is contained in:
Andrew Arnott 2021-06-28 13:28:24 -06:00
Родитель 4dbf55a284
Коммит d3b2f39ccc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A9B9910CDCCDA441
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -3,9 +3,14 @@ parameters:
steps:
- task: NuGetAuthenticate@0
displayName: Authenticate NuGet feeds
inputs:
forceReinstallCredentialProvider: true
- powershell: |
$AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors
.\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites
.\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites -NoNuGetCredProvider
dotnet --info
# Print mono version if it is present.

Просмотреть файл

@ -20,6 +20,9 @@
Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it.
.PARAMETER NoPrerequisites
Skips the installation of prerequisite software (e.g. SDKs, tools).
.PARAMETER NoNuGetCredProvider
Skips the installation of the NuGet credential provider. Useful in pipelines with the `NuGetAuthenticate` task, as a workaround for https://github.com/microsoft/artifacts-credprovider/issues/244.
This switch is ignored and installation is skipped when -NoPrerequisites is specified.
.PARAMETER UpgradePrerequisites
Takes time to install prerequisites even if they are already present in case they need to be upgraded.
No effect if -NoPrerequisites is specified.
@ -35,6 +38,8 @@ Param (
[Parameter()]
[switch]$NoPrerequisites,
[Parameter()]
[switch]$NoNuGetCredProvider,
[Parameter()]
[switch]$UpgradePrerequisites,
[Parameter()]
[switch]$NoRestore,
@ -45,7 +50,10 @@ Param (
$EnvVars = @{}
if (!$NoPrerequisites) {
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
if (!$NoNuGetCredProvider) {
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
}
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality
if ($LASTEXITCODE -eq 3010) {
Exit 3010