Is it possible to register modules with "dotnet tool" too and run them with dotnet tool run ps-rule run? #1857
-
If I install https://www.nuget.org/packages/Microsoft.PSRule.Tool as a local tool, create a ps-rule.yaml, should it be possible to use modules like https://www.nuget.org/packages/Microsoft.PSRule.Rules.Azure/1.37.0 from the dotnet tool without using PowerShell to install the modules? It looks to me the answer is 'no', but I thought to to open this in case someone else is looking into this and so have one place where there is a definite answer to that. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @veikkoeeva , thanks for the question. In short no, rules modules still require installation via PowerShell. Rules can be created within the local repository and these wouldn't require installation. Today in PSRule v2.9.0, this is manual. In v3, a restore command will restore any modules based on a lock file automatically or the manual command can be used. The intent is a similar behaviour to You can try the v3 pre-release today. See:
However if you have feedback or a specific challange you are trying to overcome please let me know. |
Beta Was this translation helpful? Give feedback.
-
@BernieWhite Thank's for the quick and very helpful answer. I hadn't notice those pieces you linked. Taking a cue from then, I think what I'm after is Which results to...
Maybe one way could be to able to define in the yaml file what modules would be automatically loaded and installed. Basically the reason for this is to keep thins in the "dotnet tool" flow both locally and elsewhere. So make it very little friction for developer other than to clone a repo, run the tool to check things. I do not know how feasible this is eventually, but now we have this quite nicely documented here for anyone interested. :) |
Beta Was this translation helpful? Give feedback.
Absolutely. Keeping in the flow is where we want to go. I think the
Find-Module
exception is probably a bug relating to some missing dependencies. But you should be able to run that commanddotnet tool run ps-rule module add PSRule.Rules.Azure
to add the module into the lock file then rundotnet tool run ps-rule run
to execute analysis.The lock file specifically deals with pinning and automatically installation of modules which you could not do easily in previous versions.
However, regardless of the lock file you can use the
ps-rule.yaml
to configure required modules that will be loaded and installed.Then
dotnet tool run ps-rule module restore
and