Setting verbosity via environment variable no longer works on 8.0.4.post33+git61228836
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | SNAPCRAFT_VERBOSITY_LEVEL env var support was broken in snapcraft 8.0.4+ due to missing forwarding logic. Resolved and merged in PR #4699, restoring environment variable verbosity configuration. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3958 cli: set default verbosity level with environment variable | snapcraft | merged | Merged. Adds SNAPCRAFT_VERBOSITY_LEVEL env var for default CLI verbosity. Author noted implementation flaws causing duplicate logs and precedence issues, opening craft-cli issue #128 for a proper fix. | |
| #264 Support CRAFT_VERBOSITY_LEVEL | craft-application | closed | Added support for the CRAFT_VERBOSITY_LEVEL environment variable to configure initial verbosity, matching Snapcraft's implementation. The change was merged via pull request #289 in the craft-application repository. | |
| #5646 feat(snapcraft_legacy): support verbosity args | snapcraft | merged | Merged. Implements craft-cli verbosity arguments and environment variable support for core20 commands in snapcraft_legacy, preserving --enable-developer-debug alias. Approved by reviewers and resolves #5423. |