Skip to content

Commit

Permalink
fix(es-setup): retry docker pull on "i/o timeout" (#189988)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo authored Aug 6, 2024
1 parent 1cb191f commit d54fc70
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/kbn-es/src/utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ export async function maybeCreateDockerNetwork(log: ToolingLog) {
log.indent(-4);
}

const RETRYABLE_DOCKER_PULL_ERROR_MESSAGES = [
'connection refused',
'i/o timeout',
'Client.Timeout',
];

/**
*
* Pull a Docker image if needed. Ensures latest image.
Expand All @@ -407,8 +413,12 @@ ${message}`;
{
retries: 2,
onFailedAttempt: (error) => {
// Only retry if `connection refused` is found in the error message.
if (!error?.message?.includes('connection refused')) {
// Only retry if retryable error messages are found in the error message.
if (
RETRYABLE_DOCKER_PULL_ERROR_MESSAGES.every(
(msg) => !error?.message?.includes('connection refused')
)
) {
throw error;
}
},
Expand Down

0 comments on commit d54fc70

Please sign in to comment.