mirror of
https://github.com/hanzoai/pack.git
synced 2026-11-02 13:32:48 +00:00
* refactor: clean up comments regarding version precedence - Remove redundant comments about "last write wins" and version precedence, as the implementation order is clear from the code. - Update the documentation for UseMiseVersions to clarify its role in the overwrite process. Generated-by: aiautocommit * docs: update contribution guidelines and add pull request template - Establish clear "Lifecycle of a Change" guide for developers - Formalize AI contribution policy and developer expectations - Add standard PR template to improve contribution quality and consistency - Refine documentation for local setup, testing, and workflow processes Generated-by: aiautocommit * docs: update contribution guidelines - Improve formatting of links and instructions. - Add instructions to run snapshot updates before finishing work. Generated-by: aiautocommit * feat: add retry-cli and apply to buildkit startup * Add retry-cli via mise to improve CI reliability. * Wrap the buildkit startup command with retry to mitigate transient connection or service availability issues during integration tests. Generated-by: aiautocommit * chore: replace retry-cli with local mise task * Remove external dependency `retry-cli` to reduce toolchain overhead. * Add a custom task script to handle command retries with exponential backoff directly within the project. * Enable `locked` mode in `mise.toml` to ensure consistent environment versions. Generated-by: aiautocommit * chore: disable mise lockfile enforcement * Commented out `locked` in `mise.toml` to allow for dependency updates without constant lockfile synchronization during development. Generated-by: aiautocommit
32 lines
669 B
Bash
Executable File
32 lines
669 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#MISE description="Retry a command with exponential backoff"
|
|
#USAGE flag "--attempts <attempts>" help="Number of attempts" default="3"
|
|
#USAGE arg "<command>" var=#true help="Command to run" double_dash="automatic"
|
|
|
|
set -euo pipefail
|
|
|
|
attempts="${usage_attempts?}"
|
|
delay=1
|
|
|
|
eval "cmd=($usage_command)"
|
|
|
|
if [[ ${#cmd[@]} -eq 0 ]]; then
|
|
echo "Error: command required" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for ((i = 1; i <= attempts; i++)); do
|
|
if "${cmd[@]}"; then
|
|
exit 0
|
|
fi
|
|
|
|
if [[ $i -lt $attempts ]]; then
|
|
echo "failed, retrying..." >&2
|
|
sleep "$delay"
|
|
delay=$((delay * 2))
|
|
fi
|
|
done
|
|
|
|
echo "continued to fail after ${attempts} attempts" >&2
|
|
exit 1
|