Skip to content

Commit

Permalink
Merge pull request #31 from AArnott/upgrade
Browse files Browse the repository at this point in the history
Upgrade NuGet credprovider in Azure Pipelines
  • Loading branch information
AArnott authored Dec 12, 2019
2 parents bec0bf9 + 153cd7d commit 21c8e26
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines/install-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
steps:

- powershell: |
.\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }}
.\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites
dotnet --info
displayName: Install prerequisites

Expand Down
7 changes: 6 additions & 1 deletion init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Per-repo can lead to file locking issues when dotnet.exe is left running as a bu
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 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.
.PARAMETER NoRestore
Skips the package restore step.
.PARAMETER AccessToken
Expand All @@ -27,13 +30,15 @@ Param (
[Parameter()]
[switch]$NoPrerequisites,
[Parameter()]
[switch]$UpgradePrerequisites,
[Parameter()]
[switch]$NoRestore,
[Parameter()]
[string]$AccessToken
)

if (!$NoPrerequisites) {
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality
}

Expand Down
6 changes: 5 additions & 1 deletion tools/Install-NuGetCredProvider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
from https://github.com/microsoft/artifacts-credprovider
to assist in authenticating to Azure Artifact feeds in interactive development
or unattended build agents.
.PARAMETER Force
Forces install of the CredProvider plugin even if one already exists. This is useful to upgrade an older version.
.PARAMETER AccessToken
An optional access token for authenticating to Azure Artifacts authenticated feeds.
#>
[CmdletBinding()]
Param (
[Parameter()]
[switch]$Force,
[Parameter()]
[string]$AccessToken
)
Expand All @@ -35,7 +39,7 @@ if ($IsMacOS -or $IsLinux) {
chmod u+x $installerScript
}

& $installerScript
& $installerScript -Force:$Force

if ($AccessToken) {
$endpoints = @()
Expand Down

0 comments on commit 21c8e26

Please sign in to comment.