Skip to content

ci: fix Apptainer install by dropping Launchpad PPA#41

Merged
cokelaer merged 3 commits into
mainfrom
copilot/fix-apptainer-install-workflow
May 1, 2026
Merged

ci: fix Apptainer install by dropping Launchpad PPA#41
cokelaer merged 3 commits into
mainfrom
copilot/fix-apptainer-install-workflow

Conversation

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

add-apt-repository ppa:apptainer/ppa intermittently times out on GitHub-hosted runners, causing flaky CI failures unrelated to the actual test code. Additionally, apptainer is not available in Ubuntu's default apt repositories.

Changes

  • Install path: Replace PPA-based install (software-properties-commonadd-apt-repositoryapt-get install) with a direct download of the .deb from Apptainer's GitHub releases (auto-detecting the latest version), avoiding both the Launchpad network timeout and the missing-package issue. Adds apptainer --version to confirm the install succeeded.
  • Cache cleanup: Remove brittle caching of system directories (/usr/bin/apptainer, /usr/lib/apptainer, /etc/apptainer) and the unused APT archives cache. Retain only ~/.apptainer/cache (user-space image cache, the only part worth caching).
  • Action version: Bump actions/cache@v3actions/cache@v4 to avoid the upcoming Node.js 16 deprecation warning.
# Before
- name: Install Apptainer
  if: steps.cache-apptainer.outputs.cache-hit != 'true'
  run: |
    sudo apt-get update
    sudo apt-get install -y software-properties-common
    sudo add-apt-repository -y ppa:apptainer/ppa   # ← flaky network call
    sudo apt-get update
    sudo apt-get install -y apptainer

# After
- name: Install Apptainer
  run: |
    APPTAINER_VERSION=$(curl -s https://api.github.com/repos/apptainer/apptainer/releases/latest \
      | grep '"tag_name"' | cut -d'"' -f4 | sed 's/v//')
    wget -q "https://github.com/apptainer/apptainer/releases/download/v${APPTAINER_VERSION}/apptainer_${APPTAINER_VERSION}_amd64.deb"
    sudo apt-get install -y "./apptainer_${APPTAINER_VERSION}_amd64.deb"
    apptainer --version
Original prompt

Fix the GitHub Actions workflow that intermittently fails when installing Apptainer.

Context:

  • Workflow: .github/workflows/apptainer.yml
  • Failure occurs during add-apt-repository -y ppa:apptainer/ppa with a network timeout.
  • Goal: Make CI reliable by avoiding the PPA dependency.

Requirements:

  1. Update .github/workflows/apptainer.yml to install Apptainer without using the Launchpad PPA.
    • Prefer installing via Ubuntu’s default apt repositories (sudo apt-get install -y apptainer) and print apptainer --version.
  2. Remove/adjust steps that are only needed for PPA installation (software-properties-common, add-apt-repository).
  3. Keep the rest of the workflow behavior the same (caching, checkout, python setup, tests).
  4. Ensure YAML remains valid and job still runs on ubuntu-latest.

Nice-to-have improvements (do if low-risk):

  • Consider simplifying/removing the cache of /usr/* and /etc/* Apptainer install paths, as caching system directories on hosted runners is brittle; focus caching on ~/.apptainer/cache.
  • Update actions/cache@v3 to actions/cache@v4 to avoid upcoming Node.js runtime deprecation warnings.

Please open a PR with a clear title and description explaining the root cause (PPA network timeout) and the fix (install from default repos; optional cache/action version improvements).

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The job is failing while installing Apptainer, specifically at this line in .github/workflows/apptainer.yml:

  • sudo add-apt-repository -y ppa:apptainer/ppa (line 55 in apptainer.yml at ref 635f0ee25a4b340f30889df7abedba9118bc0909)

The logs show add-apt-repository timing out with a network error:

  • TimeoutError: [Errno 110] Connection timed out

So this is not a Python/test failure; it’s an intermittent external dependency issue (reaching Launchpad to add the PPA).

Solution: stop using the PPA; install Apptainer from Ubuntu packages (most reliable)

On ubuntu-latest, you can usually install Apptainer directly from the default apt repositories. Replace the “Install Apptainer” step with:

    - name: Install Apptainer
      run: |
        sudo apt-get update
        sudo apt-get install -y apptainer
        apptainer --version

And remove the PPA-related lines entirely (software-properties-common and add-apt-repository).

This avoids the Launchpad/PPA dependency that is timing out.

If you must use the PPA: add retries + timeouts (mitigate flakiness)

If you truly need the PPA’s version, keep it but make it robust to transient network failures:

    - name: Install Apptainer (with retries)
      if: steps.cache-apptainer.outputs.cache-hit != 'true'
      run: |
        set -euxo pipefail
        sudo apt-get update
        sudo apt-get install -y software-properties-common

        # Retry adding the PPA (Launchpad can be flaky)
        for i in 1 2 3 4 5; do
          sudo -E add-apt-repository -y ppa:apptainer/ppa && break
          echo "add-apt-repository failed; retry $i/5"
          sleep 10
        done

        sudo apt-get update
        sudo apt-get install -y apptainer
        apptainer --version

Recommended small cleanup (cache step noise)

Your cache step is currently emitting --- ERROR --- around /usr/lib/apptainer and /etc/apptainer (seen in the log excerpt). Even if that isn’t the fatal error here, caching system directories under /usr and /etc is brittle on GitHub runners. Prefer caching only Apptainer’s image cache (~/.apptainer/cache) and reinstalling the package each run, or cache only user-space assets.

In practice, the best fix is: remove the PPA install path and use apt-get install apptainer from Ubuntu repos, which eliminates the timeout entirely.

User: can you create a PR to fix this workflow

Assistant: Yes — I can create a PR for that, but I need one detail first: what repository should I open it against (owner/repo)?

Please reply with the repo in this format, e.g. sequana/fastqc, and (optional) which base branch to target (main or dev).

User: sequana/fastqc

Assistant: I’ve kicked off the pull request creation to update sequana/fastqc’s Apptainer Run workflow to stop using the Launchpad PPA (the timeout source) and install Apptainer from the default Ubuntu apt repositories instead (and, if low-risk, update the caching action version). Please wait while it finishes creating the PR, and I’ll share the PR link and the exact diff next.

This pull request was created from Copilot chat.

@codacy-production

codacy-production Bot commented May 1, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI changed the title [WIP] Fix GitHub Actions workflow for installing Apptainer ci: fix Apptainer install by dropping Launchpad PPA May 1, 2026
Copilot AI requested a review from cokelaer May 1, 2026 18:19
@cokelaer
cokelaer marked this pull request as ready for review May 1, 2026 18:21
@cokelaer

cokelaer commented May 1, 2026

Copy link
Copy Markdown
Contributor

@copilot the apptainer workflow fails with thie error: "E: Unable to locate package apptainer"

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the apptainer workflow fails with thie error: "E: Unable to locate package apptainer"

Fixed in 90a6d4f. apptainer is not in Ubuntu's default apt repos, so apt-get install apptainer fails with "Unable to locate package". The install step now downloads the .deb directly from Apptainer's GitHub releases (auto-detecting the latest version), which sidesteps both the Launchpad PPA timeout and the missing-package issue.

@coveralls

coveralls commented May 1, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 25226991894

Coverage remained the same at 91.667%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 36
Covered Lines: 33
Line Coverage: 91.67%
Coverage Strength: 1.83 hits per line

💛 - Coveralls

key: ${{ runner.os }}-apt-cache-v1

# Cache Apptainer installation
- name: Cache Apptainer install

@cokelaer cokelaer May 1, 2026

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.

@copilot is there nothing on github market place to install apptainer ?

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.

3 participants