File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 55
55
- name: Set up Docker Buildx
56
56
uses: docker/setup-buildx-action@v1
57
57
- name: Pull Testing Tool docker image
58
- run: docker pull airbyte/airbyte-e2e-testing-tool:latest
58
+ run: ./tools/bin/pull_image.sh -i airbyte/airbyte-e2e-testing-tool:latest
59
59
- name: Create input and output folders
60
60
run: |
61
61
mkdir secrets
@@ -104,7 +104,7 @@ jobs:
104
104
- name: Set up Docker Buildx
105
105
uses: docker/setup-buildx-action@v1
106
106
- name: Pull Testing Tool docker image
107
- run: docker pull airbyte/airbyte-e2e-testing-tool:latest
107
+ run: ./tools/bin/pull_image.sh -i airbyte/airbyte-e2e-testing-tool:latest
108
108
- name: Change wrapper permissions
109
109
run: |
110
110
mkdir secrets
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env bash
2
+
3
+ retries=3
4
+
5
+ function pull_dockerhub_image_with_retries() {
6
+ local image=$1
7
+ local retries=$2
8
+
9
+ for (( i=1; i<=$retries; i++ )); do
10
+ docker pull $image
11
+ # NOTE: this does not discriminate on the failure, any failure will retry
12
+ test "$?" -eq 0 && return || echo "Docker pull failed, sleeping for 5 seconds before retrying ($i/$retries)" && sleep 5
13
+ done
14
+ }
15
+
16
+ function main() {
17
+ while getopts ':i:r:' OPTION; do
18
+ case "$OPTION" in
19
+ i)
20
+ image="$OPTARG"
21
+ ;;
22
+ r)
23
+ if [[ "$OPTARG" =~ ^(-)?[0-9]+$ ]]; then
24
+ retries="$OPTARG"
25
+ else
26
+ echo "retries (-r) must be a number" && exit 1
27
+ fi
28
+ ;;
29
+ ?)
30
+ echo "script usage: $(basename "$0") [-i image] [-r retries]" >&2
31
+ exit 1
32
+ ;;
33
+ esac
34
+ done
35
+ shift "$(($OPTIND -1))"
36
+
37
+ pull_dockerhub_image_with_retries $image $retries
38
+ }
39
+
40
+ main "$@"
41
+
42
+
You can’t perform that action at this time.
0 commit comments