← Back to issue list

parts: define variables and expand them in snapcraft.yaml

View original Github issue

Metadata

Project
snapcraft
Number
#3748
Type
pull request
State
merged
Author
cmatsuoka
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #3748 in commit fba20a970, adding global and step-specific SNAPCRAFT_* variables for snapcraft.yaml expansion and lifecycle environments.

Resolution: closed resolved

Reason: PR #3748 was approved and merged as fba20a970. It defines global and per-step SNAPCRAFT_* variables, expands global variables in snapcraft.yaml, and exposes them to lifecycle steps.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Define `SNAPCRAFT_*` variables that can be used in addition to `CRAFT_*` variables in snapcraft.yaml and in the lifecycle step execution environment. Variables can be global or specific to a step, and only global variables can be used in the yaml file. Example: ``` parts: part1: ... organize: foo: usr/$SNAPCRAFT_ARCH_TRIPLET/foo ``` Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com> - [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/)? - [ ] Have you successfully run `make lint`? - [ ] Have you successfully run `pytest tests/unit`? ----- CRAFT-1071 CRAFT-1074

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #3748 in commit fba20a970, adding global and step-specific SNAPCRAFT_* variables for snapcraft.yaml expansion and lifecycle environments.
stealth/space-bunny-alpha — closed resolved Merged PR #3748 (fba20a970), adding global and step-specific SNAPCRAFT_* variables, expandable in snapcraft.yaml and available in lifecycle environments.
qwen/qwen3.6-35b-a3b — — Merged after approval and passing CI. Adds global and step-specific SNAPCRAFT_* variables for snapcraft.yaml and lifecycle execution, extending CRAFT_* support. A reviewer requested a spread test rerun for 22.04.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Introduces SNAPCRAFT_* environment variables for snapcraft.yaml and lifecycle steps. Global variables are usable in YAML, step-specific ones during execution. Approved after spread tests were rerun for 22.04.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#5727 docs: document custom project vars (SNAPCRAFT-1053) snapcraft merged Merged in canonical/snapcraft#5727 as cba259a0d, documenting custom project variables for SNAPCRAFT-1053 after the work moved from canonical/craft-parts#1216.
72%
#5499 fix: evaluate variables in project file snapcraft merged Merged in canonical/snapcraft#5499 (commit abd5db829), restoring project-variable expansion and fixing #5491 in Snapcraft 8.9.2.
72%
#2122 many: introduce variables for part src and build snapcraft merged Merged in commit 31307b5de via #2122, adding source/build directory variables and centralizing SNAPCRAFT_* environment handling; resolved LP #1763028.
72%
#757 Export important project variables snapcraft merged Merged PR #757 (commit dc0b68174) exports SNAPCRAFT_PROJECT_NAME, SNAPCRAFT_PROJECT_VERSION, SNAPCRAFT_PROJECT_STAGE and per-part SNAPCRAFT_PART_INSTALL, refactoring _expand_env into the project loader so variables work in fixed yaml fields. LP #1588336.
72%
#3645 meta: parse environment variables (CRAFT-835) snapcraft merged Merged #3645 into snapcraft/7.0 via 7e7089fb1, adding parsing of root- and app-level environment dictionaries from snapcraft.yaml.
71%
#5753 feat: adopt component variables snapcraft merged Merged PR #5753 (SNAPCRAFT-65, SNAPCRAFT-1056) added component variables so craftctl can set component versions for core22 and core24 snaps, closing #5240. Commits: 6b6f7d9ee, 766562286.
71%
#1216 docs: document custom project vars (SNAPCRAFT-1053) craft-parts closed Closed unmerged after the documentation moved to Snapcraft; canonical/snapcraft#5727 merged the equivalent change in commit cba259a0d.
70%