Skip to content

Xainey/DSCBasicPipeline

Repository files navigation

Overview

An example of using the Release Pipeline Model with PowerShell-based tools to manage DSC Deployments.

WIP: The goal is to run tasks using Jenkins as a CI Server.

  • DSC Resource Dependencies are loaded via git in psakeBuild.ps1
  • Target Servers should be defined in ExampleConfigData.psd1 or .MOF will not be created
  • DSC Resources are copied to Target Deploy Server using admin share:
$PSmodules = "\\$server\c$\Program Files\WindowsPowerShell\Modules"
Copy-Item -Path "Modules\*" -Destination $PSmodules -Recurse -Force

Requirements

  • Test-Kichen
  • Kitchen-DSC
  • Pester
  • PSake
  • PSScriptAnalyzer

Jenkinsfile

A Jenkinsfile has been added to the project root for pipeline support with the Pipeline Plugin. Set the target QA_SERVER to match the QA server set in ExampleConfigData.psd1

Usage

A psake script has been created to manage the various operations related to testing and deployment of ExampleConfig.ps1

Build Operations

  • Test the script via Pester and Script Analyzer
.\build.ps1
  • Test the script with Test-Kitchen/Kitchen-DSC
.\build.ps1 -Task Test
  • Test the script with Script Analyzer only
.\build.ps1 -Task Analyze
  • Deploy the script via PSDeploy, $server should be set in ExampleConfigData.psd1 to generate .mof
.\build.ps1 -Task Deploy -Server $server
  • Create the Test-Kitchen Build Environment
.\build.ps1 -Task BuildEnvironment

VSCode Tasks

Tasks added to .vscode\tasks.json to run Test-Kitchen and Psake Tasks on local machine.

  • PSakeAnalyze: Runs build.ps1 Analyze
  • PSakeTest: Runs build.ps1 Test
  • PSakeDeploy: Runs build.ps1 Deploy. Default deploy $server in build.ps1 parms.
  • PesterUnitTests: Runs Pester against Unit .tests.ps1 in Tests\Unit
  • KitchenCreate: Runs Kitchen Create
  • KitchenConverge: Runs Kitchen Converge
  • KitchenVerify: Runs Kitchen Verify
  • KitchenDestroy: Runs Kitchen Destroy

About

Example CI pipeline for DSC resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published