Rewriting Chocolatey from the ground up
I’m excited to announce the launch of Chocolatey 0.9.9, which is the first major rewrite of Chocolatey since its inception. I originally wrote Chocolatey in PowerShell, mostly as an experiment to see if PowerShell would be a good programming language, and also as a way for me to actually learn PowerShell. Now we’ve rewritten Chocolatey as a compiled programming language to ensure Chocolatey’s portability, extensibility, maintainability, security, and performance.
Here’s what we’ve gained with the rewrite:
Performance - Now that Chocolatey is using a compiled language, it can execute much faster. We can access NuGet APIs directly instead of shelling to the NuGet executable to parse the output. This and other improvements gave us huge gains in performance!
Tooling - One of the benefits of programming with C# is the testing frameworks are more mature and there are more road-tested tools and libraries available. Visual Studio itself is a great IDE. Then we have tools that plug into Visual Studio, like ReSharper and NUnit, that make it much faster to test, debug, and get code into production. We are able to lean on many libraries that are already built surrounding the .NET framework.
Maintainability - We expect the familiarity of the language and all of the tools that can check things like cyclomatic complexity to keep the code base maintainable.
Portability - Using a compiled language allows us to run on nix and other places we couldn’t before. This is great for admins whose primary box is nix - they won’t necessarily need to startup a Windows box to make updates to packages (it doesn’t get them out of testing the packages though).
APIs - C# allows for direct integration with Chocolatey via an API. It allows for both PowerShell and .NET tools to benefit from using an API and/or embedding a DLL within an app.
Security - We are signing the executable with tamper detection, so you will know whether you are running Chocolatey from an official channel or from some other source and whether that executable has been tampered with.
As with any major rewrite, there are a few incompatibilities and unresolved issues, so be sure to check out the latest release notes before you upgrade. We also have at least one feature temporarily missing from the old version. See the feature parity list for details.
The biggest change is the prompt for confirmation - we’ve moved to a more secure by default approach, so we felt this change was needed (otherwise we would not have introduced it as a default behavior). Choco 0.9.9 is interactive by default, meaning when it is about to change the state of a machine, it will ask for confirmation to continue. This is on par with other package managers, like yum and apt-get. For scripting purposes this means existing scripts need to add
choco install somepackage -y so that scripts don’t sit waiting for confirmation.
Some tools like Box Starter or ChocolateyGUI that use Chocolatey may need to play catch up before they are compliant with the new version. This does also include the current Chocolatey Puppet module (more on that in the what's next section). If you use any of these, wait for the nod that the tool can handle the new version before moving forward.
On the plus side, all commands now have --noop, which can also be passed as -whatif. See the wiki for details on how to pass commands.
New users should install 0.9.9 if they’re not using Box Starter or ChocolateyGUI. Be sure to check out the new help menu (choco -h) or check out the updated wiki. Keep in mind that most of the docs in the wild are for the older version, so the Wiki should be the single source of truth for the new version of Chocolatey going forward.
I want to take a minute to thank everyone who tested the release candidate and helped catch a lot of bugs and compatibility issues.
Special thanks goes to Gary Ewan Park, Matt Wrock, Rich Siegel, Richard Simpson and Guilhem Lettron for their ongoing commitment to the project. Thanks also to Joel Bennett, a new team member, who is handling work for the official OneGet Chocolatey provider.
Gigantic thanks to purity (TomOne) and other community feed moderators, who handled more than their fare share of the package moderation load while I and another moderator were busy getting the new version shipped.
To all of the Kickstarter backers, this would not have been possible without you!
A round of thanks goes to thigg, aronovgj, jberezanski, dhilgarth, rpavlik, DarwinCSIWindowscom, eavonius, CADbloke, cobrabr, and others (if I missed your name, I'm sorry) for testing the release candidate, providing feedback in the way of issues and enhancements, and helping smooth out many of the rough edges!
Puppet provider updates will be available within the next two weeks. Please note that we’ll be deprecating the rismoney/chocolatey module and all future updates to the provider will be on chocolatey/chocolatey (this module is not available yet). The provider will install and work with the new version of Chocolatey. As I mentioned in my 2014 PuppetConf talk, the Chocolatey module is being evaluated as a possible Puppet Approved module candidate. To that end, you’ll notice improvements in the documentation provided with the module.
If you’re interested in learning more about Chocolatey, I’ll be launching a new blog series here that covers the basics and more advanced topics. Stay tuned!
- Download the last PowerShell version of Chocolatey, then upgrade to the latest version!
- Video: Plugging Chocolatey into your Puppet Infrastructure