From 1e8084f7c5e236feb853bf9f7ab028b7d9365d99 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Tue, 7 Jan 2020 13:37:50 +1300 Subject: [PATCH 1/3] Fix Issue #62 --- CHANGELOG.md | 2 ++ GitVersion.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da34c6b..2501dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 README.md. - WSManListener - Fix Find-Certificate Verbose Messages [Issue #49](https://github.com/dsccommunity/WSManDsc/issues/49). +- Fixed `GitVersion.yml` feature and fix Regex - fixes + [issue #62](https://github.com/PowerShell/WSManDsc/issues/62). ### Security diff --git a/GitVersion.yml b/GitVersion.yml index 938b3c9..f011744 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -13,12 +13,12 @@ branches: feature: tag: useBranchName increment: Minor - regex: f(eature(s)?)?[/-] + regex: f(eature(s)?)?\/-] source-branches: ['master'] hotfix: tag: fix increment: Patch - regex: (hot)?fix(es)?[/-] + regex: (hot)?fix(es)?[\/-] source-branches: ['master'] ignore: From 5d7bd342e23e5bfe6575c328f0c924d86423734c Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Mon, 13 Jan 2020 19:34:42 +1300 Subject: [PATCH 2/3] Fix Deploy Stage and Test Module load --- CHANGELOG.md | 5 +++++ azure-pipelines.yml | 4 ++-- tests/Integration/DSC_WSManConfig.Integration.Tests.ps1 | 2 +- tests/Integration/DSC_WSManListener.Integration.Tests.ps1 | 2 +- .../Integration/DSC_WSManServiceConfig.Integration.Tests.ps1 | 2 +- tests/Unit/DSC_WSManConfig.Tests.ps1 | 2 +- tests/Unit/DSC_WSManListener.Tests.ps1 | 2 +- tests/Unit/DSC_WSManServiceConfig.Tests.ps1 | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2501dcb..521ddcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix Find-Certificate Verbose Messages [Issue #49](https://github.com/dsccommunity/WSManDsc/issues/49). - Fixed `GitVersion.yml` feature and fix Regex - fixes [issue #62](https://github.com/PowerShell/WSManDsc/issues/62). +- Fix import statement in all tests, making sure it throws if module + DscResource.Test cannot be imported - fixes + [issue #67](https://github.com/PowerShell/WSManDsc/issues/67). +- Fix deploy stage in CI pipeline to prevent it executing against forks + of the repository - fixes [issue #66](https://github.com/PowerShell/WSManDsc/issues/66). ### Security diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e683820..f792780 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -142,14 +142,14 @@ stages: - stage: Deploy dependsOn: Test - # Only execute deploy stage if we're on master and previous stage succeeded condition: | and( succeeded(), or( eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/') - ) + ), + startsWith(variables['Build.Repository.Name'], 'dsccommunity') ) jobs: - job: Deploy_Artefact diff --git a/tests/Integration/DSC_WSManConfig.Integration.Tests.ps1 b/tests/Integration/DSC_WSManConfig.Integration.Tests.ps1 index 1ade8e3..3207ddb 100644 --- a/tests/Integration/DSC_WSManConfig.Integration.Tests.ps1 +++ b/tests/Integration/DSC_WSManConfig.Integration.Tests.ps1 @@ -3,7 +3,7 @@ $script:dscResourceName = 'DSC_WSManConfig' $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -Import-Module -Name DscResource.Test -Force +Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` diff --git a/tests/Integration/DSC_WSManListener.Integration.Tests.ps1 b/tests/Integration/DSC_WSManListener.Integration.Tests.ps1 index b8052d5..033a1b8 100644 --- a/tests/Integration/DSC_WSManListener.Integration.Tests.ps1 +++ b/tests/Integration/DSC_WSManListener.Integration.Tests.ps1 @@ -3,7 +3,7 @@ $script:dscResourceName = 'DSC_WSManListener' $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -Import-Module -Name DscResource.Test -Force +Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` diff --git a/tests/Integration/DSC_WSManServiceConfig.Integration.Tests.ps1 b/tests/Integration/DSC_WSManServiceConfig.Integration.Tests.ps1 index 1a97726..aa5a16d 100644 --- a/tests/Integration/DSC_WSManServiceConfig.Integration.Tests.ps1 +++ b/tests/Integration/DSC_WSManServiceConfig.Integration.Tests.ps1 @@ -3,7 +3,7 @@ $script:dscResourceName = 'DSC_WSManServiceConfig' $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) -Import-Module -Name DscResource.Test -Force +Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` diff --git a/tests/Unit/DSC_WSManConfig.Tests.ps1 b/tests/Unit/DSC_WSManConfig.Tests.ps1 index c5673df..a36fcbe 100644 --- a/tests/Unit/DSC_WSManConfig.Tests.ps1 +++ b/tests/Unit/DSC_WSManConfig.Tests.ps1 @@ -7,7 +7,7 @@ $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) function Invoke-TestSetup { - Import-Module -Name DscResource.Test -Force + Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` diff --git a/tests/Unit/DSC_WSManListener.Tests.ps1 b/tests/Unit/DSC_WSManListener.Tests.ps1 index 75f842f..c267098 100644 --- a/tests/Unit/DSC_WSManListener.Tests.ps1 +++ b/tests/Unit/DSC_WSManListener.Tests.ps1 @@ -7,7 +7,7 @@ $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) function Invoke-TestSetup { - Import-Module -Name DscResource.Test -Force + Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` diff --git a/tests/Unit/DSC_WSManServiceConfig.Tests.ps1 b/tests/Unit/DSC_WSManServiceConfig.Tests.ps1 index 36d3d2b..c69162b 100644 --- a/tests/Unit/DSC_WSManServiceConfig.Tests.ps1 +++ b/tests/Unit/DSC_WSManServiceConfig.Tests.ps1 @@ -7,7 +7,7 @@ $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) function Invoke-TestSetup { - Import-Module -Name DscResource.Test -Force + Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` From c0f42e6c3486a5f3034a15aa39d89e9beb506cf0 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Tue, 14 Jan 2020 17:30:22 +1300 Subject: [PATCH 3/3] Changes as per PR comments --- CHANGELOG.md | 8 ++++---- azure-pipelines.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 871b7da..07febef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Set `testRunTitle` for PublishTestResults steps so that a helpful name is displayed in Azure DevOps for each test run. - Set a display name on all the jobs and tasks in the CI - pipeline - fixes [issue #63](https://github.com/PowerShell/WSManDsc/issues/63) + pipeline - fixes [issue #63](https://github.com/dsccommunity/WSManDsc/issues/63) ### Deprecated @@ -50,12 +50,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - WSManListener - Fix Find-Certificate Verbose Messages [Issue #49](https://github.com/dsccommunity/WSManDsc/issues/49). - Fixed `GitVersion.yml` feature and fix Regex - fixes - [issue #62](https://github.com/PowerShell/WSManDsc/issues/62). + [issue #62](https://github.com/dsccommunity/WSManDsc/issues/62). - Fix import statement in all tests, making sure it throws if module DscResource.Test cannot be imported - fixes - [issue #67](https://github.com/PowerShell/WSManDsc/issues/67). + [issue #67](https://github.com/dsccommunity/WSManDsc/issues/67). - Fix deploy stage in CI pipeline to prevent it executing against forks - of the repository - fixes [issue #66](https://github.com/PowerShell/WSManDsc/issues/66). + of the repository - fixes [issue #66](https://github.com/dsccommunity/WSManDsc/issues/66). ### Security diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 402f87c..cf3cbfc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -166,7 +166,7 @@ stages: eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/') ), - startsWith(variables['Build.Repository.Name'], 'dsccommunity') + contains(variables['System.TeamFoundationCollectionUri'], 'dsccommunity') ) jobs: - job: Deploy_Module