← Back to issue list

Prefer `--use-lxd` over `CRAFT_BUILD_ENVIRONMENT`

View original Github issue

Metadata

Project
craft-application
Number
#354
Type
issue
State
closed
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in PR #1229 by updating _use_provider to check --use-lxd before CRAFT_BUILD_ENVIRONMENT, ensuring CLI flags take priority.

Resolution: closed resolved

Reason: The issue was resolved by merged PR #1229, which adds a check for the --use-lxd flag before evaluating CRAFT_BUILD_ENVIRONMENT in the _use_provider function, ensuring command line arguments take priority over environment variables.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### What needs to get done [This function](https://github.com/canonical/craft-application/blob/a39b3cd6a3ee43eaf505988c57cc4d7618029c19/craft_application/commands/lifecycle.py#L93) needs to check if `--use-lxd` was provided. ### Why it needs to get done The following commands will run locally, rather than in a container: ```shell CRAFT_BUILD_ENVIRONMENT=host testcraft pack --use-lxd # for core24 snaps SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft pack --use-lxd ``` This is wrong because command line arguments should take priority over environment variables

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b — closed resolved Fixed in PR #1229 by updating _use_provider to check --use-lxd before CRAFT_BUILD_ENVIRONMENT, ensuring CLI flags take priority.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 45
Complexity: 20
Confidence: 85
Actionability: 80
keep open Issue #354: _use_provider checks CRAFT_BUILD_ENVIRONMENT before --use-lxd flag. PR #1229 addresses this fix but is still open awaiting review.
stealth/space-bunny-alpha
Impact: 48
Quick Win: 36
Complexity: 18
Confidence: 96
Actionability: 92
needs triage `--use-lxd` is still ignored when `CRAFT_BUILD_ENVIRONMENT=host`; the current provider-selection code gives the environment variable precedence.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 45
Complexity: 20
Confidence: 85
Actionability: 80
keep open Bug: `--use-lxd` CLI flag is ignored when `CRAFT_BUILD_ENVIRONMENT=host` env var is set. CLI args should take priority over env vars.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 32
Staleness: 80
Complexity: 30
Confidence: 75
Support Request: 10
needs triage 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.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 40
Confidence: 75
Support Request: 10
close stale Issue requests prioritizing `--use-lxd` CLI flag over `CRAFT_BUILD_ENVIRONMENT` env var for local vs container execution. Currently inactive for over a year, awaiting triage/implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
Support Request: 0
needs triage Bug where --use-lxd CLI flag fails to override CRAFT_BUILD_ENVIRONMENT=host, causing commands to run locally instead of in LXD. Currently untriaged and inactive for over a year.

Update history

Date Change
closed
updated
updated

Related work

  • Likely Fixed By: craft-application#1229 (confidence 100%)

    PR #1229 directly addresses the issue by checking --use-lxd before CRAFT_BUILD_ENVIRONMENT in _use_provider.

Related issues

Issue Project State Summary Similarity
#1229 fix(lifecycle): prefer --use-lxd over CRAFT_BUILD_ENVIRONMENT craft-application merged Merged PR #1229 fixes #354 by making --use-lxd override CRAFT_BUILD_ENVIRONMENT=host to force managed mode in _use_provider, with updated tests and documentation.
86%
#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.
84%
#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.
77%
#4832 `SNAPCRAFT_BUILD_ENVIRONMENT` takes priority over `--use-lxd` snapcraft 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.
72%
#2964 build providers: remove LXD specific env setup snapcraft merged Merged PR #2964 as ed63a021b, removing redundant LXD environment setup because Provider._get_env_command already handles the build environment.
70%