Родитель
f123e87fdd
Коммит
8bec63d0f0
|
@ -1,6 +1,9 @@
|
|||
# Change log
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Added default baseline to module. [#126](https://github.com/BernieWhite/PSRule.Rules.Azure/issues/126)
|
||||
|
||||
## v0.4.0-B190902 (pre-release)
|
||||
|
||||
- Added rule to verify connectivity of VNET peers. [#120](https://github.com/BernieWhite/PSRule.Rules.Azure/issues/120)
|
||||
|
|
|
@ -63,7 +63,7 @@ function CopyModuleFiles {
|
|||
process {
|
||||
$sourcePath = Resolve-Path -Path $Path;
|
||||
|
||||
Get-ChildItem -Path $sourcePath -Recurse -File -Include *.ps1,*.psm1,*.psd1,*.ps1xml | Where-Object -FilterScript {
|
||||
Get-ChildItem -Path $sourcePath -Recurse -File -Include *.ps1,*.psm1,*.psd1,*.ps1xml,*.yaml | Where-Object -FilterScript {
|
||||
($_.FullName -notmatch '(\.(cs|csproj)|(\\|\/)(obj|bin))')
|
||||
} | ForEach-Object -Process {
|
||||
$filePath = $_.FullName.Replace($sourcePath, $destinationPath);
|
||||
|
@ -108,6 +108,9 @@ task VersionModule ModuleDependencies, {
|
|||
}
|
||||
};
|
||||
Update-ModuleManifest -Path $manifestPath -RequiredModules $requiredModules;
|
||||
$manifestContent = Get-Content -Path $manifestPath -Raw;
|
||||
$manifestContent = $manifestContent -replace 'PSRule = ''System.Collections.Hashtable''', 'PSRule = @{ Baseline = ''Azure.SubscriptionDefault'' }';
|
||||
$manifestContent | Set-Content -Path $manifestPath;
|
||||
}
|
||||
|
||||
# Synopsis: Publish to PowerShell Gallery
|
||||
|
|
|
@ -112,7 +112,7 @@ PrivateData = @{
|
|||
ReleaseNotes = 'https://github.com/BernieWhite/PSRule.Rules.Azure/blob/master/CHANGELOG.md'
|
||||
} # End of PSData hashtable
|
||||
PSRule = @{
|
||||
Baseline = 'DefaultBaseline'
|
||||
Baseline = 'Azure.SubscriptionDefault'
|
||||
}
|
||||
} # End of PrivateData hashtable
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
---
|
||||
# Synopsis: Default baseline for Azure rules
|
||||
kind: Baseline
|
||||
metadata:
|
||||
name: DefaultBaseline
|
||||
name: Azure.SubscriptionDefault
|
||||
spec:
|
||||
binding:
|
||||
targetType:
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# Unit tests for baselines
|
||||
#
|
||||
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
|
||||
)
|
||||
|
||||
# Setup error handling
|
||||
$ErrorActionPreference = 'Stop';
|
||||
Set-StrictMode -Version latest;
|
||||
|
||||
if ($Env:SYSTEM_DEBUG -eq 'true') {
|
||||
$VerbosePreference = 'Continue';
|
||||
}
|
||||
|
||||
# Setup tests paths
|
||||
$rootPath = $PWD;
|
||||
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSRule.Rules.Azure) -Force;
|
||||
$here = (Resolve-Path $PSScriptRoot).Path;
|
||||
|
||||
Describe 'Baselines' -Tag Baseline {
|
||||
$dataPath = Join-Path -Path $here -ChildPath 'Resources.Resource.json';
|
||||
|
||||
Context 'Binding' {
|
||||
$result = Invoke-PSRule -Module PSRule.Rules.Azure -Outcome All -InputPath $dataPath -WarningAction Ignore -ErrorAction Stop;
|
||||
|
||||
It 'TargetType' {
|
||||
$result.TargetType | Should -Not -BeIn 'System.Management.Automation.PSCustomObject';
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче