Commit 3656c90 1 parent 945056a commit 3656c90 Copy full SHA for 3656c90
File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 10
10
types : [trivy-scan-dispatch]
11
11
12
12
jobs :
13
+ wait-for-image :
14
+ runs-on : ubuntu-latest
15
+ outputs :
16
+ image-available : ${{ steps.check-image.outputs.available }}
17
+ steps :
18
+ - name : Check Docker image availability with retry
19
+ run : |
20
+ image="ghcr.io/${{ github.repository_owner }}/${{ github.event.client_payload.image }}:${{ github.event.client_payload.sha }}"
21
+ timeout=900 # Timeout in seconds (15 minutes)
22
+ interval=300 # Interval between retries in seconds (5 minutes)
23
+ retry_limit=5 # Number of retries
24
+ attempt=0
25
+
26
+ while ! docker pull $image; do
27
+ attempt=$((attempt + 1))
28
+ if [ "$attempt" -gt "$retry_limit" ]; then
29
+ echo "Image $image is not available after $retry_limit attempts."
30
+ echo "::set-output name=available::false"
31
+ exit 1
32
+ fi
33
+
34
+ echo "Attempt $attempt: Waiting for $image to be available. Retrying in $interval seconds..."
35
+ sleep $interval
36
+ done
37
+
38
+ echo "$image is now available."
39
+ echo "::set-output name=available::true"
40
+ shell : bash
41
+
13
42
trivy_scan_image :
43
+ needs : wait-for-image
44
+ if : needs.wait-for-image.outputs.image-available == 'true'
14
45
runs-on : ubuntu-latest
15
46
strategy :
16
47
matrix :
You can’t perform that action at this time.
0 commit comments