OpenParable
Skip to content
← Back to skills

Build Snapd Snap

Development
build-snapd-snap

Build Snapd Snap is an Agent Skill for development published in the canonical/snapd repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Build the snapd snap artifact for testing using ./tests/build-test-snapd-snap

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/canonical/snapd/blob/HEAD/.agents/skills/build-snapd-snap/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/build-snapd-snap, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Build the snapd snap

Command: ./tests/build-test-snapd-snap [OPTIONS] Output: built-snap/snapd_*.snap.keep (~30-40 MB)

When to build

Build when snapd code or snap packaging changed. Skip when only test files (tests/lib/, tests/unit/) changed — use ./run-spread --download or NO_REBUILD=1 instead.

Options

FlagWhen to useBuild time
--clean-snapd-onlyDefault. Go code changes (cmd/, daemon/, overlord/, interfaces/)1-2 min
(no flags)Non-snapd parts changed: apparmor, dynamic-linker, runtime, build-aux/snap/ scriptsSeveral min
--no-cleanRapid iteration, confident no deps changed. May produce incorrect builds.<1 min

--clean-snapd-only rebuilds only the snapd part from build-aux/snap/snapcraft.yaml, preserving all other parts (apparmor, dynamic-linker, runtime, patchelf, squashfs-tools, libcrypto-fips).

Use full clean (no flags) only when certain that non-snapd parts need rebuilding.

Verification

ls -lh built-snap/snapd_*.snap.keep

Integration with spread

  • run-spread looks for the snap in built-snap/
  • Set NO_REBUILD=1 to skip rebuilding when snap already exists
  • See run-spread-test skill for running tests