CircleCI-Public / gcp-cli-orb

Install and configure the Google Cloud CLI (gcloud)
https://circleci.com/orbs/registry/orb/circleci/gcp-cli
MIT License
9 stars 32 forks source link

feat: retry download when decompression fails #75

Closed EricRibeiro closed 1 year ago

EricRibeiro commented 1 year ago

Checklist

Motivation, issues

This PR closes #70 by addressing an issue where the Google Cloud SDK installation fails with an error related to a corrupt tar archive. This problem prevents users from successfully installing and using the Google Cloud SDK in their projects.

Description

This PR modifies the installation script to introduce two new functions, download_and_extract() and download_with_retry(). These functions improve the process of downloading and extracting the Google Cloud SDK tar file by implementing retries when download failures occur.

The download_and_extract() function is responsible for downloading the tar file and extracting it to the specified installation directory. The download_with_retry() function wraps around the download_and_extract() function and retries the download process up to three times if a failure occurs.

These new functions are utilized in the installation script to improve the reliability of the installation process, reducing the chances of encountering the "unexpected end of file" error during Google Cloud SDK installation.

The updated script also includes additional error handling and messages to provide clearer feedback to the user in case of any issues during the installation process.