Closed eriqua closed 1 year ago
hack/topic6
, linked to this issue.<<namePrefix>>
is seen as an intended parameter value and normally not compliant with any resource name.
ps-rule.yaml
. Here we can ignore specific files/patterns, add exclusion of specific rules, add suppression of specific rules for specific resources. Tested in the KeyVault workflow. Start collecting possible feedback to discuss with the PSRule team:
WARNING: Target object 'modules/Microsoft.Resources/resourceGroups/.test/common/deploy.test.bicep' has not been processed because no matching rules were found.
although the file is then checked successfullyExample: Multiple
ps-rule.yaml
files can be created and placed in specific folders (e.g. root/module/test scope) and specified in a relative path using workflow variables. We should anyway aim for as less configuration files as possible, leveraging tokens or wildcards (see next point)
ps-rule.yaml
setting file) to skip specific rules on specific resources. Ref SuppressionGroups
Example: Resource names containing
min
are the ones specifying only the required set of parameters. They will likely fail on rules suggesting the use of tags for all resources.
ps-rule.yaml
file: #2070 Example: skip Azure.KeyVault.*
Example format markdown output content to outline failed tests, suppressions, passed tests and count for each category, similar to Pester output Check also this blog page https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/getting-started-with-testing-infrastructure-code/ba-p/1500276
Example: suppress rule warning
Ref #2094 running on pull request
Ref Vnet run workflow
Failing rules and target resources before adding suppression groups:
Logs show a WARNING: Target object 'modules/Microsoft.Resources/resourceGroups/.test/common/deploy.test.bicep' has not been processed because no matching rules were found. although the file is then checked successfully
Currently this is by design, although we are aware that it is a common point of confusion and may change this behvaiour for PSRule v3. microsoft/PSRule#1179
However you can disable this warning by setting Execution.NotProcessedWarning
.
PSRule VSC extension: cannot be used due to tokenized parameters.
Interested in finding more about this one.
SuppressionGroups do not allow the use of wildcards for rule names Example: skip Azure.KeyVault.*
Interested in more detail about this or a feature request.
Can be closed in favor of #2151 . Next steps such as the ADO extension should be adressed seperatly as we're blocked until that becomes available.
Description
Leveraging this issue as a starting point for a PoC to integrate PSRule with the CARML CI environment pipelines. The goal is to enable and test it for at least 3 modules already converted to the new dependencies approach (see issue #1791)
Workstreams and goals
Pre-flight - Test before resources are deployed from templates.
The goals of this workstream are:
Stretch goals
Cross platform
Custom rules
In-flight
References