From c4d11d0a1ec30c1ec9491a349abfc08c5dfd49bd Mon Sep 17 00:00:00 2001 From: Fedor Dikarev Date: Thu, 23 Jan 2025 16:51:59 +0100 Subject: [PATCH] kebab-case for action inputs, fix README, fix comments in retry tests Signed-off-by: Fedor Dikarev --- README.md | 20 ++++++++++---------- __tests__/retries_fail.test.ts | 3 ++- __tests__/retries_success.test.ts | 2 ++ action.yml | 6 +++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 246091c..6d41111 100644 --- a/README.md +++ b/README.md @@ -500,16 +500,16 @@ jobs: The following inputs can be used as `step.with` keys: -| Name | Type | Default | Description | -|------------|--------|---------|-------------------------------------------------------------------------------| -| `registry` | String | | Server address of Docker registry. If not set then will default to Docker Hub | -| `username` | String | | Username for authenticating to the Docker registry | -| `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_codes_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 | +| Name | Type | Default | Description | +|-----------------------|--------|---------|-------------------------------------------------------------------------------| +| `registry` | String | | Server address of Docker registry. If not set then will default to Docker Hub | +| `username` | String | | Username for authenticating to the Docker registry | +| `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-codes-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 could make (`1` means no retries) | +| `retry-timeout` | String | `15` | Timeout between retries, in seconds | ## Contributing diff --git a/__tests__/retries_fail.test.ts b/__tests__/retries_fail.test.ts index 29ea9c9..3c0fa2b 100644 --- a/__tests__/retries_fail.test.ts +++ b/__tests__/retries_fail.test.ts @@ -9,7 +9,8 @@ test('login retries function', async () => { let stderr_strings: string[] = []; let call_count: number = -1; - // const execSpy = jest.spyOn(Docker, 'getExecOutput').mockImplementation(async () => { + // using spyOn() here isn't enough, as we alter the logic + // so use `jest.fn()` here for the `Docker.getExecOutput` Docker.getExecOutput = jest.fn(async () => { call_count++; console.log(`Mock: ${call_count}, ${stderr_strings}`); diff --git a/__tests__/retries_success.test.ts b/__tests__/retries_success.test.ts index 98102a2..9e42c66 100644 --- a/__tests__/retries_success.test.ts +++ b/__tests__/retries_success.test.ts @@ -7,6 +7,8 @@ test('login retries success function', async () => { let stderr_strings: string[] = []; let call_count: number = -1; + // using spyOn() here isn't enough, as we alter the logic + // so use `jest.fn()` here for the `Docker.getExecOutput` Docker.getExecOutput = jest.fn(async () => { call_count++; console.log(`Mock: ${call_count}, ${stderr_strings}`); diff --git a/action.yml b/action.yml index 532b6ad..500e4ea 100644 --- a/action.yml +++ b/action.yml @@ -24,14 +24,14 @@ inputs: description: 'Log out from the Docker registry at the end of a job' default: 'true' required: false - http_codes_to_retry: + http-codes-to-retry: description: 'Comma separated list of HTTP error codes we want to retry' default: '408,500,502,504' - max_attempts: + max-attempts: description: 'Overall maximum number of attempts we will make trying to login' default: '1' required: false - retry_timeout: + retry-timeout: description: 'Timeout between retries, in seconds' default: '15' required: false