Skip to content

adamrushuk/powershell-pipeline

Repository files navigation

PowerShell Pipeline Example

This is a Proof of Concept repo to show how you can build CI/CD pipeline for a PowerShell module.

The example is an old PowerShell module I started for VMware vCloud Director.

Status

Build Pipeline

Build Status

Release Pipeline

Dev Test Prod
Dev Deployment Status Test Deployment Status Prod Deployment Status
PSvCloud package in dev feed in Azure Artifacts PSvCloud package in test feed in Azure Artifacts PSvCloud package in prod feed in Azure Artifacts

Goals

I've created various scripts for vCloud Director over the past few years, so I plan to use this module as an opportunity to refactor and share these scripts one by one. I'll apply the latest methods and best practices I've learnt recently, with a focus on the process around The Release Pipeline Model (Source > Build > Test > Release).

Source

Use Git with the practical common flow branching model.

Build

Use psake to develop build scripts that can be used both locally using Task Runners in Visual Studio Code, and by a CI/CD system like Azure DevOps.

This will cover:

  • Compiling separate function files into a single .psm1 module.
  • Automatically updating documentation in Markdown, ready for a 3rd-party like ReadTheDocs.

Test

Test the compiled code for known issues and ensure it aligns to defined standards.

This will cover:

  • Code analysis using PSScriptAnalyzer.
  • Code testing (unit, and common) using Pester.

Release

Publish the module build artifact to an Azure DevOps Artifacts (NuGet) feed.