← Back to issue list

environment: error when build-for arch variable cannot be evaluated

View original Github issue

Metadata

Project
snapcraft
Number
#4332
Type
pull request
State
merged
Author
mr-cal
Labels
Created
Updated
Closed

Current evaluation

Merged. Resolves #4314 by raising an error instead of silently evaluating to None when SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR cannot be determined for core20 snaps. Approved by three reviewers and passed CI.

Suggested action:

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `make lint`? - [x] Have you successfully run `pytest tests/unit`? ----- For core20 snaps, if the project variable `SNAPCRAFT_ARCH_BUILD_FOR` or `SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR` cannot be determined and is used in a snapcraft.yaml file, then an error is raised. cc @cmatsuoka - this may be a good reference for https://github.com/canonical/craft-parts/issues/514 Resolves #4314 (CRAFT-1963)

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged. Resolves #4314 by raising an error instead of silently evaluating to None when SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR cannot be determined for core20 snaps. Approved by three reviewers and passed CI.
qwen3.6-35b-a3b-mtp-q6 Merged to main. Resolves #4314. Fixes core20 builds where SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR could not be evaluated. Previously, None values became the string None; the fix now raises an explicit error instead.
qwen3.6-35b-a3b-mtp-q6 Merged fix resolving #4314. Undetermined SNAPCRAFT_ARCH_BUILD_FOR and SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR variables now raise an error instead of casting to the string "None". Validated during environment evaluation.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#4313 environment: add build-on and build-for envvars for core20 snapcraft merged Merged into main. Added SNAPCRAFT_ARCH_BUILD_ON and SNAPCRAFT_ARCH_BUILD_FOR environment variables to expose build architecture details for core20. Approved, passed CI, and increased coverage.
75%
#3821 meta: architectures snapcraft merged Merged adding build-on and build-for architecture support for core22 snaps. Introduced the SNAPCRAFT_BUILD_FOR environment variable to limit builds. Temporarily drafted to fix a duplicate build regression before final merge.
73%
#3418 project: always set target arch even if not cross compiling snapcraft merged Merged a change that always sets the target architecture, even during native builds. This avoids special-casing None in apt_cache and ensures SNAPCRAFT_TARGET_ARCH is consistently defined. Approved by one reviewer and passed CI checks.
73%
#1997752 base core20: wrong arch triplet snapcraft (launchpad) closed Closed without a fix or resolution, likely abandoned due to inactivity. The report indicated Snapcraft incorrectly sets SNAPCRAFT_ARCH_TRIPLET when building on a mismatched host architecture. No comments or patches were submitted.
72%
#1768 project: export the arch triplet into the environment snapcraft merged Merged changes exporting the SNAPCRAFT_ARCH_TRIPLET environment variable to support scripting. Approved by one reviewer, passed CI, and resolves issue #1752 with a minimal four-file update.
71%
#4486 $CRAFT_ARCH_TRIPLET_BUILD_FOR doesn't work on core22 snapcraft closed Resolved. The $CRAFT_ARCH_TRIPLET_BUILD_FOR substitution failure in core22 environment blocks was fixed in snapcraft 8. A maintainer confirmed the fix with a working test case demonstrating correct variable replacement.
70%