DevOpsGroup has joined Sourced, an Amdocs company. Read more about this partnership and what this means for the future in our blog.

DevOpsGroup Blog DSC Tooling:  The DscBuild module

DSC Tooling: The DscBuild module

The DscBuild module contains the Invoke-DscBuild function.  This is essentially a complete implementation of a DSC continuous delivery pipeline which takes care of producing all of the artifacts which need to be published to your pull servers:  MOF documents, zip files for resource modules, and checksums for both.  It also uses Pester to run any unit tests on your resource modules, and runs the Test-cDscResource command from the cDscResourceDesigner module on them as well.  Failures in either of these two types of tests will abort the build.

It’s not strictly necessary to use Invoke-DscBuild; you could reproduce this process in a product like TeamCity using individual steps for each part of the process: running unit tests, compiling configurations, etc.  The Invoke-DscBuild function can serve as a template for setting up your own continuous delivery pipeline, or you can use it as-is.

We have made some small changes to the Invoke-DscBuild process to improve its performance and functionality.  Calls to Test-cDscResource were tweaked slightly to cut down on the number of calls to Get-DscResource (which is an extremely slow command, for whatever reason), and we modified the process so it only tests and rebuilds module zip files if the version number of the module has changed from what is already built on disk.  When we first reviewed the module, failed unit tests were not causing the build to abort; this has been corrected as well.

On the whole, we found the DscBuild module to be a great starting point for producing a DSC-based CD solution.

3 thoughts on “DSC Tooling: The DscBuild module

  1. Hi Dave,
    i am trying the toolkit with the following structure
    Folder PATH listing
    Volume serial number is CA45-B0D3
    ¦ +—AllNodes
    ¦ +—Applications
    ¦ +—Credentials
    ¦ +—Services
    ¦ +—SiteData
    ¦ +—Calculator
    ¦ +—Validator
    ¦ +—Assertions
    SampleBuild.ps1 is placed in C:DSC-development, when i run it i get the following error:
    Import-Module : The specified module ‘Pester’ was not loaded because no valid module file was found in any module directory.
    At C:DSC-developmentSampleBuild.ps1:5 char:5
    do i need to specify the full path to the modules?
    Import-Module Pester -ErrorAction Stop
    Import-Module dscbuild -ErrorAction Stop
    Import-Module dscconfiguration -ErrorAction Stop
    Do you have tree examples on how this actually should look like?
    I think the Examples folder is not finished?

  2. Hi Selimir,
    Try copying everything that’s currently in your DSC_Tooling folder over to C:Program FilesWindowsPowerShellModules . You’ll also need to copy the ToolingExamplesSampleConfiguration module from the DSC repo to that location, and to place copies of the StackExchangeResources, cWebAdministration, and cSmbShare modules into your DSC_Resources subfolder. (These 3 modules are required if you’re actually executing the sample configuration.)
    After that, the call to Invoke-DscBuild should work.

Leave a Reply

Your email address will not be published. Required fields are marked *