Automating The Software Deployment Lifecycle

with Chocolatey, Jenkins and PowerShell

Paul Broadwith
  • Paul Broadwith, Glasgow Scotland
  • 25+ years in IT in financial, government, manufacturing and services sectors
  • Lead Engineer on Boxstarter and cChoco DSC Resource

MVP Logo
Chocolatey Logo
Scottish PowerShell and DevOps User Group Logo
 
  • What is Chocolatey?
  • Chocolatey Sources;
  • Internalizing packages;
  • Recommended Organizational Architecture;
  • Common scenarios where Chocolatey automation will help you;

Based on the blog post https://pau.by/chocojenkins

What Is Chocolatey?

Chocolatey is a package manager for Windows, like apt-get or yum but for Windows. It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer.

Fundamental Tenet Of Chocolatey

Chocolatey manages packages. Packages manage installers.

Chocolatey does not manage installers.

Tools You Need

Internalizing Packages - Chocolatey For Business
Internal Package Repositories - Chocolatey.Server
Automation Code - PowerShell
Automation Manager - Jenkins

Chocolatey Package Sources

Where do packages come from?

  • Chocolatey For Business comes with two Chocolatey sources by default:
    • chocolatey - Chocolatey Community Repository
    • chocolatey.licensed - Chocolatey licensed packages;

Output from choco source list command

  • Add your own sources:
    • NuGet v2 respository required;
    • Local folder
    • Repository manager:
      • Sonatype Nexus;
      • Artifactory;
      • ProGet;

Sonatype NexusSonatype Nexus

DEMO 1

Chocolatey Sources

Internalizing Packages

Keeping it in the family

  • What is package internalization?
  • Organizations recommended to disable the default sources.
    • Reliability
    • Trust
    • Bandwidth
    • Copyright Restrictions
  • Using the default chocolatey source is subject to:
    • rate limiting;
    • excessive download limiting;
  • Automatically internalizes the vast majority of packages;
  • Very fast;
  • Don’t reinvent the wheel;
  • Automation!

DEMO 2

Package Internalization

Chocolatey Recommended Organizational Architecture

Every organisation is a snowflake.

BRIGHT LIGHT COMING UP

DEMO 3

Jenkins Jobs and Common Scenarios

Internalize Packages Workflow

Packages Update Workflow

Suggested Improvements.

Ideas to extend and customise

  • Schedule Updating Packages from Chocolatey Community Repository;
  • Add Configuration Management (Ansible, Puppet, PowerShell DSC etc.) to push packages to end nodes;
  • Write your own Pester Tests that your organization needs;
  • When packages are published to production send a notification via email / Slack / Teams or whatever you use;

Summary

  • What Chocolatey is and how sources work;
  • Understand package internalization and why it’s important for organizations;
  • How to apply automation to Chocolatey package testing and deployment;

Questions?

https://blog.pauby.com
Paul Broadwith
@pauby
github.com/pauby
linkedin.com/in/paulbroadwith

pau.by/talks

Thank You!