mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-21 15:10:27 +00:00
Retry on bash startup failure on Windows
This commit is contained in:
2
.github/.cspell/project-dictionary.txt
vendored
2
.github/.cspell/project-dictionary.txt
vendored
@@ -17,6 +17,7 @@ grcov
|
|||||||
gungraun
|
gungraun
|
||||||
insta
|
insta
|
||||||
knope
|
knope
|
||||||
|
LASTEXITCODE
|
||||||
libicu
|
libicu
|
||||||
linkcheck
|
linkcheck
|
||||||
mdbook
|
mdbook
|
||||||
@@ -38,6 +39,7 @@ sigstore
|
|||||||
syft
|
syft
|
||||||
tombi
|
tombi
|
||||||
udeps
|
udeps
|
||||||
|
USERPROFILE
|
||||||
wasmtime
|
wasmtime
|
||||||
watchexec
|
watchexec
|
||||||
worktree
|
worktree
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Implement workaround for [windows-11-arm runner bug](https://github.com/actions/partner-runner-images/issues/169) which sometimes causes installation failure. ([#1657](https://github.com/taiki-e/install-action/pull/1657))
|
||||||
|
|
||||||
|
This addresses an issue that was attempted to be worked around in 2.71.0 but was insufficient.
|
||||||
|
|
||||||
- Update `mise@latest` to 2026.4.1.
|
- Update `mise@latest` to 2026.4.1.
|
||||||
|
|
||||||
- Update `uv@latest` to 0.11.3.
|
- Update `uv@latest` to 0.11.3.
|
||||||
|
|||||||
22
action.yml
22
action.yml
@@ -52,12 +52,26 @@ runs:
|
|||||||
DEFAULT_GITHUB_TOKEN: ${{ github.token }}
|
DEFAULT_GITHUB_TOKEN: ${{ github.token }}
|
||||||
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
ACTION_USER_AGENT: ${{ github.action_repository }} (${{ github.action_ref }})
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
# Workaround for https://github.com/actions/partner-runner-images/issues/169
|
# Use pwsh and retry on bash startup failure to work around windows-11-arm runner bug: https://github.com/actions/partner-runner-images/issues/169
|
||||||
# TODO: Is it necessary to retry for main.sh call? Or is this sufficient? https://github.com/taiki-e/install-action/pull/1647
|
|
||||||
- run: |
|
- run: |
|
||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$action_path = $env:GITHUB_ACTION_PATH
|
for ($i=1; $i -le 10; $i++) {
|
||||||
& bash --noprofile --norc "${action_path}/main.sh"
|
$prev_err_action = $ErrorActionPreference
|
||||||
|
$ErrorActionPreference = "Continue"
|
||||||
|
& bash --noprofile --norc "$env:GITHUB_ACTION_PATH/main.sh"
|
||||||
|
$code = $LASTEXITCODE
|
||||||
|
$ErrorActionPreference = "$prev_err_action"
|
||||||
|
if (Test-Path "$env:USERPROFILE\.install-action\init") {
|
||||||
|
# If bash started successfully, main.sh creates init file.
|
||||||
|
Remove-Item "$env:USERPROFILE\.install-action\init" -Force
|
||||||
|
exit $code
|
||||||
|
}
|
||||||
|
if ($i -lt 10) {
|
||||||
|
Write-Output "::warning::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); retrying..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Output "::error::installation failed due to bash startup failure (<https://github.com/actions/partner-runner-images/issues/169>); this maybe resolved by re-running job"
|
||||||
|
exit 1
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
# NB: Sync with non-Windows case.
|
# NB: Sync with non-Windows case.
|
||||||
|
|||||||
83
main.sh
83
main.sh
@@ -436,46 +436,6 @@ canonicalize_windows_path() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# cargo-binstall may call `cargo install` on their fallback: https://github.com/taiki-e/install-action/pull/54#issuecomment-1383140833
|
|
||||||
# cross calls rustup on `cross --version` if the current directly is cargo workspace.
|
|
||||||
export CARGO_NET_RETRY=10
|
|
||||||
export RUSTUP_MAX_RETRIES=10
|
|
||||||
|
|
||||||
if [[ $# -gt 0 ]]; then
|
|
||||||
bail "invalid argument '$1'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
manifest_dir="$(dirname -- "$0")/manifests"
|
|
||||||
|
|
||||||
# Inputs
|
|
||||||
tool="${INPUT_TOOL:-}"
|
|
||||||
tools=()
|
|
||||||
if [[ -n "${tool}" ]]; then
|
|
||||||
while read -rd,; do
|
|
||||||
tools+=("${REPLY}")
|
|
||||||
done < <(normalize_comma_or_space_separated "${tool}")
|
|
||||||
fi
|
|
||||||
if [[ ${#tools[@]} -eq 0 ]]; then
|
|
||||||
warn "no tool specified; this could be caused by a dependabot bug where @<tool_name> tags on this action are replaced by @<version> tags"
|
|
||||||
# Exit with 0 for backward compatibility.
|
|
||||||
# TODO: We want to reject it in the next major release.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
enable_checksum="${INPUT_CHECKSUM:-}"
|
|
||||||
case "${enable_checksum}" in
|
|
||||||
true) ;;
|
|
||||||
false) enable_checksum='' ;;
|
|
||||||
*) bail "'checksum' input option must be 'true' or 'false': '${enable_checksum}'" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
fallback="${INPUT_FALLBACK:-}"
|
|
||||||
case "${fallback}" in
|
|
||||||
none | cargo-binstall | cargo-install) ;;
|
|
||||||
*) bail "'fallback' input option must be 'none', 'cargo-binstall', or 'cargo-install': '${fallback}'" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Refs: https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh
|
# Refs: https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh
|
||||||
base_distro=''
|
base_distro=''
|
||||||
exe=''
|
exe=''
|
||||||
@@ -590,6 +550,9 @@ cargo_bin="${CARGO_HOME:-"${home}/.cargo"}/bin"
|
|||||||
# is used ($CARGO_HOME/bin is most likely not included in the PATH), fallback to
|
# is used ($CARGO_HOME/bin is most likely not included in the PATH), fallback to
|
||||||
# $install_action_dir/bin.
|
# $install_action_dir/bin.
|
||||||
if [[ "${host_os}" == "windows" ]]; then
|
if [[ "${host_os}" == "windows" ]]; then
|
||||||
|
mkdir -p -- "${install_action_dir}"
|
||||||
|
# See action.yml.
|
||||||
|
touch -- "${install_action_dir}"/init
|
||||||
if type -P cargo >/dev/null; then
|
if type -P cargo >/dev/null; then
|
||||||
info "cargo is located at $(type -P cargo)"
|
info "cargo is located at $(type -P cargo)"
|
||||||
cargo_bin=$(dirname -- "$(type -P cargo)")
|
cargo_bin=$(dirname -- "$(type -P cargo)")
|
||||||
@@ -604,6 +567,46 @@ elif [[ ! -e "${cargo_bin}" ]] || [[ "$(type -P cargo || true)" != "${cargo_bin}
|
|||||||
cargo_bin="${install_action_dir}/bin"
|
cargo_bin="${install_action_dir}/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# cargo-binstall may call `cargo install` on their fallback: https://github.com/taiki-e/install-action/pull/54#issuecomment-1383140833
|
||||||
|
# cross calls rustup on `cross --version` if the current directly is cargo workspace.
|
||||||
|
export CARGO_NET_RETRY=10
|
||||||
|
export RUSTUP_MAX_RETRIES=10
|
||||||
|
|
||||||
|
if [[ $# -gt 0 ]]; then
|
||||||
|
bail "invalid argument '$1'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
manifest_dir="$(dirname -- "$0")/manifests"
|
||||||
|
|
||||||
|
# Inputs
|
||||||
|
tool="${INPUT_TOOL:-}"
|
||||||
|
tools=()
|
||||||
|
if [[ -n "${tool}" ]]; then
|
||||||
|
while read -rd,; do
|
||||||
|
tools+=("${REPLY}")
|
||||||
|
done < <(normalize_comma_or_space_separated "${tool}")
|
||||||
|
fi
|
||||||
|
if [[ ${#tools[@]} -eq 0 ]]; then
|
||||||
|
warn "no tool specified; this could be caused by a dependabot bug where @<tool_name> tags on this action are replaced by @<version> tags"
|
||||||
|
# Exit with 0 for backward compatibility.
|
||||||
|
# TODO: We want to reject it in the next major release.
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
enable_checksum="${INPUT_CHECKSUM:-}"
|
||||||
|
case "${enable_checksum}" in
|
||||||
|
true) ;;
|
||||||
|
false) enable_checksum='' ;;
|
||||||
|
*) bail "'checksum' input option must be 'true' or 'false': '${enable_checksum}'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
fallback="${INPUT_FALLBACK:-}"
|
||||||
|
case "${fallback}" in
|
||||||
|
none | cargo-binstall | cargo-install) ;;
|
||||||
|
*) bail "'fallback' input option must be 'none', 'cargo-binstall', or 'cargo-install': '${fallback}'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
linux)
|
linux)
|
||||||
if ! type -P jq >/dev/null || ! type -P curl >/dev/null || ! type -P tar >/dev/null; then
|
if ! type -P jq >/dev/null || ! type -P curl >/dev/null || ! type -P tar >/dev/null; then
|
||||||
|
|||||||
Reference in New Issue
Block a user