← Back to issue list

`SNAPCRAFT_BUILD_ENVIRONMENT` takes priority over `--use-lxd`

View original Github issue

Metadata

Project
snapcraft
Number
#4832
Type
issue
State
open
Author
mr-cal
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Triaged bug: PR #4329 fixed core22 precedence for SNAPCRAFT_BUILD_ENVIRONMENT, but core24 remains unverified and its spread test is restricted to Ubuntu 22.04; CRAFT_MANAGED_MODE precedence is intentional.

Suggested action: keep open

Reason: PR #4329 landed as commit 7f8d4cff9 and the current get_provider() code gives an explicit provider argument precedence over SNAPCRAFT_BUILD_ENVIRONMENT, so the core22 path is addressed. The dedicated tests/spread/providers/use-lxd/task.yaml test is still limited to Ubuntu 22.04 because it says core24 snaps fail and links this issue; without core24 logs or an isolated reproduction, it remains unclear whether the remaining failure is the environment-variable path, while the maintainer explicitly says CRAFT_MANAGED_MODE is correct.

Evaluated by: mr-cal-bot

Impact: 42 Quick Win: 16 Complexity: 50 Confidence: 89 Actionability: 74

Issue body

### Bug Description `CRAFT_MANAGED_MODE` and `SNAPCRAFT_BUILD_ENVIRONMENT` take priority over `--use-lxd` See https://github.com/canonical/craft-application/issues/354 ### To Reproduce ```shell SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft pack --use-lxd CRAFT_MANAGED_MODE=1 snapcraft pack --use-lxd ``` ### Environment n/a ### snapcraft.yaml ```shell n/a ``` ### Relevant log output ```shell n/a ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 42
Quick Win: 16
Complexity: 50
Confidence: 89
Actionability: 74
keep open Triaged bug: PR #4329 fixed core22 precedence for SNAPCRAFT_BUILD_ENVIRONMENT, but core24 remains unverified and its spread test is restricted to Ubuntu 22.04; CRAFT_MANAGED_MODE precedence is intentional.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 19
Complexity: 20
Confidence: 90
Actionability: 80
close resolved SNAPCRAFT_BUILD_ENVIRONMENT overrides --use-lxd CLI flag. Fixed by PR #4329 (commit 7f8d4cff9) but issue remains open.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 36
Staleness: 55
Complexity: 20
Confidence: 85
Support Request: 5
close stale SNAPCRAFT_BUILD_ENVIRONMENT was overriding the --use-lxd CLI flag; CRAFT_MANAGED_MODE precedence is intended per maintainer. Fixed by merged PR #4329 (commit 7f8d4cff9) which prioritizes the flag; issue remains open and can be closed.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 30
Confidence: 85
Support Request: 5
keep open SNAPCRAFT_BUILD_ENVIRONMENT incorrectly overrides the --use-lxd CLI flag during snapcraft pack. Issue is triaged and acknowledged by a maintainer, awaiting a fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 30
Confidence: 85
Support Request: 5
keep open Environment variables CRAFT_MANAGED_MODE and SNAPCRAFT_BUILD_ENVIRONMENT incorrectly override the --use-lxd CLI flag. Triaged bug, last discussed in May 2024 with maintainer clarification.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-application#354 (confidence 95%)

    The issue body explicitly links the upstream CRAFT_BUILD_ENVIRONMENT precedence discussion.

  • Likely Fixed By: snapcraft#4329 (confidence 92%)

    Merged PR #4329 changed --use-lxd precedence and landed as commit 7f8d4cff9, addressing the core22 provider path.

  • Related To: snapcraft#4307 (confidence 90%)

    Earlier report describes the same precedence problem and is recorded as resolved by PR #4329.

Related issues

Issue Project State Summary Similarity
#4307 SNAPCRAFT_BUILD_ENVIRONMENT apparently takes precedence over "--use-lxd" snapcraft closed Fixed by merged PR #4329 (commit 7f8d4cff9): --use-lxd now overrides SNAPCRAFT_BUILD_ENVIRONMENT, matching documented precedence.
84%
#4329 cli: prioritize `--use-lxd` over `SNAPCRAFT_BUILD_ENVIRONMENT` snapcraft merged Merged PR #4329 (commit 7f8d4cff9) fixes #4307: get_provider() now checks the CLI --use-lxd argument before SNAPCRAFT_BUILD_ENVIRONMENT, matching documented priority.
79%
#354 Prefer `--use-lxd` over `CRAFT_BUILD_ENVIRONMENT` craft-application closed Fixed in PR #1229 by updating _use_provider to check --use-lxd before CRAFT_BUILD_ENVIRONMENT, ensuring CLI flags take priority.
72%
#4610 [core24] Non-core24 runs in managed mode are not being correctly logged snapcraft closed Fixed managed-mode detection by consistently using SNAPCRAFT_MANAGED_MODE, restoring LXD log discovery. Merged in canonical/snapcraft#4638 (187777a36).
71%