-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f116a8
commit dea2bb2
Showing
6 changed files
with
71 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,15 @@ Within the root directory of your IaC repository: | |
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Analyze Azure resources using PSRule for Azure | ||
- name: Analyze Azure template files | ||
uses: microsoft/[email protected] | ||
with: | ||
modules: 'PSRule.Rules.Azure' | ||
# Checkout the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Run PSRule | ||
- name: Analyze with PSRule | ||
uses: microsoft/[email protected] | ||
with: | ||
modules: PSRule.Rules.Azure | ||
``` | ||
|
||
This will automatically install compatible versions of all dependencies. | ||
|
@@ -42,12 +43,14 @@ Within the root directory of your IaC repository: | |
```yaml | ||
steps: | ||
|
||
# Analyze Azure resources using PSRule for Azure | ||
- task: ps-rule-assert@2 | ||
displayName: Analyze Azure template files | ||
inputs: | ||
inputType: repository | ||
modules: 'PSRule.Rules.Azure' | ||
# Checkout the repository | ||
- checkout: self | ||
|
||
# Run PSRule | ||
- task: ps-rule-assert@3 | ||
displayName: Analyze with PSRule | ||
inputs: | ||
modules: PSRule.Rules.Azure | ||
``` | ||
|
||
This will automatically install compatible versions of all dependencies. | ||
|
@@ -138,6 +141,9 @@ To prevent a rule executing you can either: | |
Meaningful comments help during peer review within a Pull Request (PR). | ||
Also consider including a date if the exclusions or suppressions are temporary. | ||
|
||
[3]: concepts/PSRule/en-US/about_PSRule_Options.md#ruleexclude | ||
[4]: concepts/PSRule/en-US/about_PSRule_Options.md#suppression | ||
[5]: concepts/PSRule/en-US/about_PSRule_SuppressionGroups.md | ||
[6]: addon-modules.md | ||
[7]: authoring/packaging-rules.md | ||
|
||
|
@@ -146,6 +152,7 @@ To prevent a rule executing you can either: | |
:octicons-milestone-24: v2.5.0 · [:octicons-book-24: Docs][8] | ||
|
||
To only process files that have changed within a pull request, set the `Input.IgnoreUnchangedPath` option. | ||
This option does not work with a shallow or detached checkout, full git history is required for comparison. | ||
|
||
=== "GitHub Actions" | ||
|
||
|
@@ -161,35 +168,53 @@ To only process files that have changed within a pull request, set the `Input.Ig | |
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Analyze Azure resources using PSRule for Azure | ||
- name: Analyze Azure template files | ||
uses: microsoft/[email protected] | ||
with: | ||
modules: 'PSRule.Rules.Azure' | ||
env: | ||
PSRULE_INPUT_IGNOREUNCHANGEDPATH: true | ||
# Checkout the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # (1) | ||
|
||
# Run PSRule | ||
- name: Analyze with PSRule | ||
uses: microsoft/[email protected] | ||
with: | ||
modules: PSRule.Rules.Azure | ||
env: | ||
PSRULE_INPUT_IGNOREUNCHANGEDPATH: true # (2) | ||
``` | ||
|
||
<div class="result" markdown> | ||
1. Checkout the repository with full history. By default, GitHub Actions will only fetch the latest commit. | ||
2. Enable processing of changed files only. | ||
|
||
</div> | ||
|
||
=== "Azure Pipelines" | ||
|
||
Update your Azure DevOps YAML pipeline by setting the `PSRULE_INPUT_IGNOREUNCHANGEDPATH` environment variable. | ||
|
||
```yaml title=".azure-pipelines/analyze-arm.yaml" | ||
steps: | ||
|
||
# Analyze Azure resources using PSRule for Azure | ||
- task: ps-rule-assert@2 | ||
displayName: Analyze Azure template files | ||
inputs: | ||
inputType: repository | ||
modules: 'PSRule.Rules.Azure' | ||
env: | ||
PSRULE_INPUT_IGNOREUNCHANGEDPATH: true | ||
# Checkout the repository | ||
- checkout: self | ||
fetchDepth: 0 # (1) | ||
|
||
# Run PSRule | ||
- task: ps-rule-assert@3 | ||
displayName: Analyze with PSRule | ||
inputs: | ||
modules: PSRule.Rules.Azure | ||
env: | ||
PSRULE_INPUT_IGNOREUNCHANGEDPATH: true # (2) | ||
``` | ||
|
||
<div class="result" markdown> | ||
1. Checkout the repository with full history. By default, Azure Pipelines will only fetch the latest commit. | ||
2. Enable processing of changed files only. | ||
|
||
</div> | ||
|
||
=== "Generic with PowerShell" | ||
|
||
Update your PowerShell command-line to include the `Input.IgnoreUnchangedPath` option. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters