Skip to content
Myr

[actions] never let an apt install wait on a prompt

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Moving WSL package installs out of `setup-wsl`'s `additional-packages` lost its non-interactive setup: on Ubuntu 18.04, upgrading `libssl1.1` asks whether to restart services, and the job waited on that dialog until it was cancelled. Set `DEBIAN_FRONTEND=noninteractive`, keep existing config files without asking, and give apt no stdin.

authored by Jordan Harband · committed by Jordan Harband · parent 50e73c4 · Browse files · 2 files+15 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−7 removed

  • other:+15 added−7 removed

2 files+15 added−7 removed

modified:.github/scripts/apt-install.sh+4 added-1 removed
modified:.github/workflows/windows-nvm.yml+11 added-6 removed
155 unmodified lines
156 - if: ${{ !startsWith(matrix.wsl-distrib, 'Debian') }}157 name: 'Install packages with retries'158 shell: 'wsl-bash {0}'159 run: |160 # never prompt: an upgrade (e.g. libssl asking to restart services) would wait forever161 export DEBIAN_FRONTEND=noninteractive162 attempt=1163 delay=15164 while true; do163 apt-get -o Acquire::Retries=5 update || true164 if apt-get -o Acquire::Retries=5 install --yes bash git curl ca-certificates wget; then165 apt-get -o Acquire::Retries=5 update < /dev/null || true166 if apt-get -o Acquire::Retries=5 -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install --yes bash git curl ca-certificates wget < /dev/null; then167 break168 fi169 if [ "${attempt}" -ge 8 ]; then170 echo "apt-get install failed after ${attempt} attempts" >&2
57 unmodified lines
228 fi229 }230 done231 }232 # never prompt: an upgrade (e.g. libssl asking to restart services) would wait forever233 export DEBIAN_FRONTEND=noninteractive234 packages=(bash git curl ca-certificates wget)231 retry apt-get update || true232 if ! retry apt-get install --yes "${packages[@]}"; then235 install_options=(-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install --yes)236 retry apt-get update < /dev/null || true237 if ! retry apt-get "${install_options[@]}" "${packages[@]}" < /dev/null; then238 # a security index can outlive the pool objects it advertises, which239 # no retry resolves; main is complete once a release is archived240 sed -i '/debian-security/d' /etc/apt/sources.list236 retry apt-get update || true237 retry apt-get install --yes "${packages[@]}"241 retry apt-get update < /dev/null || true242 retry apt-get "${install_options[@]}" "${packages[@]}" < /dev/null243 fi244245 - name: Retrieve nvm on WSL246 run: |
63 unmodified lines