Skip to content
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

[PSRule] Run PSRule pre-flight validation on diff (PR check) #2150

Open
Tracked by #2149
eriqua opened this issue Sep 29, 2022 · 4 comments
Open
Tracked by #2149

[PSRule] Run PSRule pre-flight validation on diff (PR check) #2150

eriqua opened this issue Sep 29, 2022 · 4 comments
Labels
[cat] github category: GitHub [cat] pipelines category: pipelines [cat] testing category: testing enhancement New feature or request

Comments

@eriqua
Copy link
Contributor

eriqua commented Sep 29, 2022

CARML already has linter and broken links checks running when pull requests are open. The check is not blocking for the PR to be merged.

Note: pull_requests trigger works only for PRs opened from branches, not from forks.

This issue is about extending the PR checks to also run PSRule pre-flight validation on diff (on the code changed by the PR).
As a first step, the suggestion is to keep the check non-blocking, allowing PRs to be merged even if they fail PSRule checks.

PR #2094 hosts a PoC running on the whole library. That should be updated to run only on diff.

Collect feedback on the PR and agree on possible missing implementation before merge.

@eriqua eriqua added enhancement New feature or request [cat] testing category: testing [cat] needs further discussion labels Sep 29, 2022
@eriqua eriqua changed the title Run PSRule pre-flight validation on PRs Run PSRule pre-flight validation on diff (PR check) Dec 10, 2022
@eriqua eriqua changed the title Run PSRule pre-flight validation on diff (PR check) [PSRule] Run PSRule pre-flight validation on diff (PR check) Dec 10, 2022
@eriqua eriqua added [cat] pipelines category: pipelines [cat] github category: GitHub and removed [cat] needs further discussion labels Dec 10, 2022
@eriqua
Copy link
Contributor Author

eriqua commented Dec 10, 2022

Suggestion: Move to todo, but wait for #2425 completion.
Meanwhile research on how to run PSRule on diff only

@eriqua
Copy link
Contributor Author

eriqua commented Feb 19, 2023

To run PSRule on changed files only ref https://github.com/microsoft/PSRule/blob/main/docs/concepts/PSRule/en-US/about_PSRule_Options.md#inputignoreunchangedpath

# GitHub Actions: Using environment variable
env:
  PSRULE_INPUT_IGNOREUNCHANGEDPATH: true


Ref also microsoft/PSRule#688

@eriqua
Copy link
Contributor Author

eriqua commented Apr 1, 2023

Enabling the option results anyway in a check on the whole repository. This may be due to the token replacement logic, actually changing the files we're supposed to ignore. This needs to be double checked.
If confirmed, we should implement a logic that 1. first retrieves changed files, then 2. applies token replacement, then 3. runs psrule only on diff retrieved by step 1

@BernieWhite
Copy link

@eriqua Happy to take feedback on this if you can provide more details here or offline.

@AlexanderSehr AlexanderSehr added this to the Azure Verfified Modules (AVM) - V3 milestone May 19, 2024
@AlexanderSehr AlexanderSehr removed this from the Azure Verfified Modules (AVM) - CI Issues milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[cat] github category: GitHub [cat] pipelines category: pipelines [cat] testing category: testing enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

3 participants