Trying to use inputPath for ps-rule-assert@2, can't find a part of the path #1095
-
Hi there project maintainers and contributors. Trying to use inputPath instead of repository structure so I am only traversing thru changed files.
I am not able to make this work. Do the PSRule project see any obvious mistakes from my side here? I have seen some various ways to use the inputPath, but I am not sure if this is the correct approach. Running against git diff is great - would really like to make this work. ps-rule.yml
/b |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@bengeset96 There is a few things going on here from what I can tell:
Longer term we would like to provide some support for this type of use case in PSRule, both with documentation and improvements to PSRule to make this easier. We have an issue #688 on the backlog for this feature. We'd love to see some use cases from the community and open the discussion even further. If this is important to you/ your team 👍 the issue and leave any comments that would help us build this feature correctly in the future. In term of addressing the question; underneath the Azure DevOps task, PSRule is built around PowerShell which gives you a lot of flexibility to do something like this. I'd try a command line like this: Install-Module PSRule.Rules.Azure -Scope CurrentUser -Force;
git diff --name-only HEAD^ HEAD | ForEach-Object { Get-ChildItem $_ } | Assert-PSRule -Format File -Module 'PSRule.Rules.Azure' -Baseline 'Azure.GA_2022_03' -OutputFormat NUnit3 -OutputPath 'reports/ps-rule-results.xml' Note: I hope that helps. |
Beta Was this translation helpful? Give feedback.
@bengeset96 There is a few things going on here from what I can tell:
/out/deployments/*.bicep
specifically the/
actually means find this path from the root file system, what doesn't exist. This is what the error is about. Writing it likeout/deployments/*.bicep
is one way to address this. Also you can use the predefined variables available in Azure Pipelines.inputType: repository
configuration. This is just how it currently works. So usinginputType: inputPath
will not work. We have other work that may change this in the medium term around October but it is something that is early in our dev cyc…