diff --git a/OfflineInstallPreparation.ps1 b/OfflineInstallPreparation.ps1 index 733f4f6..788921c 100644 --- a/OfflineInstallPreparation.ps1 +++ b/OfflineInstallPreparation.ps1 @@ -90,8 +90,8 @@ if (-not $Licensed) { } Copy-Item $LicensePath $InstalledLicensePath -Force } - $ExtensionSource = if (Test-Path $PSScriptRoot\files\chocolatey.extension.*.nupkg) { - Convert-Path $PSScriptRoot\files\ + $ExtensionSource = if (Test-Path $PSScriptRoot\packages\chocolatey.extension.*.nupkg) { + Convert-Path $PSScriptRoot\packages\ } else { 'https://licensedpackages.chocolatey.org/api/v2/' } @@ -103,7 +103,7 @@ $PackageWorkingDirectory = Join-Path $WorkingDirectory "Packages" if (-not (Test-Path $PackageWorkingDirectory)) { $null = New-Item -Path $PackageWorkingDirectory -ItemType Directory -Force } -foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages) { +foreach ($Package in (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages) { $ChocoArgs = @( "download", "$($Package.Name)" "--output-directory", $PackageWorkingDirectory @@ -118,7 +118,7 @@ foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertF } try { - if (-not (Get-ChocolateyPackageMetadata -Path $PackageWorkingDirectory -Id $Package.Name) -and -not (Get-ChocolateyPackageMetadata -Path "$PSScriptRoot\files\" -Id $Package.Name)) { + if (-not (Get-ChocolateyPackageMetadata -Path $PackageWorkingDirectory -Id $Package.Name) -and -not (Get-ChocolateyPackageMetadata -Path "$PSScriptRoot\packages\" -Id $Package.Name)) { Write-Host "Downloading '$($Package.Name)'" while ((Get-ChildItem $PackageWorkingDirectory -Filter *.nupkg).Where{$_.CreationTime -gt (Get-Date).AddMinutes(-1)}.Count -gt 5) { @@ -132,18 +132,18 @@ foreach ($Package in (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertF throw $_ } } -Move-Item -Path $PackageWorkingDirectory\*.nupkg -Destination $PSScriptRoot\files\ +Move-Item -Path $PackageWorkingDirectory\*.nupkg -Destination $PSScriptRoot\packages\ # Jenkins Plugins $PluginsWorkingDirectory = Join-Path $WorkingDirectory "JenkinsPlugins" if (-not (Test-Path $PluginsWorkingDirectory)) { $null = New-Item -Path $PluginsWorkingDirectory -ItemType Directory -Force } -if (Test-Path $PSScriptRoot\files\JenkinsPlugins.zip) { - Expand-Archive -Path $PSScriptRoot\files\JenkinsPlugins.zip -DestinationPath $PluginsWorkingDirectory -Force +if (Test-Path $PSScriptRoot\packages\JenkinsPlugins.zip) { + Expand-Archive -Path $PSScriptRoot\packages\JenkinsPlugins.zip -DestinationPath $PluginsWorkingDirectory -Force } $ProgressPreference = "Ignore" -foreach ($Plugin in (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom-Json).plugins) { +foreach ($Plugin in (Get-Content $PSScriptRoot\packages\jenkins.json | ConvertFrom-Json).plugins) { $RestArgs = @{ Uri = "https://updates.jenkins-ci.org/latest/$($Plugin.Name).hpi" OutFile = Join-Path $PluginsWorkingDirectory "$($Plugin.Name).hpi" @@ -155,12 +155,12 @@ foreach ($Plugin in (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom- Invoke-WebRequest @RestArgs -UseBasicParsing } } -Compress-Archive -Path $PluginsWorkingDirectory\* -Destination $PSScriptRoot\files\JenkinsPlugins.zip -Force +Compress-Archive -Path $PluginsWorkingDirectory\* -Destination $PSScriptRoot\packages\JenkinsPlugins.zip -Force # BCryptDll $null = Get-BcryptDll # License -if ($LicensePath -ne "$PSScriptRoot\files\chocolatey.license.xml") { - Copy-Item -Path (Convert-Path $LicensePath) -Destination $PSScriptRoot\files\chocolatey.license.xml +if ($LicensePath -ne "$PSScriptRoot\packages\chocolatey.license.xml") { + Copy-Item -Path (Convert-Path $LicensePath) -Destination $PSScriptRoot\packages\chocolatey.license.xml } \ No newline at end of file diff --git a/Start-C4bCcmSetup.ps1 b/Start-C4bCcmSetup.ps1 index 8e88951..3f29bc2 100644 --- a/Start-C4bCcmSetup.ps1 +++ b/Start-C4bCcmSetup.ps1 @@ -27,7 +27,7 @@ process { $ErrorActionPreference = 'Stop' Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bCcmSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt" - $Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages + $Packages = (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages Set-ChocoEnvironmentProperty -Name DatabaseUser -Value $DatabaseCredential diff --git a/Start-C4bJenkinsSetup.ps1 b/Start-C4bJenkinsSetup.ps1 index 0a52c4c..3d25372 100644 --- a/Start-C4bJenkinsSetup.ps1 +++ b/Start-C4bJenkinsSetup.ps1 @@ -68,10 +68,10 @@ process { Stop-Service -Name Jenkins #region Jenkins Plugin Install & Update - $JenkinsPlugins = (Get-Content $PSScriptRoot\files\jenkins.json | ConvertFrom-Json).plugins + $JenkinsPlugins = (Get-Content $PSScriptRoot\packages\jenkins.json | ConvertFrom-Json).plugins - if (Test-Path $PSScriptRoot\files\JenkinsPlugins.zip) { - Expand-Archive -Path $PSScriptRoot\files\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force + if (Test-Path $PSScriptRoot\packages\JenkinsPlugins.zip) { + Expand-Archive -Path $PSScriptRoot\packages\JenkinsPlugins.zip -DestinationPath $jenkinsHome\plugins\ -Force } # Performance is killed by Invoke-WebRequest's progress bars, turning them off to speed this up diff --git a/Start-C4bNexusSetup.ps1 b/Start-C4bNexusSetup.ps1 index cc2657e..4f46a12 100644 --- a/Start-C4bNexusSetup.ps1 +++ b/Start-C4bNexusSetup.ps1 @@ -26,7 +26,7 @@ process { $ErrorActionPreference = 'Stop' Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bNexusSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt" - $Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages + $Packages = (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages # Install base nexus-repository package Write-Host "Installing Sonatype Nexus Repository" @@ -55,7 +55,7 @@ process { $NuGetApiKey = (Get-NexusNuGetApiKey -Credential $Credential).apikey # Push all packages from previous steps to NuGet repo - Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\files" -Filter *.nupkg | ForEach-Object { + Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\packages" -Filter *.nupkg | ForEach-Object { Invoke-Choco push $_.FullName --source "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --apikey $NugetApiKey --force } diff --git a/Start-C4bSetup.ps1 b/Start-C4bSetup.ps1 index 7b729d0..18b12b3 100644 --- a/Start-C4bSetup.ps1 +++ b/Start-C4bSetup.ps1 @@ -21,9 +21,9 @@ param( [Parameter(ParameterSetName='Attended')] [string] $LicenseFile = $( - if (Test-Path $PSScriptRoot\files\chocolatey.license.xml) { + if (Test-Path $PSScriptRoot\packages\chocolatey.license.xml) { # Offline setup has been run, we should use that license. - Join-Path $PSScriptRoot "files\chocolatey.license.xml" + Join-Path $PSScriptRoot "packages\chocolatey.license.xml" } elseif (Test-Path $env:ChocolateyInstall\license\chocolatey.license.xml) { # Chocolatey is already installed, we can use that license. Join-Path $env:ChocolateyInstall "license\chocolatey.license.xml" @@ -99,7 +99,7 @@ try { Write-Host "Setting up initial directories in"$env:SystemDrive\choco-setup"" -ForegroundColor Green $ChocoPath = "$env:SystemDrive\choco-setup" $FilesDir = Join-Path $ChocoPath "files" - $PkgsDir = Join-Path $FilesDir "files" + $PkgsDir = Join-Path $FilesDir "packages" $TempDir = Join-Path $ChocoPath "temp" $TestDir = Join-Path $ChocoPath "tests" $xmlDir = Join-Path $ChocoPath "clixml" @@ -134,8 +134,8 @@ try { & $FilesDir\OfflineInstallPreparation.ps1 -LicensePath $LicenseFile - if (Test-Path $FilesDir\files\*.nupkg) { - Invoke-Choco source add --name LocalChocolateySetup --source $FilesDir\files\ --Priority 1 + if (Test-Path $FilesDir\packages\*.nupkg) { + Invoke-Choco source add --name LocalChocolateySetup --source $FilesDir\packages\ --Priority 1 } # Set Choco Server Chocolatey Configuration diff --git a/files/chocolatey.json b/packages/chocolatey.json similarity index 100% rename from files/chocolatey.json rename to packages/chocolatey.json diff --git a/files/jenkins.json b/packages/jenkins.json similarity index 100% rename from files/jenkins.json rename to packages/jenkins.json diff --git a/scripts/Create-ChocoLicensePkg.ps1 b/scripts/Create-ChocoLicensePkg.ps1 index 3cc11f4..2eb1938 100644 --- a/scripts/Create-ChocoLicensePkg.ps1 +++ b/scripts/Create-ChocoLicensePkg.ps1 @@ -13,7 +13,7 @@ param( # Local path used to build the license package. [Parameter()] [string] - $PackagesPath = "$env:SystemDrive\choco-setup\files\files", + $PackagesPath = "$env:SystemDrive\choco-setup\files\packages", # Path to the license file. [Parameter()] diff --git a/tests/jenkins.tests.ps1 b/tests/jenkins.tests.ps1 index 5b0a13b..12788fd 100644 --- a/tests/jenkins.tests.ps1 +++ b/tests/jenkins.tests.ps1 @@ -74,7 +74,7 @@ Describe "Jenkins Configuration" { Context "Required Plugins" { BeforeDiscovery { - $ExpectedPlugins = (Get-Content $PSScriptRoot\..\files\jenkins.json | ConvertFrom-Json).plugins.name + $ExpectedPlugins = (Get-Content $PSScriptRoot\..\packages\jenkins.json | ConvertFrom-Json).plugins.name } BeforeAll {