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

Use the installed version of Chocolatey rather than shipping chocolatey.dll as part of Boxstarter #394

Closed
pauby opened this issue Apr 11, 2019 · 11 comments · Fixed by #479
Closed
Assignees
Labels
5 - Released The issue has been resolved, and released to the public for consumption Improvement Issues that enhances existing functionality, or adds new features
Milestone

Comments

@pauby
Copy link
Member

pauby commented Apr 11, 2019

To be able to use the neweset functionality within Chocolatey would require unbundling Chocolatey within Boxstarter and using the latest version from Chocolatey.org.

There looks to be quite a few iussues around this and @mwrock has mentioned some of them at #89. There is no further information around what has been patched so would be good to understand this.

Currently Boxstarter uses it's own version for remote installs but the remote installs could install, or use the current version of the Chocolatey package on the local machine to install remotely.

Bundling a version of Chocolatey helps to keep that version as a known entity - we know it works with Boxstarter so there will be no surprises. However we could install that particular version of Chocolatey and get the same outcome.

I've opened this to get a wider discussion on the merits of doing and not doing this.

Related #225, #247, #369

@pauby pauby added Documentation Issues for changes that only need to change documentation Discussion and removed Documentation Issues for changes that only need to change documentation labels Apr 11, 2019
@mwallner
Copy link
Member

mwallner commented Jun 4, 2019

I think we could go forward with this by always installing choco as a dependency of boxstarter.

We would still need to bundle a version with boxstarter that is "pushed" to remote computers and installed if, and only if no other/newer version of Chocolatey is already installed on the target machine.

Currently, Check-Chocolatey in bootstrapper.ps1 does install chocolatey from https://chocolatey.org/install.ps1 - I'd suggest to change this to really install the version that's bundled with Boxstarter to be consistent when doing local/remote "bootstrapping installs" on plain machines.
(That'd also enable us to work fully offline, if -DelegateChocoSources switch is used to pass local choco feeds to remote machines and new installs.)

@pauby pauby added this to the v3.0.0 milestone Oct 8, 2019
@pauby
Copy link
Member Author

pauby commented Oct 8, 2019

We would still need to bundle a version with boxstarter that is "pushed" to remote computers

Could we not simply install that using the Chocolatey.org install script on a remote computer?

Currently, Check-Chocolatey in bootstrapper.ps1 does install chocolatey from https://chocolatey.org/install.ps1 - I'd suggest to change this to really install the version that's bundled with Boxstarter to be consistent when doing local/remote "bootstrapping installs" on plain machines.

It sounds like you are talking about organizational use (ie. a different way / script to use for installing Chocolatey)? In that instance the org will likely have interanlized / localised that install script so are you suggesting having an option to use that but default to the Chocolatey.org one?

@mwallner
Copy link
Member

mwallner commented Oct 9, 2019

I'm basically talking about remote boxstarter usage plus the use of Boxstarter.bat here.
Im my env, the machines I'm deploying to don't have internet access - so having a version of Chocolatey bundled with Boxstarter actually is the only way I can think of keeping this ability.

@pauby
Copy link
Member Author

pauby commented Oct 9, 2019

so having a version of Chocolatey bundled with Boxstarter actually is the only way I can think of keeping this ability.

In an organizational context we could leverage the Chocolatey way of installing Chocolatey either through an internal repository or localising the installation script?

@mwallner mwallner self-assigned this Jan 19, 2021
mwallner added a commit to mwallner/boxstarter that referenced this issue Oct 21, 2021
+ rip out chocolatey.dll (use choco.exe from $env:ChocolateyInstall)
+ install chocolatey from nupkg if not present (local + remote)
+ lots of fixes for *nix systems (case-sensitive! / renamed files)
+ lots of autofmt changes
mwallner added a commit to mwallner/boxstarter that referenced this issue Oct 22, 2021
mwallner added a commit to mwallner/boxstarter that referenced this issue Oct 23, 2021
@Baune8D
Copy link

Baune8D commented Oct 24, 2021

I think something is not working with the build artifacts from this PR #479 (2.13.13). I cannot call Invoke-Reboot anymore in my script, i get a message saying; Invoke-Reboot must be called from a Boxstarter package.

I tried printing the keys of the $Boxstarter variable just before this line: https://github.com/mwallner/boxstarter/blob/master/Boxstarter.Bootstrapper/Invoke-Reboot.ps1#L35

On (2.13.0) the keys are:

  • Log
  • ProgramFiles86
  • SuppressLogging
  • RebootOk
  • Package
  • StopOnPackageFailure
  • LocalRepo
  • AutoLogedOn
  • NoPassword
  • NugetSources
  • IsRebooting
  • ScriptToCall
  • BaseDir

On (2.13.13) the keys are:

  • IsRebooting
  • NugetSources
  • BaseDir
  • LocalRepo
  • RebootOk
  • Log
  • StopOnPackageFailure
  • SuppressLogging

From looking at the Invoke-Reboot script, the error seems to be because of the missing ScriptToCall property.

@mwallner
Copy link
Member

Thanks @Baune8D ! - will investigate/fix asap

@mwallner
Copy link
Member

Hey @Baune8D - could you further elaborate how you're calling boxstarter wich then fails to reboot b/c of the missing variable ScriptToCall? / thanks

@Baune8D
Copy link

Baune8D commented Oct 24, 2021

Sure. We kick off the package install with the following command: Install-BoxstarterPackage -PackageName 'MagicScript' -Credential $null -KeepWindowOpen -StopOnPackageFailure

The error happens if i put Invoke-Reboot anywhere in the Boxstarter script.

I have tried this multiple times now, if i switch to 2.13.0 it works, with 2.13.13 it fails with the previously described message.

@mwallner
Copy link
Member

Notes / Design Decisions:

With "Unbundling Chocolatey from Boxstarter" we'll bump Boxstarter to the next major version - Boxstarter v3

Boxstarter v3 will still come with a 'packaged' (nupkg) version of Chocolatey which will be installed when no $env:ChocolateyInstall is present on the target machine. Considering this, a new Chocolatey release will most likely be followed by a new Boxstarter release containing a new Version of chocolatey.nupkg. (after we verified Boxstarter still works as intended with the new release).

Boxstarter v3 will always prefer to use the choco.exe that's already installed on the system, no matter if it's a older or newer version than the one included,- giving users/orgs the possibility to pin chocolatey itself to a specific version.

Boxstarter v3 should support licensed editions of Chocolatey.

"Boxstarter Chocolatey Packages" (a.k.a. packages containing Boxstarter cmdlets) will still only work when called via Install-BoxstarterPackage, even though regular choco.exe in the process. (prepare/teardown of Boxstarter scope surrounding each choco invocation)

Starting with Boxstarter v3, each choco command in a Boxstarter script/package will have it's own Powershell session scope, this may both fix a couple of existing bugs (i.e. duplicate Add-Module when using the choco-fonts-extesion) as well as introduce new ones, if users were relying on $global or $script scope to pass data between packages involved in a Boxstarter package dependency tree.

@Baune8D
Copy link

Baune8D commented Nov 1, 2021

Hi @mwallner I think i encountered another bug using the new 2.13.16 artifacts. Issue created here: #481

mwallner added a commit to mwallner/boxstarter that referenced this issue Feb 16, 2022
@gep13 gep13 added Improvement Issues that enhances existing functionality, or adds new features 3 - Review Code has been added, and is available for review as a pull request and removed Discussion labels Apr 25, 2022
gep13 pushed a commit to mwallner/boxstarter that referenced this issue Apr 25, 2022
gep13 added a commit that referenced this issue Apr 25, 2022
@gep13 gep13 added 4 - Done Code has been added to the repository, and has been reviewed by a team member and removed 3 - Review Code has been added, and is available for review as a pull request labels Apr 27, 2022
@gep13 gep13 changed the title Unbundling Chocolatey from Boxstarter and Installing Chocolatey Separately Use the installed version of Chocolatey rather than shipping chocolatey.dll as part of Boxstarter Apr 27, 2022
@gep13 gep13 modified the milestones: 3.0.0-beta-20220426-14, 3.0.0 Jul 14, 2022
@gep13 gep13 added 5 - Released The issue has been resolved, and released to the public for consumption and removed 4 - Done Code has been added to the repository, and has been reviewed by a team member labels Jul 14, 2022
@choco-bot
Copy link

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Released The issue has been resolved, and released to the public for consumption Improvement Issues that enhances existing functionality, or adds new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants