Skip to content

Commit

Permalink
Merge pull request #276 from chocolatey/QSG-261
Browse files Browse the repository at this point in the history
(#261) Remove LocalChocolateySetup Source
  • Loading branch information
JPRuskin authored Oct 15, 2024
2 parents a258b95 + 980bc78 commit c446da8
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ jobs:
$TestResults = Invoke-Command -Session $Session -ScriptBlock {
if (-not (Get-Module Pester -ListAvailable).Where{$_.Version -gt "5.0"}) {
Write-Host "Installing Pester 5 to run validation tests"
$chocoArgs = @('install', 'pester', '-y', '--source="https://community.chocolatey.org/api/v2/"')
$chocoArgs = @('install', 'pester', '-y', '--source="ChocolateyInternal"', '--no-progress')
& choco @chocoArgs | Write-Host
}
(Get-ChildItem C:\choco-setup\files\tests\ -Recurse -Filter *.tests.ps1).Fullname
Expand Down
2 changes: 2 additions & 0 deletions Set-SslSecurity.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,15 @@ process {
CentralManagementServiceUrl = "https://$($SubjectWithoutCn):24020/ChocolateyManagementService"
ServiceSalt = $ServiceSaltValue
ClientSalt = $ClientSaltValue
Source = "ChocolateyInternal"
}

Install-ChocolateyAgent @agentArgs
} else {
# Agent Setup
$agentArgs = @{
CentralManagementServiceUrl = "https://$($SubjectWithoutCn):24020/ChocolateyManagementService"
Source = "ChocolateyInternal"
}

Install-ChocolateyAgent @agentArgs
Expand Down
14 changes: 7 additions & 7 deletions Start-C4bCcmSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ process {

# DB Setup
Write-Host "Installing SQL Server Express"
$chocoArgs = @('upgrade', 'sql-server-express', '-y', '--no-progress')
$chocoArgs = @('upgrade', 'sql-server-express', "--source='ChocolateyInternal'", '-y', '--no-progress')
& Invoke-Choco @chocoArgs

# https://docs.microsoft.com/en-us/sql/tools/configuration-manager/tcp-ip-properties-ip-addresses-tab
Expand Down Expand Up @@ -95,17 +95,17 @@ process {
$chocoArgs = @('install', 'IIS-ApplicationInit', "--source='windowsfeatures'" ,'--no-progress', '-y')
& Invoke-Choco @chocoArgs -ValidExitCodes 0, 3010

$chocoArgs = @('install', 'dotnet-aspnetcoremodule-v2', "--version='$($Packages.Where{$_.Name -eq 'dotnet-aspnetcoremodule-v2'}.Version)'", '--no-progress', '-y')
$chocoArgs = @('install', 'dotnet-aspnetcoremodule-v2', "--source='ChocolateyInternal'", "--version='$($Packages.Where{$_.Name -eq 'dotnet-aspnetcoremodule-v2'}.Version)'", '--no-progress', '-y')
& Invoke-Choco @chocoArgs

$chocoArgs = @('install', 'dotnet-8.0-runtime', "--version=$($Packages.Where{$_.Name -eq 'dotnet-8.0-runtime'}.Version)", '--no-progress', '-y')
$chocoArgs = @('install', 'dotnet-8.0-runtime', "--source='ChocolateyInternal'", "--version=$($Packages.Where{$_.Name -eq 'dotnet-8.0-runtime'}.Version)", '--no-progress', '-y')
& Invoke-Choco @chocoArgs

$chocoArgs = @('install', 'dotnet-8.0-aspnetruntime', "--version=$($Packages.Where{$_.Name -eq 'dotnet-8.0-aspnetruntime'}.Version)", '--no-progress', '-y')
$chocoArgs = @('install', 'dotnet-8.0-aspnetruntime', "--source='ChocolateyInternal'", "--version=$($Packages.Where{$_.Name -eq 'dotnet-8.0-aspnetruntime'}.Version)", '--no-progress', '-y')
& Invoke-Choco @chocoArgs

Write-Host "Creating Chocolatey Central Management Database"
choco install chocolatey-management-database -y --package-parameters="'/ConnectionString=Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;Trusted_Connection=true;'" --no-progress
choco install chocolatey-management-database --source='ChocolateyInternal' -y --package-parameters="'/ConnectionString=Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;Trusted_Connection=true;'" --no-progress

# Add Local Windows User:
$DatabaseUser = $DatabaseCredential.UserName
Expand Down Expand Up @@ -138,12 +138,12 @@ process {
}

else {
$chocoArgs = @('install', 'chocolatey-management-service', '-y', "--package-parameters-sensitive=`"/ConnectionString:'Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;User ID=$DatabaseUser;Password=$DatabaseUserPw;'`"", '--no-progress')
$chocoArgs = @('install', 'chocolatey-management-service', "--source='ChocolateyInternal'", '-y', "--package-parameters-sensitive=`"/ConnectionString:'Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;User ID=$DatabaseUser;Password=$DatabaseUserPw;'`"", '--no-progress')
& Invoke-Choco @chocoArgs
}

Write-Host "Installing Chocolatey Central Management Website"
$chocoArgs = @('install', 'chocolatey-management-web', '-y', "--package-parameters-sensitive=""'/ConnectionString:Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;User ID=$DatabaseUser;Password=$DatabaseUserPw;'""", '--no-progress')
$chocoArgs = @('install', 'chocolatey-management-web', "--source='ChocolateyInternal'", '-y', "--package-parameters-sensitive=""'/ConnectionString:Server=Localhost\SQLEXPRESS;Database=ChocolateyManagement;User ID=$DatabaseUser;Password=$DatabaseUserPw;'""", '--no-progress')
& Invoke-Choco @chocoArgs

$CcmSvcUrl = Invoke-Choco config get centralManagementServiceUrl -r
Expand Down
4 changes: 2 additions & 2 deletions Start-C4bJenkinsSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ process {
Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bJenkinsSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"

# Install temurin21jre to meet JRE>11 dependency of Jenkins
$chocoArgs = @('install', 'temurin21jre', '-y', '--no-progress', "--params='/ADDLOCAL=FeatureJavaHome'")
$chocoArgs = @('install', 'temurin21jre', "--source='ChocolateyInternal'", '-y', '--no-progress', "--params='/ADDLOCAL=FeatureJavaHome'")
& Invoke-Choco @chocoArgs

# Environment variable used to disable jenkins install login prompts
[Environment]::SetEnvironmentVariable('JAVA_OPTS', '-Djenkins.install.runSetupWizard=false', 'Machine')

# Install Jenkins
Write-Host "Installing Jenkins"
$chocoArgs = @('install', 'jenkins', '-y', '--no-progress')
$chocoArgs = @('install', 'jenkins', "--source='ChocolateyInternal'", '-y', '--no-progress')
& Invoke-Choco @chocoArgs

Write-Host "Giving Jenkins 30 seconds to complete background setup..." -ForegroundColor Green
Expand Down
4 changes: 4 additions & 0 deletions Start-C4bNexusSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ process {
# Add ChocolateyInternal as a source repository
Invoke-Choco source add -n 'ChocolateyInternal' -s "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --priority 1

#Remove Local Chocolatey Setup Source
$chocoArgs = @('source', 'remove', '--name="LocalChocolateySetup"')
& Invoke-Choco @chocoArgs

# Install a non-IE browser for browsing the Nexus web portal.
if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) {
Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site"
Expand Down
2 changes: 1 addition & 1 deletion Start-C4bVerification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Param(
process {
if (-not (Get-Module Pester -ListAvailable).Where{$_.Version -gt "5.0"}) {
Write-Host "Installing Pester 5 to run validation tests"
$chocoArgs = @('install', 'pester', '-y', '--no-progress', '--source="https://community.chocolatey.org/api/v2/"')
$chocoArgs = @('install', 'pester', "--source='ChocolateyInternal'", '-y', '--no-progress', '--source="https://community.chocolatey.org/api/v2/"')
& Invoke-Choco @chocoArgs
}

Expand Down
1 change: 1 addition & 0 deletions files/chocolatey.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{ "name": "KB3035131", "internalize": false },
{ "name": "microsoft-edge" },
{ "name": "nexus-repository" },
{ "name": "pester" },
{ "name": "sql-server-express" },
{ "name": "temurin21jre" },
{ "name": "vcredist140" }
Expand Down
14 changes: 14 additions & 0 deletions tests/server.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
. $PSScriptRoot/packages.ps1
Describe "Server Integrity" {
Context "Chocolatey Sources" {
BeforeAll {
$sources = C:\ProgramData\chocolatey\choco.exe source list -r | ConvertFrom-Csv -Delimiter '|' -Header Name, Url, Disabled, Username, Password, Priority, BypassProxy, SelfService, AdminOnly
}

It "LocalChocolateySetup source was removed" {
"LocalChocolateySetup" -in $sources.Name | Should -BeFalse
}

It "ChocolateyInternal source exists" {
"ChocolateyInternal" -in $sources.Name | Should -Be $true
}
}

Context "Required Packages" {
BeforeAll {
$packages = C:\ProgramData\chocolatey\choco.exe list -r | ConvertFrom-Csv -Delimiter '|' -Header Package, Version
Expand Down

0 comments on commit c446da8

Please sign in to comment.