Skip to content

Commit

Permalink
Merge pull request #257 from puppetlabs/maint-update_puppetize_workflow
Browse files Browse the repository at this point in the history
(maint) - Update PDK Install
  • Loading branch information
GSPatton authored Aug 25, 2023
2 parents f57c875 + 0610aa0 commit 823a12c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

env:
pdk_version: 2.5.0.0
pdk_version: 3.0.0.0
module_cache: PSFramework, PSDscResources, AccessControlDSC, powershell-yaml, PSScriptAnalyzer

defaults:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/puppetize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
required: false

env:
pdk_version: 2.7.1.0
pdk_version: 3.0.0.0
module_cache: Puppet.Dsc, PSFramework, PSDscResources, powershell-yaml

jobs:
Expand Down Expand Up @@ -87,13 +87,15 @@ jobs:
env:
FORGE_TOKEN: ${{ secrets.FORGE_API_TOKEN }}
run: |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
Import-Module -Name PSDesiredStateConfiguration -Force
Import-Module -Name Puppet.Dsc -Force
Import-Module -Name ./src/Puppet.Dsc -Force
$null = Get-Command PDK, Publish-NewDscModuleVersion
$PublishParameters = @{
ForgeNameSpace = 'dsc'
Name = '${{ matrix.module_name }}'
Name = '${{ matrix.module }}'
OnlyNewer = $true
MaxBuildCount = 1
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repuppetize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
required: false

env:
pdk_version: 2.5.0.0
pdk_version: 3.0.0.0
module_cache: Puppet.Dsc, PSFramework, PSDscResources, powershell-yaml

jobs:
Expand Down
3 changes: 2 additions & 1 deletion src/Puppet.Dsc/functions/New-PuppetDscModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ Function New-PuppetDscModule {
# Generate REFERENCE.md file for the Puppet module from the auto-generated types for each DSC resource
Write-PSFMessage -Message 'Writing the reference documentation for the Puppet module'
Set-PSModulePath -Path $InitialPsModulePath
Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -verbose
Install-Gems -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -Verbose
Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -Verbose

If ($PassThru) {
# Return the folder containing the puppetized module
Expand Down
31 changes: 31 additions & 0 deletions src/Puppet.Dsc/internal/functions/Install-Gems.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function Install-Gems {
<#
.SYNOPSIS
Install required gems
.DESCRIPTION
Installs required gems as specified in the Gemfile.
.PARAMETER PuppetModuleFolderPath
The path, relative or literal, to the Puppet module's root folder.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
$PuppetModuleFolderPath
)
# verify required gems installed
begin {
$PuppetModuleFolderPath = Resolve-Path -Path $PuppetModuleFolderPath -ErrorAction Stop
$Command = 'pdk bundle install'
}
process {
Try {
$ErrorActionPreference = 'Stop'
Invoke-PdkCommand -Path $PuppetModuleFolderPath -Command $Command -SuccessFilterScript {
$_ -match 'gems now installed'
}
} Catch {
$PSCmdlet.ThrowTerminatingError($PSItem)
}
}
end {}
}

0 comments on commit 823a12c

Please sign in to comment.