add args for retries

Signed-off-by: Fedor Dikarev <fedor.dikarev@gmail.com>
This commit is contained in:
Fedor Dikarev 2025-01-23 02:27:56 +01:00
parent 327cd5a69d
commit 2bc89718bc
5 changed files with 25 additions and 5 deletions

View file

@ -148,7 +148,7 @@ jobs:
> Google Container Registry. As a fully-managed service with support for both
> container images and non-container artifacts. If you currently use Google
> Container Registry, use the information [on this page](https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr)
> to learn about transitioning to Google Artifact Registry.
> to learn about transitioning to Google Artifact Registry.
You can authenticate with workload identity federation or a service account.
@ -421,7 +421,7 @@ must be placed in format `<tenancy>/<username>` (in case of federated tenancy us
For password [create an auth token](https://www.oracle.com/webfolder/technetwork/tutorials/obe/oci/registry/index.html#GetanAuthToken).
Save username and token [as a secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository)
in your GitHub repo.
in your GitHub repo.
```yaml
name: ci
@ -507,6 +507,9 @@ The following inputs can be used as `step.with` keys:
| `password` | String | | Password or personal access token for authenticating the Docker registry |
| `ecr` | String | `auto` | Specifies whether the given registry is ECR (`auto`, `true` or `false`) |
| `logout` | Bool | `true` | Log out from the Docker registry at the end of a job |
| `http_errors_to_retry` | String | `408,500,502,504` | Comma separated list of HTTP error codes we want to retry |
| `max_attempts` | String | `1` | Overall maximum number of attempts we will make trying to login (1 means no retries) |
| `retry_timeout` | String | `15` | Timeout between retries, in seconds |
## Contributing

View file

@ -24,6 +24,17 @@ inputs:
description: 'Log out from the Docker registry at the end of a job'
default: 'true'
required: false
http_errors_to_retry:
description: 'Comma separated list of HTTP error codes we want to retry'
default: '408,500,502,504'
max_attempts:
description: 'Overall maximum number of attempts we will make trying to login'
default: '1'
required: false
retry_timeout:
description: 'Timeout between retries, in seconds'
default: '15'
required: false
runs:
using: 'node20'

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -6,6 +6,9 @@ export interface Inputs {
password: string;
ecr: string;
logout: boolean;
http_errors_to_retry: string[];
max_attempts: number;
retry_timeout: number;
}
export function getInputs(): Inputs {
@ -14,6 +17,9 @@ export function getInputs(): Inputs {
username: core.getInput('username'),
password: core.getInput('password'),
ecr: core.getInput('ecr'),
logout: core.getBooleanInput('logout')
logout: core.getBooleanInput('logout'),
http_errors_to_retry: core.getInput('http_errors_to_retry').split(','),
max_attempts: Number.parseInt(core.getInput('max_attempts')),
retry_timeout: Number.parseInt(core.getInput('retry_timeout'))
};
}