Skip to content

Commit c446da8

Browse files
authored
Merge pull request #276 from chocolatey/QSG-261
(#261) Remove LocalChocolateySetup Source
2 parents a258b95 + 980bc78 commit c446da8

File tree

8 files changed

+32
-11
lines changed

8 files changed

+32
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ jobs:
322322
$TestResults = Invoke-Command -Session $Session -ScriptBlock {
323323
if (-not (Get-Module Pester -ListAvailable).Where{$_.Version -gt "5.0"}) {
324324
Write-Host "Installing Pester 5 to run validation tests"
325-
$chocoArgs = @('install', 'pester', '-y', '--source="https://community.chocolatey.org/api/v2/"')
325+
$chocoArgs = @('install', 'pester', '-y', '--source="ChocolateyInternal"', '--no-progress')
326326
& choco @chocoArgs | Write-Host
327327
}
328328
(Get-ChildItem C:\choco-setup\files\tests\ -Recurse -Filter *.tests.ps1).Fullname

Set-SslSecurity.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,15 @@ process {
295295
CentralManagementServiceUrl = "https://$($SubjectWithoutCn):24020/ChocolateyManagementService"
296296
ServiceSalt = $ServiceSaltValue
297297
ClientSalt = $ClientSaltValue
298+
Source = "ChocolateyInternal"
298299
}
299300

300301
Install-ChocolateyAgent @agentArgs
301302
} else {
302303
# Agent Setup
303304
$agentArgs = @{
304305
CentralManagementServiceUrl = "https://$($SubjectWithoutCn):24020/ChocolateyManagementService"
306+
Source = "ChocolateyInternal"
305307
}
306308

307309
Install-ChocolateyAgent @agentArgs

Start-C4bCcmSetup.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ process {
3333

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

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

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

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

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

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

110110
# Add Local Windows User:
111111
$DatabaseUser = $DatabaseCredential.UserName
@@ -138,12 +138,12 @@ process {
138138
}
139139

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

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

149149
$CcmSvcUrl = Invoke-Choco config get centralManagementServiceUrl -r

Start-C4bJenkinsSetup.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ process {
2626
Start-Transcript -Path "$env:SystemDrive\choco-setup\logs\Start-C4bJenkinsSetup-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"
2727

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

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

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

4040
Write-Host "Giving Jenkins 30 seconds to complete background setup..." -ForegroundColor Green

Start-C4bNexusSetup.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ process {
8484
# Add ChocolateyInternal as a source repository
8585
Invoke-Choco source add -n 'ChocolateyInternal' -s "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --priority 1
8686

87+
#Remove Local Chocolatey Setup Source
88+
$chocoArgs = @('source', 'remove', '--name="LocalChocolateySetup"')
89+
& Invoke-Choco @chocoArgs
90+
8791
# Install a non-IE browser for browsing the Nexus web portal.
8892
if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) {
8993
Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site"

Start-C4bVerification.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Param(
88
process {
99
if (-not (Get-Module Pester -ListAvailable).Where{$_.Version -gt "5.0"}) {
1010
Write-Host "Installing Pester 5 to run validation tests"
11-
$chocoArgs = @('install', 'pester', '-y', '--no-progress', '--source="https://community.chocolatey.org/api/v2/"')
11+
$chocoArgs = @('install', 'pester', "--source='ChocolateyInternal'", '-y', '--no-progress', '--source="https://community.chocolatey.org/api/v2/"')
1212
& Invoke-Choco @chocoArgs
1313
}
1414

files/chocolatey.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{ "name": "KB3035131", "internalize": false },
2525
{ "name": "microsoft-edge" },
2626
{ "name": "nexus-repository" },
27+
{ "name": "pester" },
2728
{ "name": "sql-server-express" },
2829
{ "name": "temurin21jre" },
2930
{ "name": "vcredist140" }

tests/server.tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
. $PSScriptRoot/packages.ps1
22
Describe "Server Integrity" {
3+
Context "Chocolatey Sources" {
4+
BeforeAll {
5+
$sources = C:\ProgramData\chocolatey\choco.exe source list -r | ConvertFrom-Csv -Delimiter '|' -Header Name, Url, Disabled, Username, Password, Priority, BypassProxy, SelfService, AdminOnly
6+
}
7+
8+
It "LocalChocolateySetup source was removed" {
9+
"LocalChocolateySetup" -in $sources.Name | Should -BeFalse
10+
}
11+
12+
It "ChocolateyInternal source exists" {
13+
"ChocolateyInternal" -in $sources.Name | Should -Be $true
14+
}
15+
}
16+
317
Context "Required Packages" {
418
BeforeAll {
519
$packages = C:\ProgramData\chocolatey\choco.exe list -r | ConvertFrom-Csv -Delimiter '|' -Header Package, Version

0 commit comments

Comments
 (0)