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

[Hackaton] First test for PSRule exclusions on KeyVault #2067

Merged
merged 8 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ms.keyvault.vaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ jobs:
modulePath: '${{ env.modulePath }}'
moduleTestFilePath: '${{ env.moduleTestFilePath }}'

job_psrule_test:
name: 'PsRule Analyze repository'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}

# Run analysis by using the PSRule GitHub action.
- name: Run PSRule analysis
uses: microsoft/ps-rule@v2.4.0
with:
modules: 'PSRule.Rules.Azure'
inputPath: '${{ env.modulePath }}/'

#############################
# Deployment validation #
#############################
Expand Down
40 changes: 22 additions & 18 deletions ps-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
binding:
preferTargetInfo: true
targetType:
- type
- resourceType
- type
- resourceType

# Require minimum versions of modules.
requires:
Expand All @@ -21,37 +21,41 @@ requires:
# Use PSRule for Azure.
include:
module:
- PSRule.Rules.Azure
- PSRule.Rules.Azure

output:
culture:
- 'en-US'
- 'en-US'

input:
pathIgnore:
# Ignore other files in the repository.
- '.vscode/'
- '.github/'
- '*.md'

# Ignore other files in the repository.
- '.vscode/'
- '.github/'
- '*.md'

# Exclude modules but not tests.
- 'modules/**/*.bicep'
- '!modules/**/*.test.bicep'
# Exclude modules but not tests.
- 'modules/**/*.bicep'
- '!modules/**/*.test.bicep'
- 'modules/**/*version.json'

configuration:
# Enable automatic expansion of Azure parameter files.
AZURE_PARAMETER_FILE_EXPANSION: true
AZURE_PARAMETER_FILE_EXPANSION: false

# Enable automatic expansion of Azure Bicep source files.
AZURE_BICEP_FILE_EXPANSION: true

# Configures the number of seconds to wait for build Bicep files.
AZURE_BICEP_FILE_EXPANSION_TIMEOUT: 10

rule:
# Enable custom rules that don't exist in the baseline
includeLocal: false
exclude:
# Ignore the following rules for all resources
- Azure.KeyVault.PurgeProtect
# Suppression ignores rules for a specific Azure resource by name.
# suppression:
# Azure.KeyVault.Logs:
# - kvtest001
# Azure.Storage.BlobPublicAccess:
# - sttest001
suppression:
Azure.Resource.UseTags:
- <<namePrefix>>kvvmin001