Build Snapd Snap
Developmentbuild-snapd-snapBuild 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
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
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
| Flag | When to use | Build time |
|---|---|---|
--clean-snapd-only | Default. Go code changes (cmd/, daemon/, overlord/, interfaces/) | 1-2 min |
| (no flags) | Non-snapd parts changed: apparmor, dynamic-linker, runtime, build-aux/snap/ scripts | Several min |
--no-clean | Rapid 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-spreadlooks for the snap inbuilt-snap/- Set
NO_REBUILD=1to skip rebuilding when snap already exists - See
run-spread-testskill for running tests