From fcb5e2bebc3c95b322c23e710910b2ce5ebe6b72 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Tue, 7 Feb 2023 22:24:36 +0100 Subject: [PATCH 1/5] renaming wiki home --- source/WikiSource/{HOME.md => Home_.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/WikiSource/{HOME.md => Home_.md} (100%) diff --git a/source/WikiSource/HOME.md b/source/WikiSource/Home_.md similarity index 100% rename from source/WikiSource/HOME.md rename to source/WikiSource/Home_.md From db1c391bf0da8e0f958656b46364b67adf7fb59e Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Tue, 7 Feb 2023 22:28:28 +0100 Subject: [PATCH 2/5] updating wiki content --- source/WikiSource/Home.md | 7 +++++++ source/WikiSource/Home_.md | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 source/WikiSource/Home.md delete mode 100644 source/WikiSource/Home_.md diff --git a/source/WikiSource/Home.md b/source/WikiSource/Home.md new file mode 100644 index 0000000..3f5c625 --- /dev/null +++ b/source/WikiSource/Home.md @@ -0,0 +1,7 @@ +Welcome to the documentation wiki for the Sampler DSC Pipeline + +# Usage + +The `Sampler.DscPipeline` PowerShell module is an extension to [Sampler](github.com/synedgy/Sampler), +providing tasks to implement a DSC pipeline to create DSC artefacts as used in the +[DSC Workshop](https://github.com/dsccommunity/DscWorkshop). diff --git a/source/WikiSource/Home_.md b/source/WikiSource/Home_.md deleted file mode 100644 index 7b15f6b..0000000 --- a/source/WikiSource/Home_.md +++ /dev/null @@ -1,3 +0,0 @@ -# Home Wiki - -Welcome to the Sampler.DscPipeline Wiki. From 75fbb0862f1be9cdf6d2e0fe5a0d85616acef3a2 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Tue, 7 Feb 2023 22:28:59 +0100 Subject: [PATCH 3/5] updating changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26155c3..5e3467e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Test cases updated to Pester 5. - Fixing issue with ZipFile class not being present - Added ''UseEnvironment'' parameter to cater for RSOP for identical node names in different environments -- Adding home.md to wikiSource. +- Adding Home.md to wikiSource and correct casing. ### Fixed From 862e120eb38211be117c9b233588b18f9c80bcd9 Mon Sep 17 00:00:00 2001 From: gaelcolas Date: Tue, 7 Feb 2023 22:56:19 +0100 Subject: [PATCH 4/5] fixing broken link in home md --- source/WikiSource/Home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/WikiSource/Home.md b/source/WikiSource/Home.md index 3f5c625..ecd1cab 100644 --- a/source/WikiSource/Home.md +++ b/source/WikiSource/Home.md @@ -2,6 +2,6 @@ Welcome to the documentation wiki for the Sampler DSC Pipeline # Usage -The `Sampler.DscPipeline` PowerShell module is an extension to [Sampler](github.com/synedgy/Sampler), +The `Sampler.DscPipeline` PowerShell module is an extension to [Sampler](https://github.com/gaelcolas/Sampler), providing tasks to implement a DSC pipeline to create DSC artefacts as used in the [DSC Workshop](https://github.com/dsccommunity/DscWorkshop). From da5155e9e147ceb3fe333b43cee1d013fc3a0738 Mon Sep 17 00:00:00 2001 From: "Jan-Hendrik Peters [MSFT]" Date: Wed, 8 Feb 2023 01:29:44 +0100 Subject: [PATCH 5/5] Increase MOF compile speed (#18) Co-authored-by: Gael --- CHANGELOG.md | 1 + source/Scripts/CompileRootConfiguration.ps1 | 29 +++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e3467e..4c545b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added error handling discovering 'CompileRootConfiguration.ps1' and 'RootMetaMof.ps1' - Test cases updated to Pester 5. - Fixing issue with ZipFile class not being present +- Increase build speed of root configuration by only importing required Composites/Resources - Added ''UseEnvironment'' parameter to cater for RSOP for identical node names in different environments - Adding Home.md to wikiSource and correct casing. diff --git a/source/Scripts/CompileRootConfiguration.ps1 b/source/Scripts/CompileRootConfiguration.ps1 index 470893d..69f0817 100644 --- a/source/Scripts/CompileRootConfiguration.ps1 +++ b/source/Scripts/CompileRootConfiguration.ps1 @@ -39,32 +39,45 @@ if ($BuildInfo.'Sampler.DscPipeline'.DscCompositeResourceModules.Count -lt 1) } Write-Host -Object "RootConfiguration will import these composite resource modules as defined in 'build.yaml':" -$importStatements = foreach ($module in $BuildInfo.'Sampler.DscPipeline'.DscCompositeResourceModules) +foreach ($module in $BuildInfo.'Sampler.DscPipeline'.DscCompositeResourceModules) { if ($module -is [hashtable]) { Write-Host -Object "`t- $($module.Name) ($($module.Version))" - "Import-DscResource -ModuleName $($module.Name) -ModuleVersion $($module.Version)`n" } else { Write-Host -Object "`t- $module" - "Import-DscResource -ModuleName $module`n" } } -Write-Host -Object '' - -$rootConfiguration = Get-Content -Path $PSScriptRoot\RootConfiguration.ps1 -Raw -$rootConfiguration = $rootConfiguration -replace '#', $importStatements +Write-Host -Object "Preloading available resources" +$availableResources = Get-DscResource -Invoke-Expression -Command $rootConfiguration +Write-Host -Object '' $configData = @{} $configData.Datum = $ConfigurationData.Datum foreach ($node in $rsopCache.GetEnumerator()) { + $importStatements = foreach ($configurationItem in $node.Value.Configurations) + { + $resource = $availableResources.Where({$_.Name -eq $configurationItem}) + if ($null -eq $resource) + { + Write-Debug -Message "No DSC resource found for configuration $configurationItem" + continue + } + + "Import-DscResource -ModuleName $($resource.ModuleName) -ModuleVersion $($resource.Version) -Name $($resource.Name)`n" + } + + $rootConfiguration = Get-Content -Path $PSScriptRoot\RootConfiguration.ps1 -Raw + $rootConfiguration = $rootConfiguration -replace '#', ($importStatements | Select-Object -Unique) + + Invoke-Expression -Command $rootConfiguration + $configData.AllNodes = @([hashtable]$node.Value) try {