Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#230) Add Admin Only Source For Chocolatey Core Packages #255

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ryanrichter94
Copy link
Member

@ryanrichter94 ryanrichter94 commented Jul 22, 2024

Description Of Changes

  • Add ChocolateyCore admin only source
  • Add ChocolateyCore NuGet repo within Nexus
  • Add Jenkins job Update ChocolateyCore Repository
  • Change previous C:\choco-setup\files\files directory to be C:\choco-setup\files\packages

Motivation and Context

Main reason for creating this repository was from feedback of admins not wanting their end users to see the Chocolatey core packages in the default repository. This way ChocolateyInternal only contains the packages brought in by the Jenkins internalization pipeline. Also cleaning up the end user view.

Testing

  1. Tested on local VM.

Operating Systems Testing

  • Windows Server 2022

Change Types Made

  • [ ] Bug fix (non-breaking change).
  • [ ] Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #230

@ryanrichter94 ryanrichter94 force-pushed the QSG-230 branch 5 times, most recently from 24711b3 to 3fe0c59 Compare July 24, 2024 18:58
@ryanrichter94 ryanrichter94 self-assigned this Jul 24, 2024
@ryanrichter94 ryanrichter94 force-pushed the QSG-230 branch 2 times, most recently from 7e070da to 75ed7a5 Compare July 24, 2024 19:17
@ryanrichter94 ryanrichter94 marked this pull request as ready for review July 25, 2024 20:10
@ryanrichter94 ryanrichter94 marked this pull request as draft July 26, 2024 21:08
@ryanrichter94
Copy link
Member Author

Converted back to draft after finding issue when running ClientSetup script.

@ryanrichter94 ryanrichter94 force-pushed the QSG-230 branch 3 times, most recently from 15ddbb0 to 51af786 Compare July 29, 2024 13:38
@ryanrichter94 ryanrichter94 marked this pull request as ready for review July 29, 2024 13:42
Copy link
Member

@JPRuskin JPRuskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, delayed hitting send on this while you were out but remembered.

I think we need to change up how we're adding the internal source a little.

Set-SslSecurity.ps1 Show resolved Hide resolved
scripts/ClientSetup.ps1 Outdated Show resolved Hide resolved
scripts/ClientSetup.ps1 Outdated Show resolved Hide resolved
jenkins/Update production repository/config.xml Outdated Show resolved Hide resolved
packages/jenkins.json Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
scripts/ClientSetup.ps1 Outdated Show resolved Hide resolved
Set-SslSecurity.ps1 Show resolved Hide resolved
Copy link
Contributor

@steviecoaster steviecoaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Set-SslSecurity.ps1 Show resolved Hide resolved
Set-SslSecurity.ps1 Show resolved Hide resolved
Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\files" -Filter *.nupkg | ForEach-Object {
choco push $_.FullName --source "$((Get-NexusRepository -Name 'ChocolateyInternal').url)/index.json" --apikey $NugetApiKey --force
Get-ChildItem -Path "$env:SystemDrive\choco-setup\files\packages" -Filter *.nupkg | ForEach-Object {
choco push $_.FullName --source "$((Get-NexusRepository -Name 'ChocolateyCore').url)/index.json" --apikey $NugetApiKey --force
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we're only pushing what we need to here? What is in the packages folder at this point? The only filter is "give me all the nupkgs"

if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) {
if (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'){
Write-Host "Syncing Microsoft Edge, to bring it under Chocolatey management"
choco sync --id="Microsoft Edge" --package-id="microsoft-edge"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful with this Sync. I've seen edge Shipped as Windows be in Programs and Features but not be able to be synced because it's installed "special" and isn't in the hive(s) you'd expect from the registry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, do we even need this? Edge is default in 2019+, which is what we support so it'll never not be there and on the path. This seems overly complicated at this stage.

Copy link
Member Author

@ryanrichter94 ryanrichter94 Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server 2019 does not ship with Microsoft Edge, also if we are installing our product suite onto a fresh server dedicated just for Chocolatey use, should we not make sure all software on that machine is managed by a Chocolatey package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should. I'm just warning that in cases where Edge has been installed via servicing channel (think a Windows Update), choco sync does not detect it, even though it's installed, so we might drop out of the check erroneously.

It might be simpler to just go "screw it, I'm putting edge on here", install the package, and let the underlying install sort things out.

I bring this up because I've seen sync not work even though Edge was very clearly displaying in Programs and Features. It's a real peach.

jenkins/Update ChocolateyCore Repository/builds/permalinks Outdated Show resolved Hide resolved
jenkins/Update ChocolateyCore Repository/builds/legacyIds Outdated Show resolved Hide resolved
jenkins/Update ChocolateyCore Repository/nextBuildNumber Outdated Show resolved Hide resolved
@@ -112,21 +112,28 @@ choco config set cacheLocation $env:ChocolateyInstall\choco-cache
choco config set commandExecutionTimeoutSeconds 14400

if ($InternetEnabled) {
choco source add --name="'ChocolateyInternal'" --source="'$RepositoryUrl'" --allow-self-service --user="'$($Credential.UserName)'" --password="'$($Credential.GetNetworkCredential().Password)'" --priority=1
choco source add --name="'ChocolateyCore'" --source="'$RepositoryUrl'" --allow-self-service --admin-only --user="'$($Credential.UserName)'" --password="'$($Credential.GetNetworkCredential().Password)'" --priority=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think it a good idea to have the admin-only source configured with the same credentials as the non-admin source? What if the non-admin creds get found out? Now you got 2 problems, not 1.

This requires bigger changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason ChocolateyCore repo has admin-only is to hide it from the end user GUI view. Also the credential is the same account with permissions to browse and download out of a raw/NuGet repo that ChocolateyInternal originally had before this change.

As this script is meant for a non-admin client registration. I wouldn't feel comfortable putting a true "admin" credential on either of these sources as default behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admin in name only. The credential should and would (at least this is what I expect) to be limited to browse/read operations on this new repository. The existing credential would not have access to this repository. This is a true separation such that if either credential is leaked somehow, only 1 repository is affected, and even then only in that they can download the packages, they'll still not be able to delete or write anything.

JPRuskin and others added 4 commits September 9, 2024 10:23
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.
- Add ChocolateyCore repo as main repo for core packages
- Add callout to new ChocolateyCore repository
- Remove See It In Action README section as video is outdated
- Fixup spelling/grammar in README
- Add new Update ChocolateyCore Repository Jenkins Job
- Add test to check for new Jenkins job
- Remove legacy build files from new and existing Jenkins jobs
Add pester package so its downloaded and available for Validation step.

This means the validation step can be used in a fully offline environment.
Add handling to bring edge under Chocolatey management if it was natively installed by a newer server OS.

This should ensure that the test is more consistent, delivering the same result regardless of if the Chocolatey package were installed or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Admin Only Source For Chocolatey Core Packages
3 participants