Skip to content

Commit 8119303

Browse files
authored
Add Invoke-DscResource as experimental feature (#30)
1 parent 72dd066 commit 8119303

File tree

9 files changed

+771
-488
lines changed

9 files changed

+771
-488
lines changed

.vsts-ci/templates/ci-test.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,19 @@ jobs:
8383
8484
- ${{ parameters.powershellExecutable }}: |
8585
Invoke-PSPackageProjectTest -Type Functional
86-
displayName: Execute functional tests
86+
displayName: Execute functional tests - InvokeDscResource Disabled
87+
errorActionPreference: continue
88+
89+
- ${{ parameters.powershellExecutable }}: |
90+
$configFolder = split-path $PROFILE
91+
$configPath = Join-Path $configFolder -ChildPath powershell.config.json
92+
copy-Item $(Build.SourcesDirectory)/assets/powershell.config.json $configPath
93+
displayName: Enable ExperimentalFeature
94+
errorActionPreference: continue
95+
96+
- ${{ parameters.powershellExecutable }}: |
97+
Invoke-PSPackageProjectTest -Type Functional
98+
displayName: Execute functional tests - InvokeDscResource Enabled
8799
errorActionPreference: continue
88100
89101
- ${{ parameters.powershellExecutable }}: |

assets/powershell.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ExperimentalFeatures":["PSCommandNotFoundSuggestion","PSForEachObjectParallel","PSImplicitRemotingBatching","Microsoft.PowerShell.Utility.PSDebugRunspaceWithBreakpoints","PSDesiredStateConfiguration.InvokeDscResource"]}

build.ps1

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ param (
3030

3131
[Parameter(ParameterSetName="help")]
3232
[switch]
33-
$UpdateHelp
33+
$UpdateHelp,
34+
35+
[Parameter(ParameterSetName="build")]
36+
[switch]
37+
$TestInvokeDscResource
3438
)
3539

3640
$config = Get-PSPackageProjectConfiguration -ConfigPath $PSScriptRoot
@@ -86,6 +90,29 @@ if ($Publish.IsPresent)
8690
Invoke-PSPackageProjectPublish -Signed:$Signed.IsPresent
8791
}
8892

93+
if ( $TestInvokeDscResource.IsPresent ) {
94+
$backupName = $null
95+
try {
96+
$configFolder = split-path $PROFILE
97+
$configPath = Join-Path $configFolder -ChildPath powershell.config.json
98+
if(Test-Path ~/.config/powershell/powershell.config.json)
99+
{
100+
$backupName = Join-Path $configFolder -ChildPath "powershell.config-((Get-Date).ToString('yyyyMMddHHmm')).json"
101+
Copy-Item $configPath $backupName -force
102+
}
103+
104+
copy-Item $PSScriptRoot/assets/powershell.config.json $configPath
105+
Invoke-PSPackageProjectTest -Type $TestType
106+
}
107+
finally {
108+
remove-item $configPath
109+
if($backupName)
110+
{
111+
Copy-Item $backupName $configPath -force
112+
}
113+
}
114+
}
115+
89116
if ( $Test.IsPresent ) {
90117
Invoke-PSPackageProjectTest -Type $TestType
91118
}

src/.ci/ci.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/.ci/release.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/.ci/test.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
RootModule = 'PSDesiredStateConfiguration.psm1'
1010

1111
# Version number of this module.
12-
moduleVersion = '2.0.0'
12+
moduleVersion = '2.0.1'
1313

1414
# Supported PSEditions
1515
CompatiblePSEditions = @('Core')
@@ -70,6 +70,7 @@ FunctionsToExport = @(
7070
'Configuration'
7171
'New-DscChecksum'
7272
'Get-DscResource'
73+
'Invoke-DscResource'
7374
)
7475

7576

@@ -96,4 +97,16 @@ HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390814'
9697

9798
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
9899
# DefaultCommandPrefix = ''
100+
101+
PrivateData = @{
102+
PSData = @{
103+
ExperimentalFeatures = @(
104+
@{
105+
Name = 'PSDesiredStateConfiguration.InvokeDscResource'
106+
Description = "Enables the Invoke-DscResource cmdlet and related features."
107+
}
108+
)
109+
}
110+
}
111+
99112
}

0 commit comments

Comments
 (0)