Skip to content

Commit dcc37be

Browse files
committed
Make azdev scan continuing on signle file failure
1 parent 29ed992 commit dcc37be

File tree

4 files changed

+3
-31
lines changed

4 files changed

+3
-31
lines changed

.githooks/pre-commit.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $files = $(git diff --cached --name-only --diff-filter=AM $against)
2626

2727
foreach ($file in $files) {
2828
# Check if the file contains secrets
29-
$detected = $(azdev scan -f $file | ConvertFrom-Json).secrets_detected
29+
$detected = $(azdev scan -f $file --continue-on-failure | ConvertFrom-Json).secrets_detected
3030
if ($detected -eq "True") {
3131
Write-Host "Detected secrets from $file. Please run the following command to mask it:" -ForegroundColor Red
3232
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" -ForegroundColor Red

.githooks/pre-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fi
2222
has_secrets=0
2323
for FILE in `git diff --cached --name-only --diff-filter=AM $against` ; do
2424
# Check if the file contains secrets
25-
detected=$(azdev scan -f "$FILE" | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
25+
detected=$(azdev scan -f "$FILE" --continue-on-failure | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
2626
if [ "$detected" = "True" ]; then
2727
printf "\033[0;31mDetected secrets from %s, Please run the following command to mask it:\033[0m\n" "$FILE"
2828
printf "\033[0;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0m\n"

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ jobs:
11431143
IFS=$'\n'
11441144
for FILE in `git diff --name-only --diff-filter=AM origin/$(System.PullRequest.TargetBranch)` ; do
11451145
echo $FILE
1146-
detected=$(azdev scan -f "$FILE" | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
1146+
detected=$(azdev scan -f "$FILE" --continue-on-failure | python -c "import sys, json; print(json.load(sys.stdin)['secrets_detected'])")
11471147
if [ $detected == 'True' ]; then
11481148
printf "\033[0;31mDetected secrets from %s, You can run 'azdev mask' to remove secrets.\033[0m\n" "$FILE"
11491149
secret_files+=$FILE

scripts/git_hooks/pre-commit

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)