Skip to content

CI: Pre-install apt dependencies in setup action to prevent hangs#655

Merged
mmathieum merged 5 commits into
masterfrom
copilot/fix-apt-get-stuck-issue
Apr 10, 2026
Merged

CI: Pre-install apt dependencies in setup action to prevent hangs#655
mmathieum merged 5 commits into
masterfrom
copilot/fix-apt-get-stuck-issue

Conversation

Copilot AI commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

The MT code sync step could hang or run very slowly because requireCommand() in commons.sh lazily invokes apt-get on demand mid-step. Pre-installing all known dependencies upfront eliminates these blocking calls.

Changes

  • shared-overwrite/.github/actions/setup/action.yml: Added a new MT install apt dependencies step immediately before MT code sync that eagerly installs all required packages, with a 5-minute timeout per command, --no-install-recommends, a 5-second pause, and automatic retry on failure or timeout:
- name: MT install apt dependencies
  shell: bash
  run: |
    max_attempts=2
    for attempt in $(seq 1 ${max_attempts}); do
      echo "[MT] > Installing apt dependencies (attempt ${attempt}/${max_attempts})..."
      if timeout 300 sudo apt-get update && timeout 300 sudo apt-get install -y --no-install-recommends libxml2-utils jq inkscape imagemagick; then
        echo "[MT] > apt dependencies installed successfully."
        break
      elif [[ ${attempt} -lt ${max_attempts} ]]; then
        echo "[MT] > apt dependencies installation failed or timed out, retrying in 5 seconds..."
        sleep 5
      else
        echo "[MT] > apt dependencies installation failed after ${attempt} attempts."
        exit 1
      fi
    done

The step runs unconditionally — these packages are needed by all repos regardless of whether code-sync is enabled, so subsequent requireCommand() calls will find them already present and skip the apt-get invocation entirely. Each apt-get command is capped at 5 minutes (timeout 300), --no-install-recommends keeps the install lean, and the whole install waits 5 seconds then retries once automatically before failing the step.

Copilot Bot linked an issue Apr 9, 2026 that may be closed by this pull request
Copilot Bot changed the title [WIP] Fix CI setup action hanging during apt-get install CI: Pre-install apt dependencies in setup action to prevent hangs Apr 9, 2026
Copilot Bot requested a review from mmathieum April 9, 2026 23:39
Comment thread shared-overwrite/.github/actions/setup/action.yml Outdated
Comment thread shared-overwrite/.github/actions/setup/action.yml Outdated
Comment thread shared-overwrite/.github/actions/setup/action.yml Outdated
Copilot Bot requested a review from mmathieum April 10, 2026 14:22
@mmathieum mmathieum marked this pull request as ready for review April 10, 2026 15:07

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a retry mechanism for installing apt dependencies within the setup action. The review feedback suggests enhancing the installation command with non-interactive environment variables and Dpkg options to prevent the CI process from stalling on configuration prompts.

Comment thread shared-overwrite/.github/actions/setup/action.yml Outdated
@mmathieum

Copy link
Copy Markdown
Member

@mmathieum mmathieum merged commit 9bf0db6 into master Apr 10, 2026
@mmathieum mmathieum deleted the copilot/fix-apt-get-stuck-issue branch April 10, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: setup action can be stuck during by apt-get

2 participants