From b64e3491539176fde6bcb1862165fe505da87413 Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Mon, 12 Aug 2024 16:54:39 +0100 Subject: [PATCH] Pin Nexus-Repository to mitigate upgrade issues The latest version of Nexus-Repository needs special handling for upgrades, and breaks some NuGet v2 behaviour. Until we have this sorted, we're pinning to the previous version. --- Start-C4bNexusSetup.ps1 | 4 +++- files/chocolatey.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Start-C4bNexusSetup.ps1 b/Start-C4bNexusSetup.ps1 index 3736f5e..55f18df 100644 --- a/Start-C4bNexusSetup.ps1 +++ b/Start-C4bNexusSetup.ps1 @@ -38,9 +38,11 @@ process { # Dot-source helper functions . .\scripts\Get-Helpers.ps1 + $Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages + # Install base nexus-repository package Write-Host "Installing Sonatype Nexus Repository" - $chocoArgs = @('install', 'nexus-repository', '-y' ,'--no-progress', "--package-parameters='/Fqdn:localhost'") + $chocoArgs = @('install', 'nexus-repository', "--version=$($Packages.Where{$_.Name -eq 'nexus-repository'}.Version)", '--pin', '-y' ,'--no-progress', "--package-parameters='/Fqdn:localhost'") & choco @chocoArgs #Build Credential Object, Connect to Nexus diff --git a/files/chocolatey.json b/files/chocolatey.json index b8f0481..5d50410 100644 --- a/files/chocolatey.json +++ b/files/chocolatey.json @@ -24,7 +24,7 @@ { "name": "KB3035131", "internalize": false }, { "name": "KB3063858", "internalize": false }, { "name": "microsoft-edge" }, - { "name": "nexus-repository" }, + { "name": "nexus-repository", "version": "3.70.1.2" }, { "name": "sql-server-express" }, { "name": "temurin21jre" }, { "name": "vcredist140" }