Skip to content

Commit

Permalink
(#230) Change "files" directory to "packages" directory
Browse files Browse the repository at this point in the history
The manifest folders lived in a folder named after one in the Ansible project. This didn't make sense here, where it often lives inside a /files/ directory already.

This has been changed.
  • Loading branch information
JPRuskin committed Aug 7, 2024
1 parent 19bf837 commit 1bad999
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions OfflineInstallPreparation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
}
Expand All @@ -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
Expand All @@ -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) {
Expand All @@ -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"
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion Start-C4bCcmSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ process {
# Dot-source helper functions
. .\scripts\Get-Helpers.ps1

$Packages = (Get-Content $PSScriptRoot\files\chocolatey.json | ConvertFrom-Json).packages
$Packages = (Get-Content $PSScriptRoot\packages\chocolatey.json | ConvertFrom-Json).packages

# DB Setup
Write-Host "Installing SQL Server Express"
Expand Down
6 changes: 3 additions & 3 deletions Start-C4bJenkinsSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,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
Expand Down
2 changes: 1 addition & 1 deletion Start-C4bNexusSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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 {
choco push $_.FullName --source "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --apikey $NugetApiKey --force
}

Expand Down
10 changes: 5 additions & 5 deletions Start-C4bSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -106,7 +106,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"
@($ChocoPath, $FilesDir, $PkgsDir, $TempDir, $TestDir) | ForEach-Object {
Expand All @@ -133,8 +133,8 @@ try {

& $FilesDir\OfflineInstallPreparation.ps1 -LicensePath $LicenseFile

if (Test-Path $FilesDir\files\*.nupkg) {
choco source add --name LocalChocolateySetup --source $FilesDir\files\ --Priority 1
if (Test-Path $FilesDir\packages\*.nupkg) {
choco source add --name LocalChocolateySetup --source $FilesDir\packages\ --Priority 1
}

# Set Choco Server Chocolatey Configuration
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/Create-ChocoLicensePkg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down
2 changes: 1 addition & 1 deletion tests/jenkins.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1bad999

Please sign in to comment.