Add resilient checkout command#30
Open
mds1 wants to merge 1 commit into
Open
Conversation
a8bd5f9 to
2b5360f
Compare
bitwiseguy
reviewed
Jun 9, 2026
|
|
||
| repo="${CIRCLE_REPOSITORY_URL:-https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git}" | ||
| case "$repo" in | ||
| git@github.com:*) repo="https://github.com/${repo#git@github.com:}" ;; |
There was a problem hiding this comment.
This SSH-to-HTTPS rewrite changes the auth behavior compared to circleci's built-in checkout. For private repos where CIRCLE_REPOSITORY_URL is SSH, this can turn an authenticated checkout into an anonymous HTTPS fetch. Since circleci's built-in checkout is a special step with integration-specific credential handling, a custom git fetch may not be a drop-in replacement for private repos, especially GitHub App HTTPS pipelines.
circlci checkout docs: https://circleci.com/docs/reference/configuration-reference/#checkout
|
|
||
| delay=$((attempt * 5)) | ||
| echo "git fetch failed on attempt ${attempt}; retrying in ${delay}s..." | ||
| sleep "$delay" |
There was a problem hiding this comment.
Slight improvement: could avoid the sleep here if all 3 attempts failed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recent develop failures happened before tests ran because CircleCI checkout failed with empty checkout metadata or SSH transport errors.
Add a shared
checkout-codecommand that checks outCIRCLE_SHA1over HTTPS with retries and HEAD verification. Updatecheckout-with-miseto reuse it before installing mise.