-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Adding a PSRuleConvention triggers more tests to run #2723
Comments
Thanks for raising your first issue, the team appreciates the time you have taken 😉 |
@ReneRebsdorf Thanks for reporting this. Let me see if I can get a reproduction working, and get back to you, however we know there is some issues that can be observed when using multiple modules (#1215). Noting We are working on providing on a fix with v3 to provide greater isolation between modules, and that's the last major requirement for us to ship v3. In terms of a workaround, I would suggest trying one of the following:
rule:
tag:
release: GA Details are here (https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/rules/Baseline.Rule.yaml)
For you other issue, setting the Hope that helps. |
Hi @BernieWhite We do have CAF_ResourceGroupMandatoryTags in our yaml file Here are the findings from my tests:
Based on the above, it appears there is no solution to have non-preview Azure tests, CAF tests, and a convention specified at the same time, or is there something I am missing? :-) Wrt. Lastly, do you have any guesstimates on when v3 will be GA? My team is eagerly waiting. If relevant we can also look into starting to use v3 and can provide feedback to you, but would need some info wrt. how many breaking changes you are still expecting to introduce inside of v3 (as they likely will affect the stability and amount of maintenance time needed). |
Description of the issue
Hi,
This bug report is a bit strange, and there are probably other ways to reproduce this.
We were debugging why we are somewhat frequently getting the "bicep.exe is missing" error that other issues have been raised regarding.
As part of that process we added this file:
.ps-rule/Debug.Rule.ps1
which has write-host output of PSRULE_AZURE_BICEP_PATH. This works as expected.However, when we added that file (even if we didn't reference the convention in the ps-rule.yaml file), the following tests triggered, flagging problems with our IaC:
If we delete the Debug.Rule.ps1 file, the those tests no longer fail (e.g. they are not ran).
our .ps-rule.yaml file (at root of repo) has requires for PSRule.Rules.Azure, and PSRule.Rules.CAF, they also include both of these under include.module
Of note: When calling Assert-PSRule we provide InputPath (repo to test), Option (the yaml file in the repo to test), but also the Path property, which is a path to a library-repo containing rules we have written to ensure compliance. These rules are processed both with, and without the .ps-rule/ folder, so works as expected.
For reference, the .ps-rule/Debug.Rule.ps1 file content:
How do we ensure the desired tests are ran from third party modules (CAF and Azure), preferably without having to provide a .ps-rule/ folder, as we often do not need it.
I tried to reproduce with adding a .ps-rule/gitkeep file, but that didn't cause the new tests to run, so it appears to be filename or file content dependant.
Error messages
N/A
Reproduction
Version of PSRule
2.9.0
How are you running PSRule
locally with powershell, reproducible in Azure DevOps pipeline
Additional context
No response
The text was updated successfully, but these errors were encountered: