Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ alias:
values:
ScanImageAndSchedulePatchTask: cssc-scan-image
cssc : mcr.microsoft.com/acr/cssc:0995fb8
maxLimit: 100
steps:
- cmd: bash -c 'echo "Inside cssc-trigger-workflow task, getting list of images to be patched based on --filter-policy for Registry {{.Run.Registry}}."'
- cmd: cssc acr cssc patch --filter-policy csscpolicies/patchpolicy:v1 --dry-run > filterRepos.txt
env:
- ACR_EXPERIMENTAL_CSSC=true
- cmd: bash -c 'sed -n "/^Validating/,/^Total/ {/^Validating/b;/^Total/b;p}" filterRepos.txt' > filterReposToDisplay.txt
- cmd: bash -c 'echo -e "Below images will be scanned and patched (if any os vulnerabilities found) based on --filter-policy.\n$(cat filterReposToDisplay.txt)"'
- cmd: |
bash -c '
echo "Below images will be scanned and patched (if any os vulnerabilities found) based on --filter-policy.\n$(cat filterReposToDisplay.txt)"
totalImages=$(sed -n "s/^Matches found://p" filterReposToDisplay.txt | tr -d "[:space:]")
if [ $totalImages -gt $maxLimit ]; then
echo "Maximum $maxLimit images can be scheduled for continuous patching. Adjust the filter to limit the number of images to be patched. Exiting the workflow.."
Comment thread
Ruchii-27 marked this conversation as resolved.
exit 1
fi'
- cmd: cssc acr cssc patch --filter-policy csscpolicies/patchpolicy:v1 --show-patch-tags --dry-run> filterReposWithPatchTags.txt
env:
- ACR_EXPERIMENTAL_CSSC=true
Expand Down
13 changes: 10 additions & 3 deletions src/acrcssc/azext_acrcssc/templates/tmp_dry_run_template.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
version: v1.1.0
alias:
values:
cssc : mcr.microsoft.com/acr/cssc:56f0765
cssc : mcr.microsoft.com/acr/cssc:0995fb8
maxLimit: 100
steps:
- id: acr-cli-filter
cmd: |
cssc acr cssc patch --dry-run --filter-policy-file {{.Values.CONFIGPATH}}
cmd: cssc acr cssc patch --dry-run --filter-policy-file {{.Values.CONFIGPATH}}> filterRepos.txt;
env:
- ACR_EXPERIMENTAL_CSSC=true
- cmd: |
bash -c '
echo "$(cat filterRepos.txt)"
totalImages=$(sed -n "s/^Matches found://p" filterRepos.txt | tr -d "[:space:]")
if [ $totalImages -gt $maxLimit ]; then
echo "Maximum $maxLimit images can be scheduled for continuous patching. Adjust the filter to limit the number of images to be patched."
fi'