← Back to issue list

lifecycle: clean without parsing if possible.

View original Github issue

Metadata

Project
snapcraft
Number
#1007
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Merged in snapcraft#1007 via commit bacf75dfe, allowing full clean operations to bypass snapcraft.yaml parsing unless part-specific cleanup is required.

Resolution: closed resolved

Reason: PR snapcraft#1007 was merged as bacf75dfe. It fixed LP #1596596 by cleaning all lifecycle steps directly when no parts are supplied, allowing cleanup despite invalid YAML.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Currently snapcraft cleans each step of each part individually, even when `clean` is run without any parts or steps. This wastes time parsing YAML, and will even fail to clean if the YAML is invalid. This PR fixes LP: [#1596596](https://bugs.launchpad.net/snapcraft/+bug/1596596) by cleaning smarter; it parses YAML as a last resort. If no parts are supplied, it cleans entire steps.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1007 via commit bacf75dfe, allowing full clean operations to bypass snapcraft.yaml parsing unless part-specific cleanup is required.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#1007 (bacf75dfe), allowing clean without specified parts or steps to skip YAML parsing and work with invalid YAML.
qwen/qwen3.6-35b-a3b — — Merged an optimization that skips YAML parsing during snapcraft clean when no parts or steps are specified, fixing invalid YAML failures and improving performance. Resolved after correcting step argument handling to pass CI tests.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Optimizes snapcraft clean to skip YAML parsing when no parts or steps are specified, resolving LP #1596596 and preventing failures on invalid YAML. A default step argument bug causing CI failures was fixed prior to merge.

Update history

No update history recorded yet.

Related work

Related issues

Issue Project State Summary Similarity
#1578170 Your first snap: snapcraft clean needed before second snapcraft stage snapcraft (launchpad) closed Fixed in canonical/snapcraft#4 by PRs #442–#448 (commits 1a6a21831, 80de92254, 6224553ae, da1411df0): snapcraft.yaml changes now dirty lifecycle steps, avoiding the required manual clean.
74%
#2145 lifecycle: automatically clean dirty steps snapcraft merged Merged in canonical/snapcraft#2145 (commit d033c7d0f), adding opt-in outdated_step_action=clean to rebuild changed lifecycle steps and resolve LP #1774021.
73%
#1796980 Remove cleanbuild snapcraft (launchpad) closed Merged snapcore/snapcraft#2335 as 27ec9ba63, removing LXD lifecycle builds for base-based snaps and making cleanbuild redundant for them.
73%
#1596596 in order to clean, the snapcraft.yaml has to be valid and the parts cache up-to-date snapcraft (launchpad) closed Full-workspace `snapcraft clean` no longer needs a valid snapcraft.yaml or updated parts cache. Fixed by merged snapcore/snapcraft PR #1007 (commit bacf75dfe); maintainer kyrofa pointed to it when closing LP#1596596.
72%
#1537786 lifecycle: allow do clean rebuild of all/parts without having to pull all again snapcraft (launchpad) closed Added per-part, per-step clean commands via merged canonical/snapcraft PR #401 (88d21b180), allowing lifecycle rebuilds without recloning all sources.
71%
#1599957 unnecessary clean on examples tests snapcraft (launchpad) closed Removed the redundant clean before snaps example tests via snapcraft#637 (commit 1a92db54f), speeding tests and reducing hung clean processes.
71%
#1590811 "clean that part" advice doesn't tell you the command to use snapcraft (launchpad) closed Fixed by merged snapcraft#1097 (commit edb56c9b8), which updated lifecycle output to print the command needed to clean a dirty part.
70%
#2577 cli: Add --destructive-mode to clean snapcraft merged Merged in snapcraft#2577 via commit 2d661c723, adding --destructive-mode support to clean so wrapper scripts can pass it to lifecycle commands.
70%
#2143 lifecycle: don't clean priming area if the snap is being tried snapcraft merged Merged PR #2143, fixing snapcraft clean to preserve a priming area used by snap try and avoid requiring another snap try after re-priming.
70%
#2458 clean: error out on invalid or missing yaml snapcraft merged Merged #2458 via commit bf5dbbb3f, making clean fail safely when snapcraft.yaml is missing, invalid, or lacks a project name.
70%