-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2561 from demergent-labs/stable_eyes
stabilize tests
- Loading branch information
Showing
11 changed files
with
114 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 'Command with retries' | ||
description: 'Run any command with exponential backoff retries' | ||
|
||
inputs: | ||
command: | ||
description: 'Command to execute' | ||
required: true | ||
working-directory: | ||
description: 'Directory where to run the command' | ||
required: false | ||
default: '.' | ||
max-attempts: | ||
description: 'Maximum number of retry attempts' | ||
required: false | ||
default: '5' | ||
initial-delay: | ||
description: 'Initial delay in seconds before first retry' | ||
required: false | ||
default: '1' | ||
max-delay: | ||
description: 'Maximum delay in seconds between retries' | ||
required: false | ||
default: '60' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- shell: bash | ||
run: | | ||
attempt=1 | ||
max_attempts=${{ inputs.max-attempts }} | ||
delay=${{ inputs.initial-delay }} | ||
max_delay=${{ inputs.max-delay }} | ||
until cd ${{ inputs.working-directory }} && ${{ inputs.command }}; do | ||
if [ $attempt -ge $max_attempts ]; then | ||
echo "Command failed after $attempt attempts" | ||
exit 1 | ||
fi | ||
attempt=$(($attempt + 1)) | ||
echo "Command failed, retrying in $delay seconds... (attempt $attempt/$max_attempts)" | ||
sleep $delay | ||
# Exponential backoff with a configurable maximum | ||
delay=$(( delay * 2 )) | ||
if [ $delay -gt $max_delay ]; then | ||
delay=$max_delay | ||
fi | ||
done |
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
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
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