File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
.github/actions/get-ecr-scan-result Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 5353 - name : Get AWS ECR Scan results
5454 id : get-scan-results
5555 run : |
56- aws ecr wait image-scan-complete --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG
57- if [ $(echo $?) -eq 0 ]; then
56+ # As the image scan itself may not be started yet, we have to wait (and retry) until it is actually available
57+ max_retries=5
58+ retries=0
59+ scan_complete=1
60+ until [ $retries -eq $max_retries ]; do
61+ aws ecr wait image-scan-complete --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG && scan_complete=0 && break
62+ sleep 5
63+ retries=$((retries + 1))
64+ echo "Retry $retries/$max_retries: Waiting for image scan to start..."
65+ done
66+
67+ if [ $scan_complete -eq 0 ]; then
5868 scan_findings=$(aws ecr describe-image-scan-findings --repository-name $ECR_REPOSITORY --image-id imageTag=$IMAGE_TAG | jq '.imageScanFindings.findingSeverityCounts')
5969 critical=$(echo $scan_findings | jq '.CRITICAL')
6070 high=$(echo $scan_findings | jq '.HIGH')
You can’t perform that action at this time.
0 commit comments