cli: warn when running snapcraft inside assets directory
Metadata
Current evaluation
Merged #3379 (commit 54162eb95), adding a CLI warning when Snapcraft runs from snap or build-aux asset directories.
Resolution: closed resolved
Reason: PR #3379 was merged into master as commit 54162eb95. It warns when the current directory is named snap or build-aux, addressing accidental use of a nested snapcraft.yaml.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Because snapcraft will use a snapcraft.yaml in the current directory,
snapcraft may be run inside the assets directory instead of the
expected project directory. This can be a non-obvious error for the
user.
See:
https://forum.snapcraft.io/t/help-with-desktop-file-not-being-primed/21111
This adds a warning if the user is running inside a directory named
"snap" or "build-aux".
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #3379 (commit 54162eb95), adding a CLI warning when Snapcraft runs from snap or build-aux asset directories. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR snapcore/snapcraft#3379 adds a CLI warning when Snapcraft runs inside snap or build-aux, preventing confusing project-context errors. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged into master. Adds a CLI warning when running snapcraft inside snap or build-aux directories to prevent confusing errors from accidental execution in the assets directory. Approved by reviewer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Adds a CLI warning when running snapcraft inside snap or build-aux directories to prevent non-obvious build errors. Passed automated tests and code coverage checks. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3396 snap: address snapcraft warnings for app command | snapcraft | merged | Merged PR #3396 as commit 524dd9811, applying a one-line fix to address Snapcraft warnings for the app command. | |
| #6502 fix: warn when part sources resolve from the parent of a snap directory | snapcraft | open | Adds a warning when snapcraft is run from inside a snap/ directory and part sources resolve from the parent directory, fixing confusing error messages. All CI passing, awaiting review. | |
| #1746403 snapcraft fails to find hooks if ran from snap directory. | snapcraft (launchpad) | open | Running Snapcraft from snap/ can misidentify the assets directory as the project root and omit adjacent hooks; PR #3379 adds a warning, but lookup remains order-based. |