mirror of
https://code.forgejo.org/docker/login-action.git
synced 2025-09-15 18:57:12 +00:00
http_errors_to_retry -> http_codes_to_retry
Signed-off-by: Fedor Dikarev <fedor.dikarev@gmail.com>
This commit is contained in:
parent
1a78bc10dc
commit
75fdabcf85
5 changed files with 9 additions and 9 deletions
|
@ -3,7 +3,7 @@ import * as core from '@actions/core';
|
|||
|
||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||
|
||||
export async function login(registry: string, username: string, password: string, ecr: string, http_errors_to_retry: string[], max_attempts: number, retry_timeout: number): Promise<void> {
|
||||
export async function login(registry: string, username: string, password: string, ecr: string, http_codes_to_retry: string[], max_attempts: number, retry_timeout: number): Promise<void> {
|
||||
let succeeded: boolean = false;
|
||||
for (let attempt = 1; attempt <= max_attempts && !succeeded; attempt++) {
|
||||
try {
|
||||
|
@ -14,7 +14,7 @@ export async function login(registry: string, username: string, password: string
|
|||
}
|
||||
succeeded = true;
|
||||
} catch (error) {
|
||||
if (attempt < max_attempts && isRetriableError(error.message, http_errors_to_retry)) {
|
||||
if (attempt < max_attempts && isRetriableError(error.message, http_codes_to_retry)) {
|
||||
core.info(`Attempt ${attempt} out of ${max_attempts} failed, retrying after ${retry_timeout} seconds`);
|
||||
await new Promise(r => setTimeout(r, retry_timeout * 1000));
|
||||
} else {
|
||||
|
@ -34,8 +34,8 @@ export async function logout(registry: string): Promise<void> {
|
|||
});
|
||||
}
|
||||
|
||||
function isRetriableError(error_message: string, http_errors_to_retry: string[]): boolean {
|
||||
for (const err_code of http_errors_to_retry) {
|
||||
function isRetriableError(error_message: string, http_codes_to_retry: string[]): boolean {
|
||||
for (const err_code of http_codes_to_retry) {
|
||||
if (error_message.includes('failed with status: ' + err_code)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue