Skip to content

Commit 7d1bab3

Browse files
authored
Add retries for downloading the TCC (#12)
1 parent a4a8631 commit 7d1bab3

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ jobs:
4848
- `logfile` (_optional_): `string` - file to write the agent output instead of the standard out.
4949
- `action` (_optional_): `prepare` (default) / `terminate` - action could be specified explicitly to terminate sessions eagerly.
5050
- `project-key` (_optional_): `GITHUB_REPOSITORY` (default) - project identifier
51-
- `project-url` (_optional_): `GITHUB_SERVER_URL/GITHUB_REPOSITORY` (default) - project's url
51+
- `project-url` (_optional_): `GITHUB_SERVER_URL/GITHUB_REPOSITORY` (default) - project's url
52+
- `download-retries` (_optional_): `1` (default) - number of retry attempts to download Testcontainers Cloud Client before giving up.

action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
project-url:
3030
description: 'Project URL'
3131
required: false
32+
download-retries:
33+
description: 'The number of retry attempts to download Testcontainers Cloud Client before giving up'
34+
required: false
35+
default: '1'
3236
runs:
3337
using: 'composite'
3438
steps:
@@ -65,6 +69,7 @@ runs:
6569
TC_CLOUD_TOKEN: ${{ inputs.token || env.TC_CLOUD_TOKEN }}
6670
TC_CLOUD_LOGS_ENABLE_COLORS: 'true'
6771
TCC_BINARY_NAME: ${{ env.TCC_BINARY_NAME || 'tcc-agent' }}
72+
DOWNLOAD_RETRIES: ${{ inputs.download-retries }}
6873
if: inputs.action == 'prepare'
6974
run: |
7075
# download and run the agent at the background
@@ -88,7 +93,7 @@ runs:
8893
8994
# fetch the latest TCC agent version and make it executable
9095
echo "Downloading ${LATEST_BINARY_URL}"
91-
curl -fsSL -o "${TCC_BINARY_NAME}" "${LATEST_BINARY_URL}"
96+
curl -fsSL -o "${TCC_BINARY_NAME}" "${LATEST_BINARY_URL}" --retry "${DOWNLOAD_RETRIES}" --retry-all-errors
9297
chmod +x ${TCC_BINARY_NAME}
9398
9499
# start agent as background process
@@ -119,4 +124,4 @@ runs:
119124
TCC_BINARY_NAME: ${{ env.TCC_BINARY_NAME || 'tcc-agent' }}
120125
run: |
121126
# Terminating active sessions
122-
./"${TCC_BINARY_NAME}" terminate
127+
./"${TCC_BINARY_NAME}" terminate

0 commit comments

Comments
 (0)