Skip to content

ci(snap): build the snap in the snapcraft container instead of LXD - #5893

Merged
SDAChess merged 1 commit into
mainfrom
ci/4554-snap-docker-build/SDAChess
Nov 23, 2026
Merged

SDAChess merged 1 commit into
mainfrom
ci/4554-snap-docker-build/SDAChess

Conversation

@SDAChess

Copy link
Copy Markdown
Contributor

Summary

The CI snap build no longer launches an LXD instance. It runs snapcraft pack in Canonical's ghcr.io/canonical/snapcraft:8_core24 image, on the same runners. LXD first downloads an Ubuntu base image, and that step can hang: in Release Dev run 45155122631, Build snap (Linux amd64) sat at "Creating new base instance from remote" for 49 minutes until it was cancelled. The job normally takes 3–6 minutes. Pre-release builds the snap too, so a hang there blocks publishing.

This supersedes the CI snap build part of #3795 and follows its approach from tests/artifacts.nix. The tmachine snap scenario from #3795 is not carried over, and neither is its git stage-package; snapcraft.yaml is unchanged.

Related Issue

Refs #4554

Changes

  • LXD setup removed: the snapd, LXD and snapcraft install steps are gone.
  • Container build: snapcraft pack runs in ghcr.io/canonical/snapcraft:8_core24, with docker run --platform linux/<arch> on the native runner (ubuntu-24.04 for amd64, ubuntu-24.04-arm for arm64). The image runs snapcraft with SNAPCRAFT_BUILD_ENVIRONMENT=host, so it builds on the container itself, without LXD or multipass, and without prompts.
  • Same staging as test(tmachine): build and test local Snap packages #3795: snapcraft.yaml and snap/ are copied read-only into a Docker volume. Snapcraft packs in the volume, and the .snap and .comp files are copied back to the workspace and chowned to the runner user.
  • Image pin: 8_core24 has moved since test(tmachine): build and test local Snap packages #3795, so this pins the tag's current digest, sha256:f51fc508… (snapcraft 8.14.5). test(tmachine): build and test local Snap packages #3795's digest still resolves but is no longer the tag.
  • Failure logs: snapcraft's log directory, /root/.local/state/snapcraft/log, is bind-mounted to snapcraft-logs/ for the failure upload. The log artifact is now named per architecture, so the two matrix jobs don't collide.
  • Timeout: the pack step has timeout-minutes: 20, so a hang fails fast.

Testing

  • No PR check builds the snap. snap-package.yml is only called from Release Dev and Release Build, so I tested with a temporary workflow on this branch (since dropped). It took the binaries from the dev GitHub release and called the changed snap-package.yml. Run: https://github.com/ai-openshell/openshell/actions/runs/45174868387

    • amd64: the pack step took 39 s and produced openshell_0.1.10-dev.89-g83c0b675a_amd64.snap.
    • arm64: the pack step took 34 s and produced openshell_0.1.10-dev.89-g83c0b675a_arm64.snap.
  • Same output as LXD: the amd64 snap has the same 14 files as the LXD-built snap in the dev release, including the prover, the hooks and the staged ssh. Its meta/snap.yaml differs only in the version.

  • Failure behaviour, checked locally: a failed pack exits non-zero, and its log lands in the bind-mounted directory.

  • Lints: actionlint reports only the existing shellcheck notes in the untouched "Capture snap filename" step, and zizmor only the existing artipacked finding.

  • Checks appropriate to the affected code and behavior pass

  • Unit tests added/updated (if applicable)

  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

The snap build launched an LXD instance, which first downloads its
Ubuntu base image. That download can hang: a Release Dev run sat at
"Creating new base instance from remote" for 49 minutes until it was
cancelled, against the usual 3 to 6 minutes, and Pre-release builds the
snap too.

Build with Canonical's snapcraft image instead, on the same runners.
It runs `snapcraft pack` on the container itself
(SNAPCRAFT_BUILD_ENVIRONMENT=host), so no LXD or snapd setup is needed.
The inputs are copied into a Docker volume, packed there, and the .snap
and .comp files copied back out. Snapcraft's logs are bind-mounted to
the workspace for the failure upload, which is now named per
architecture. The pack step times out after 20 minutes.

Refs #4554

Co-authored-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
@SDAChess
SDAChess requested a review from a team as a code owner November 23, 2026 12:32
@SDAChess
SDAChess requested review from alangou and elezar November 23, 2026 12:32
@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 23, 2026
@SDAChess
SDAChess merged commit c3f429b into main Nov 23, 2026
89 checks passed
@SDAChess
SDAChess deleted the ci/4554-snap-docker-build/SDAChess branch November 23, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants