Setting verbosity via environment variable no longer works on 8.0.4.post33+git61228836
Metadata
Current evaluation
SNAPCRAFT_VERBOSITY_LEVEL stopped working after the craft-application migration; fixed in snapcraft PR #4699 (commit 283d44301 / merge 2fd361741) by mapping it to CRAFT_VERBOSITY_LEVEL. Reporter confirmed the fix.
Resolution: closed resolved
Reason: PR #4699 'fix(log): map SNAPCRAFT_VERBOSITY_LEVEL to CRAFT' was merged, restoring the env var by forwarding it to CRAFT_VERBOSITY_LEVEL for Craft-based emitters. Maintainer syu-w pointed the reporter to the PR and dilyn-corner confirmed on 2024-03-29 that verbosity via environment variable works again.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
One can set verbosity level either via CLI with a flag `--verbosity=foo` or with a corresponding environment variable `SNAPCRAFT_VERBOSITY_LEVEL=foo`. Doing the latter no longer works, and the default verbosity level is used instead.
Other environment variables seem unaffected (like `SNAPCRAFT_{BUILD_INFO,UA_TOKEN}`).
### To Reproduce
Install `snapcraft` on latest/edge (tested on 10677 (amd64) and 10926 (riscv64))
Set `SNAPCRAFT_VERBOSITY_LEVEL=verbose`
Invoke `snapcraft` for any snap
Using `--verbosity=verbose` works as expected.
The behavior is as expected in my test-cases using latest/stable.
### Environment
Ubuntu ~23.10 on AMD64 and RISCV64. On RISCV64, it's just the simple preinstalled server image for the VisionFive2. In my test cases I was building ubuntu-image and serial-vault-snap.
### snapcraft.yaml
```shell
Any snapcraft.yaml should suffice
```
### Relevant log output
```shell
ubuntu@ubuntu:~/ubuntu-image$ env | grep SNAPCRAFT_VERBOSITY
SNAPCRAFT_VERBOSITY_LEVEL=verbose
ubuntu@ubuntu:~/ubuntu-image$ snapcraft
Attached specified UA token
Detached specified UA token
Generated snap metadata
Generated snap manifest
Lint OK:
- classic: Snap confinement is set to classic.
Lint warnings:
- library: libbrotlienc.so.1: unused library 'usr/lib/riscv64-linux-gnu/libbrotlienc.so.1.0.9'. (https://snapcraft.io/docs/linters-library)
Created snap package ubuntu-image_3.3_riscv64.snap
compare:
ubuntu@ubuntu:~/ubuntu-image$ snapcraft clean; snapcraft --verbosity=verbose
Cleaned build provider
Starting snapcraft
Logging execution to '/home/ubuntu/.local/state/snapcraft/log/snapcraft-20240308-154549.239864.log'
Starting snapcraft
Logging execution to '/home/ubuntu/.local/state/snapcraft/log/snapcraft-20240308-154549.239864.log'
Running on riscv64 for riscv64
Launching instance...
Creating instance from base instance
Starting instance
Starting snapcraft
Logging execution to '/root/.local/state/snapcraft/log/snapcraft-20240308-155237.920470.log'
Starting snapcraft
Logging execution to '/root/.local/state/snapcraft/log/snapcraft-20240308-155237.920470.log'
Running on riscv64 for riscv64
Initializing parts lifecycle
{snip}
Installing build-packages
Installing build-snaps
Pulling ubuntu-image
Fetching stage-packages
Building ubuntu-image
:: + ins_bin=/root/parts/ubuntu-image/install/bin/
:: + mkdir -p /root/parts/ubuntu-image/install/bin/
:: + CGO_ENABLED=0
{snip}
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | SNAPCRAFT_VERBOSITY_LEVEL stopped working after the craft-application migration; fixed in snapcraft PR #4699 (commit 283d44301 / merge 2fd361741) by mapping it to CRAFT_VERBOSITY_LEVEL. Reporter confirmed the fix. | |
| stealth/space-bunny-alpha | — | closed resolved | Restored SNAPCRAFT_VERBOSITY_LEVEL support by mapping it to CRAFT logging. PR canonical/snapcraft#4699 merged as 2fd361741; the reporter confirmed the fix. | |
| qwen/qwen3.6-35b-a3b | — | — | The SNAPCRAFT_VERBOSITY_LEVEL environment variable was ignored because craft-application and snapcraft did not read or forward it. Merging pull request #4699 restored the functionality. The reporter verified the fix. | |
| qwen/qwen3.6-35b-a3b | — | — | snapcraft 8.0.4+ ignored SNAPCRAFT_VERBOSITY_LEVEL due to missing read/forward logic in craft-application and snapcraft. Fixed in pull request #4699, restoring env var support. The reporter verified the fix. | |
| qwen/qwen3.6-35b-a3b | — | — | The SNAPCRAFT_VERBOSITY_LEVEL environment variable stopped working due to missing forwarding in craft-application and Snapcraft. The issue was fixed and merged in pull request #4699, with the resolution verified by the original reporter. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | SNAPCRAFT_VERBOSITY_LEVEL was ignored because craft-application and snapcraft stopped forwarding it. Fixed in pull request #4699, restoring environment variable support for verbosity. Verified by the reporter. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#4699
(confidence 97%)
Merged PR implementing the fix; commit 283d44301 'fix(log): map SNAPCRAFT_VERBOSITY_LEVEL to CRAFT'
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1988065 Default verbosity level should be configurable | snapcraft (launchpad) | closed | Added SNAPCRAFT_VERBOSITY_LEVEL for persistent default output verbosity in snapcraft#3958 (commit 010fd708d). | |
| #3958 cli: set default verbosity level with environment variable | snapcraft | merged | Merged #3958 as commit 010fd708d, adding SNAPCRAFT_VERBOSITY_LEVEL defaults for quiet, brief, verbose, debug, and trace logging. | |
| #4699 fix(log): map SNAPCRAFT_VERBOSITY_LEVEL to CRAFT | snapcraft | merged | Merged PR #4699 as 2fd361741, restoring SNAPCRAFT_VERBOSITY_LEVEL by mapping it to CRAFT_VERBOSITY_LEVEL for Craft-based logging. | |
| #2016662 7.3.1 Error: No such option: --verbosity (Possible options: --verbose, --version) | snapcraft (launchpad) | closed | Legacy (core20) code path rejected --verbosity/--verbose/--quiet. Fixed via canonical/snapcraft#5423: PR #5646 (commit 3aeded2fa) plus follow-up PR #5680 (4a7663069), shipped in Snapcraft 8.11/8.11.1; snapcraft_legacy later removed entirely. |