Click Free Application Deployment
With The Magic Of PowerShell and Chocolatey
|
- Paul Broadwith, Glasgow Scotland
- 25+ years in IT in financial, government, manufacturing and services sectors
- Lead Engineer on Boxstarter and cChoco DSC Resource
|
|
|
|
|
- Understand what Chocolatey is;
- Understand the difference between packages and installers;
- Be able to create a package;
- Learn how to work with installers that won‘t install silently;
- Learn to use Pester to test your packages;
- Learn what the Chocolatey Community Repository is;
- Tips on how to keep your package continually updated;
Questions at the end. Plleeaassseeeee?
To install PowerShell Core on Linux:
apt install -y powershell
yum install -y powershell
pacman -S powershell
To install PowerShell Core on Mac:
brew cask install powershell
To install PowerShell Core on Windows:
- Chocolatey is the package manager for Windows
- Created by Rob Reynolds (@ferventcoder)
- First version released on 23 March 2011
Now Windows has:
choco install powershell-core -y
- Windows 7+ / Server 2003+
- Windows PowerShell 2
- .NET 4 (TLS 1.2 requires .NET 4.5)
- No Nano Support (see GitHub issue #1371)
Fundamental Tenet Of Chocolatey
Chocolatey manages packages.
|
Packages manage installers.
|
Chocolatey does not manage installers.
What Is A Chocolatey Package?
What is a Chocolatey package:
- Special Zip file with a .nupkg extension;
- Commonly called ‘nupkeg’ or ‘noo package’ due to file extension;
- It contains metadata, PowerShell scripts and sometimes other files;
- Builds on NuGet package framework while remaining compatible with v2 repositories;
|
packagename.nuspec
chocolateyInstall.ps1
googlechrome.msi
|
What can a Chocolatey package do:
- Chocolatey
PowerShell;
- PowerShell scripts install, upgrade and uninstall software;
- Almost anything you can do in PowerShell you can do with a Chocolatey package but don’t use
choco commands inside Chocolatey packages!
|
chocolateyInstall.ps1
chocolateyBeforeModify.ps1
chocolateyUninstall.ps1
|
DEMO 1
Lets Look At Chocolatey Packages
Everything you wanted to know but were afraid to ask.
- Repository is at chocolatey.org hosted by Chocolatey;
- Chocolatey uses it as the default chocolatey package source;
- Vast majority of packages created by volunteer maintainers;
- Some vendors maintain their own packages;
- Repository is for the many and not the few - use is monitored;
- Licensing is important - does not have redistribution rights;
Chocolatey Community Repository
Monthly website stats as of November 2019:
- 1.6 B requests;
- 177 TB of data;
- 1.8M unique visitors
|
|
|
Rate Limiting - 1 hour block
- Downloads of Chocolatey Package: 5
- Downloads of ANY OTHER Package: 20
|
|
Monthly Download Monitoring - fixed block
- Tens of thousands of package downloads over a specific period
|
|
Push
|
|
choco push mypackage.1.0.0.nupkg
--api-key="'123456'"
|
|
|
Received
|
|
- Package Validator
- Package Verifier
- Package Scanner
- Human Moderator
|
|
|
Approved
|
|
Monthly Package Verifier
|
- Not recommended for direct use by organisations:
- Reliability;
- Trust;
- Bandwidth;
- Distribution rights;
- Recommend you create package repository with Artifactory, Nexus or ProGet;
- Disable Chocolatey Community Repository:
choco source disable --name="'chocolatey'"
DEMO 2
Tips For Testing and Keeping Your Packages Continually Updated
- We know what Chocolatey is;
- We know how to create a package and how to use the template;
- Learned how to deal with troublesome installers;
- Use Pester to test our packages;
- Learn what happens when you submit a package to the Chocolatey Community Repository;
- What to use to keep your package continually updated;