Preparing for a release pipeline

In order to prepare for a release pipeline, you will need to get a couple of tools ready. Remember the chapter on DevOps? If not, review Chapter 9, DevOps with PowerShell first, since you need to have some understanding of the guiding principles of DevOps when you learn about release pipelines.

When working with a release pipeline, the goal is to ship code from development, to quality assurance, right into production with the least amount of friction. Yet, we still need to be in control of the process, and most of all, we must be able to trust it.

As usual, there is plenty of tooling available, either free or paid, open source or proprietary. Each tool has its benefits and drawbacks. For free and easy testing, we will create our own PowerShell module release pipeline with GitHub, AppVeyor, and the PowerShell Gallery. All principles can be applied to on-premises solutions such as VSTS (which combines Git, CI tools, and a NuGet feed), Jenkins, and others as well.

You can register for free accounts with all three providers or simply try to adapt the samples to your own infrastructure. See the following screenshot for examples of account-creation pages:

In addition to a working source code management and a working CI system, you might want to source a code-signing certificate for your build process. Doing so enables you to automatically sign any code that has been, for example, committed to your master branch and should be ready for production. This is an additional layer of security, which allows you and your users to discern development scripts without a signature from production scripts.

To be fully productive, we also need additional modules that all either support you scripting or are helpful in a CI context, which we will have a look at later:

Name Purpose

Pester

Test-driven development, a key component in your release pipeline!

PSScriptAnalyzer

Static code analysis to enforce code quality

Plaster

Quick templating of your entire pipeline

PSDepend

Download dependencies before every build

PSDeploy

Domain-specific language to define deployments to, for example, PowerShell Gallery

psake

Build-automation module, work with tasks (another DSL)

PlatyPS

Build help cab files on every release

BuildHelpers

Helper module to generate environment variables related to your build environment

 

Fortunately, Pester is already integrated into Windows Management Framework 5+, and Plaster and PSScriptAnalyzer are integrated into the VSCode PowerShell extension. All of the aforementioned modules can be downloaded from the PowerShell Gallery.

Lastly, you need to seriously think about what you want to accomplish. The process we are establishing is not only for you, or even your team; it should be made available for everyone. With a release pipeline such as the one we are creating, you can support your business DevOps-style. While our examples are specific to PowerShell modules, the same process can be used to deploy Desired State Configuration (DSC) documents throughout your infrastructure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.246.203