-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
Hi there project maintainers and contributors.
Trying to use inputPath instead of repository structure so I am only traversing thru changed files.
- task: Bash@3
displayName: "Diff"
inputs:
targetType: "inline"
script: |
if [ ! -z "$(git diff --name-status HEAD^ HEAD)" ]; then
echo $(git diff --name-status HEAD^ HEAD)
git diff --name-status HEAD^ HEAD > /tmp/diff.txt
if [ ! -z "$(git diff --diff-filter=D HEAD^ HEAD --no-renames)" ]; then
echo $(git diff --diff-filter=D HEAD^ HEAD --no-prefix --no-renames | grep ^- | sed -r "s/^([^-+ ]*)[-+ ]/\\1/" | less -r)
git diff --diff-filter=D HEAD^ HEAD --no-prefix --no-renames | grep ^- | sed -r "s/^([^-+ ]*)[-+ ]/\\1/" | less -r >
/tmp/diffdeletedfiles.txt
$filename = Get-Content /tmp/diff.txt
$filename | ForEach-Object { Copy-Item -Path $_ -Destination '/out/deployments' }
fi
else
echo "The CI/CD validation pipeline failed because there is currently no change to be processed"
exit 1
fi
- task: ps-rule-install@2
inputs:
module: PSRule.Rules.Azure
- task: ps-rule-assert@2
continueOnError: true
inputs:
inputType: inputPath
inputPath: '/out/deployments/*.bicep'
modules: PSRule.Rules.Azure .
baseline: Azure.GA_2022_03
outputFormat: NUnit3
outputPath: reports/ps-rule-results.xml
I am not able to make this work. Do the PSRule project see any obvious mistakes from my side here?
I have seen some various ways to use the inputPath, but I am not sure if this is the correct approach.
Running against git diff is great - would really like to make this work.
ps-rule.yml
# Use rules from the following modules/
include:
module:
- "PSRule.Rules.Azure"
# Require a minimum version of modules that include referenced baseline.
requires:
PSRule.Rules.Azure: "@pre >=1.15.2"
execution:
# Ignore warnings for resources and objects that don't have any rules.
notProcessedWarning: false
configuration:
# Enable expansion for Bicep source files.
AZURE_BICEP_FILE_EXPANSION: true
# Expand Bicep module from Azure parameter files.
AZURE_PARAMETER_FILE_EXPANSION: true
# Set timeout for expanding Bicep source files.
AZURE_BICEP_FILE_EXPANSION_TIMEOUT: 15
input:
pathIgnore:
# Ignore common files that don't need analysis.
- "**/bicepconfig.json"
- "*.md"
- "*.png"
- ".pipelines/"
# Include deployment files.
# - "!out/deployments/**/*.bicep"
rule:
exclude:
# Ignore these recommendations for this repo.
- Azure.Resource.UseTags
- Azure.ACR.ContentTrust
/b
Metadata
Metadata
Assignees
Labels
No labels
