-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(revert): "chore(ci): don't use redirected earthly" (#6062)
This didn't end up causing issues, and is reasonably useful Also uses a check for workflow consistency
- Loading branch information
Showing
3 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# A wrapper for Earthly that is meant to caught signs of known intermittent failures and continue. | ||
# The silver lining is if Earthly does crash, the cache can pick up the build. | ||
set -eu -o pipefail | ||
|
||
# Flag to determine if -i is present | ||
INTERACTIVE=false | ||
# Check for -i flag in the arguments | ||
for arg in "$@"; do | ||
if [ "$arg" == "-i" ] || [ "$arg" == "--interactive" ]; then | ||
INTERACTIVE=true | ||
break | ||
fi | ||
done | ||
|
||
OUTPUT_FILE=$(mktemp) | ||
# capture output to handle earthly edge cases | ||
if $INTERACTIVE ; then | ||
# don't play nice with tee if interactive | ||
earthly $@ | ||
elif ! earthly $@ 2>&1 | tee $OUTPUT_FILE >&2 ; then | ||
# we try earthly once, capturing output | ||
# if we get one of our (unfortunate) known failures, handle retries | ||
# TODO potentially handle other intermittent errors here | ||
if grep 'failed to get edge: inconsistent graph state' $OUTPUT_FILE >/dev/null ; then | ||
# TODO when earthly is overloaded we sometimes get | ||
# 'failed to solve: failed to get edge: inconsistent graph state' | ||
echo "Got 'inconsistent graph state'. Restarting earthly. See https://github.com/earthly/earthly/issues/2454'" | ||
earthly $@ | ||
# TODO handle | ||
# could not configure satellite: failed getting org: unable to authenticate: failed to execute login request: Post | ||
else | ||
# otherwise, propagate error | ||
exit 1 | ||
fi | ||
fi |