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

ci: add psrule validation in both github and ADO #7323

Closed
wants to merge 10 commits into from
21 changes: 21 additions & 0 deletions .azure-pipelines/psruleValidations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

jobs:
- job: 'analyze_arm'
displayName: 'Analyze templates'
pool:
vmImage: 'ubuntu-latest'
steps:

# Install PSRule.Rules.Azure from the PowerShell Gallery
- task: ps-rule-install@2
displayName: Install PSRule.Rules.Azure
inputs:
module: 'PSRule.Rules.Azure' # Install PSRule.Rules.Azure from the PowerShell Gallery.

# Run analysis against exported data
- task: ps-rule-assert@2
displayName: Analyze Azure template files
inputs:
modules: 'PSRule.Rules.Azure' # Analyze objects using the rules within the PSRule.Rules.Azure PowerShell module.
continueOnError: true
21 changes: 21 additions & 0 deletions .github/workflows/psrule-validations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

name: PSRule validation
on:
push:
pull_request:

jobs:
analyze_arm:
name: Analyze ARM templates
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Analyze Azure template files
uses: microsoft/ps-rule@v2.7.0
with:
modules: 'PSRule.Rules.Azure'
continue-on-error: true
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
- template: .azure-pipelines/playbooksValidations.yaml
- template: .azure-pipelines/sampleDataValidator.yaml
- template: .azure-pipelines/contentValidations.yaml
- template: .azure-pipelines/callGithubWorkflow.yaml
- template: .azure-pipelines/callGithubWorkflow.yaml
- template: .azure-pipelines/psruleValidations.yaml
41 changes: 41 additions & 0 deletions ps-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
execution:
invariantCultureWarning: false
input:
pathIgnore:
- .script/tests/detectionTemplateSchemaValidation/ValidConnectorIds.json
- .script/tests/jsonFileValidatorTest/invalidFile.json
- .script/utils/*
- .script/tests/*
- .script/*.ts
- '*.md'
- '*.png'
- '*.jpg'
- '*.yaml'
- '*.txt'
- '*.ps1'
- '*.psd1'
- '*.py'
- '*.liquid'
- '*.sh'
- '*.zip'
- tsconfig.json
- sentinel-deployment.config
- package-lock.json
- package.json
- .codespellignore
- .gitignore
- .secrets.baseline
- .pre-commit-config.yaml
- azure-pipelines.yml
- ps-rule.yaml
- .sentinel-template/*
- .funcignore
- ASIM/dev/ASimTester/*
- ASIM/dev/ASimYaml2ARM/*
- Parsers/ASimAuthentication/ARM/*
- Watchlists/UpdateCloudIPs/AzureFunctionUpdateCloudIPs/UpdateCloudIPs/function.json
- Watchlists/UpdateCloudIPs/AzureFunctionUpdateCloudIPs/host.json
- Watchlists/UpdateCloudIPs/AzureFunctionUpdateCloudIPs/proxies.json
- Watchlists/UpdateCloudIPs/AzureFunctionUpdateCloudIPs/.gitignore
- Watchlists/UpdateCloudIPs/AzureFunctionUpdateCloudIPs/.funcignore