From 7fcd54949f2cd3fe8b5dfcd4b932782597193f18 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Wed, 21 Aug 2024 08:47:02 -0400 Subject: [PATCH 1/3] Enhancement - Windows PowerShell 5.1 compatibility in actions_bootstrap.ps1 Enhanced Windows check while installing Pester to support Windows PowerShell 5.1. It currently checks for $IsWindows, which was only introduced in PowerShell 6. I updated it to `-and ($IsWindows -or $PSVersionTable.PSVersion -ge [version]'5.1')` but if minimal code is desired, it could be simplified to `-and $PSVersionTable.PSVersion -ge [version]'5.1')`. --- actions_bootstrap.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions_bootstrap.ps1 b/actions_bootstrap.ps1 index ab0f6e0..d4a4966 100644 --- a/actions_bootstrap.ps1 +++ b/actions_bootstrap.ps1 @@ -46,7 +46,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -ge [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck From 0ad0a3b558a73451f41fdba127a9760a965cea11 Mon Sep 17 00:00:00 2001 From: Jake Morrison Date: Sun, 8 Sep 2024 11:30:22 -0500 Subject: [PATCH 2/3] improved action bootstrap install for pester on windows --- actions_bootstrap.ps1 | 2 +- docs/CHANGELOG.md | 7 +++++++ docs/Catesta.md | 2 +- src/Catesta/Catesta.psd1 | 2 +- src/Catesta/Resources/AWS/install_modules.ps1 | 2 +- src/Catesta/Resources/Azure/actions_bootstrap.ps1 | 2 +- src/Catesta/Resources/Bitbucket/actions_bootstrap.ps1 | 2 +- src/Catesta/Resources/GitHubActions/actions_bootstrap.ps1 | 2 +- .../Resources/GitHubActionsCodeBuild/actions_bootstrap.ps1 | 2 +- src/Catesta/Resources/GitLab/actions_bootstrap.ps1 | 2 +- src/Catesta/Resources/Module/plasterManifest.xml | 2 +- src/Catesta/Resources/Vault/plasterManifest.xml | 2 +- 12 files changed, 18 insertions(+), 11 deletions(-) diff --git a/actions_bootstrap.ps1 b/actions_bootstrap.ps1 index d4a4966..85545bb 100644 --- a/actions_bootstrap.ps1 +++ b/actions_bootstrap.ps1 @@ -46,7 +46,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -ge [version]'5.1')) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5c3a61b..2345fb4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.22.0] + +- Catesta template module changes + - Improved Windows detection checks for Pester module installation +- Catesta primary module changes + - Improved Windows detection checks for Pester module installation + ## [2.21.0] - Catesta template module changes diff --git a/docs/Catesta.md b/docs/Catesta.md index 673cc6a..2ada752 100644 --- a/docs/Catesta.md +++ b/docs/Catesta.md @@ -2,7 +2,7 @@ Module Name: Catesta Module Guid: 6796b193-9013-468a-b022-837749af2d06 Download Help Link: NA -Help Version: 2.21.0 +Help Version: 2.22.0 Locale: en-US --- diff --git a/src/Catesta/Catesta.psd1 b/src/Catesta/Catesta.psd1 index 9412361..e74761a 100644 --- a/src/Catesta/Catesta.psd1 +++ b/src/Catesta/Catesta.psd1 @@ -12,7 +12,7 @@ RootModule = 'Catesta.psm1' # Version number of this module. - ModuleVersion = '2.21.0' + ModuleVersion = '2.22.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/src/Catesta/Resources/AWS/install_modules.ps1 b/src/Catesta/Resources/AWS/install_modules.ps1 index b49fddb..174a965 100644 --- a/src/Catesta/Resources/AWS/install_modules.ps1 +++ b/src/Catesta/Resources/AWS/install_modules.ps1 @@ -204,7 +204,7 @@ else { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/Azure/actions_bootstrap.ps1 b/src/Catesta/Resources/Azure/actions_bootstrap.ps1 index eaa298a..90d9eed 100644 --- a/src/Catesta/Resources/Azure/actions_bootstrap.ps1 +++ b/src/Catesta/Resources/Azure/actions_bootstrap.ps1 @@ -67,7 +67,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/Bitbucket/actions_bootstrap.ps1 b/src/Catesta/Resources/Bitbucket/actions_bootstrap.ps1 index eaa298a..90d9eed 100644 --- a/src/Catesta/Resources/Bitbucket/actions_bootstrap.ps1 +++ b/src/Catesta/Resources/Bitbucket/actions_bootstrap.ps1 @@ -67,7 +67,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/GitHubActions/actions_bootstrap.ps1 b/src/Catesta/Resources/GitHubActions/actions_bootstrap.ps1 index eaa298a..90d9eed 100644 --- a/src/Catesta/Resources/GitHubActions/actions_bootstrap.ps1 +++ b/src/Catesta/Resources/GitHubActions/actions_bootstrap.ps1 @@ -67,7 +67,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/GitHubActionsCodeBuild/actions_bootstrap.ps1 b/src/Catesta/Resources/GitHubActionsCodeBuild/actions_bootstrap.ps1 index eaa298a..90d9eed 100644 --- a/src/Catesta/Resources/GitHubActionsCodeBuild/actions_bootstrap.ps1 +++ b/src/Catesta/Resources/GitHubActionsCodeBuild/actions_bootstrap.ps1 @@ -67,7 +67,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/GitLab/actions_bootstrap.ps1 b/src/Catesta/Resources/GitLab/actions_bootstrap.ps1 index eaa298a..90d9eed 100644 --- a/src/Catesta/Resources/GitLab/actions_bootstrap.ps1 +++ b/src/Catesta/Resources/GitLab/actions_bootstrap.ps1 @@ -67,7 +67,7 @@ foreach ($module in $modulesToInstall) { ErrorAction = 'Stop' } try { - if ($module.ModuleName -eq 'Pester' -and $IsWindows) { + if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) { # special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389 # this only affects windows builds Install-Module @installSplat -SkipPublisherCheck diff --git a/src/Catesta/Resources/Module/plasterManifest.xml b/src/Catesta/Resources/Module/plasterManifest.xml index ae96436..5c506a8 100644 --- a/src/Catesta/Resources/Module/plasterManifest.xml +++ b/src/Catesta/Resources/Module/plasterManifest.xml @@ -19,7 +19,7 @@ Catesta 258a61ba-566b-4c3a-8230-c2b6861a1a8d - 2.20.0 + 2.22.0 Catesta Scaffolds a new PowerShell module project Jake Morrison diff --git a/src/Catesta/Resources/Vault/plasterManifest.xml b/src/Catesta/Resources/Vault/plasterManifest.xml index d42c627..7f9e7c4 100644 --- a/src/Catesta/Resources/Vault/plasterManifest.xml +++ b/src/Catesta/Resources/Vault/plasterManifest.xml @@ -6,7 +6,7 @@ Catesta d531e058-52b8-4dd2-8162-01c95d1eb8f7 - 2.20.0 + 2.22.0 Catesta Scaffolds a new PowerShell SecretManagement extension vault module project Jake Morrison From 972bc33ba2c172b89badc1cc7cb4fe6b918a6a37 Mon Sep 17 00:00:00 2001 From: Jake Morrison Date: Sun, 8 Sep 2024 11:44:09 -0500 Subject: [PATCH 3/3] fixed issue where integ file tests were not running --- docs/CHANGELOG.md | 1 + src/Tests/Integration/FileChecks.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2345fb4..6be9929 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved Windows detection checks for Pester module installation - Catesta primary module changes - Improved Windows detection checks for Pester module installation + - Fixed `FileChecks.Tests.ps1` where certain tests were not being run. ## [2.21.0] diff --git a/src/Tests/Integration/FileChecks.Tests.ps1 b/src/Tests/Integration/FileChecks.Tests.ps1 index 5a10bce..e4a8a42 100644 --- a/src/Tests/Integration/FileChecks.Tests.ps1 +++ b/src/Tests/Integration/FileChecks.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeDiscovery { Set-Location -Path $PSScriptRoot $ModuleName = 'Catesta' $resourcePath1 = [System.IO.Path]::Combine( '..', '..', 'Artifacts', 'Resources')