← Back to issue list

SNAPCRAFT_BUILD_ENVIRONMENT apparently takes precedence over "--use-lxd"

View original Github issue

Metadata

Project
snapcraft
Number
#4307
Type
issue
State
closed
Author
ghost
Labels
Created
Updated
Closed

Current evaluation

Fixed via PR #4330. The SNAPCRAFT_BUILD_ENVIRONMENT environment variable no longer overrides the --use-lxd CLI flag. Command line arguments now correctly take precedence over environment variables for build provider selection.

Suggested action:

No scores available.

Issue body

### Bug Description Despite what is printed here, https://snapcraft.io/docs/build-providers, if I set the env var SNAPCRAFT_BUILD_ENVIRONMENT=host, that appears to take priority over using "--use-lxd" on the command line. ### To Reproduce Set env var SNAPCRAFT_BUILD_ENVIRONMENT=host, then try overriding that with "--use-lxd". ### Environment Ubuntu 22.04 ### snapcraft.yaml ```shell Not relevant. ``` ### Relevant log output ```shell Build is done on host in destructive mode. ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Fixed via PR #4330. The SNAPCRAFT_BUILD_ENVIRONMENT environment variable no longer overrides the --use-lxd CLI flag. Command line arguments now correctly take precedence over environment variables for build provider selection.
qwen/qwen3.6-35b-a3b The SNAPCRAFT_BUILD_ENVIRONMENT environment variable incorrectly overriding the --use-lxd CLI flag was confirmed as a bug and resolved by merging pull request #4330.
qwen/qwen3.6-35b-a3b SNAPCRAFT_BUILD_ENVIRONMENT incorrectly overriding --use-lxd was confirmed as a bug and resolved by merging pull request 4330, restoring correct CLI flag precedence.
qwen3.6-35b-a3b-mtp-q6 The SNAPCRAFT_BUILD_ENVIRONMENT variable incorrectly overriding --use-lxd was confirmed as a bug and fixed by merging pull request 4330, which corrected the precedence logic.
qwen3.6-35b-a3b-mtp-q6 The SNAPCRAFT_BUILD_ENVIRONMENT env var incorrectly overrides the --use-lxd CLI flag. Confirmed as a bug. Fixed by merging pull request #4330, which corrects the precedence logic.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#4832 `SNAPCRAFT_BUILD_ENVIRONMENT` takes priority over `--use-lxd` snapcraft open 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.
88%
#4329 cli: prioritize `--use-lxd` over `SNAPCRAFT_BUILD_ENVIRONMENT` snapcraft merged Merged. Prioritizes the --use-lxd CLI argument over the SNAPCRAFT_BUILD_ENVIRONMENT environment variable, resolving issue #4307. Approved by reviewer, passed CI checks, and achieved 100% diff coverage.
82%
#2179 cli: SNAPCRAFT_BUILD_ENVIRONMENT isn't deprecated snapcraft merged Merged into master after approval and CI. Fixed a misleading deprecation warning that incorrectly flagged SNAPCRAFT_BUILD_ENVIRONMENT instead of SNAPCRAFT_CONTAINER_BUILDS. Updated two lines to correct the error message.
72%
#354 Prefer `--use-lxd` over `CRAFT_BUILD_ENVIRONMENT` craft-application open CLI flag --use-lxd is ignored when CRAFT_BUILD_ENVIRONMENT=host is set; _use_provider() in lifecycle.py doesn't check the flag before the env var. Untriaged, no labels or maintainer response; bug still present in current code.
71%