Skip to content

Commit c269241

Browse files
authored
Merge branch 'main' into vdelev_redis
2 parents 730e048 + 46cc7aa commit c269241

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/actions/get-ecr-scan-result/action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,18 @@ runs:
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')

0 commit comments

Comments
 (0)