fix: evaluate variables in project file
Metadata
Current evaluation
Merged in canonical/snapcraft#5499 (commit abd5db829), restoring project-variable expansion and fixing #5491 in Snapcraft 8.9.2.
Resolution: closed resolved
Reason: PR #5499 was merged as commit abd5db829 and restored evaluation of ${SNAPCRAFT_PROJECT_VERSION} and related project variables, fixing #5491. The fix was released in Snapcraft 8.9.2 and incorporated the upstream craft-application fix.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/canonical/snapcraft/blob/main/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 `make test`?
---
Fixes a bug where project variables weren't being evaluated in project files.
This was a mistake from the craft-application 5 rebase and refactor. It's addressed upstream in https://github.com/canonical/craft-application/pull/762.
### TODO
- [x] add a core22 spread test
- [x] update changelog
Fixes #5491
(SNAPCRAFT-1131)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/snapcraft#5499 (commit abd5db829), restoring project-variable expansion and fixing #5491 in Snapcraft 8.9.2. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged a fix to evaluate project variables in project files, addressing a craft-application 5 rebase regression (SNAPCRAFT-1131) and fixing canonical/snapcraft#5491. Upstream fix: canonical/craft-application#762. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for project variables not evaluating in project files, caused by the craft-application 5 rebase. Includes a core22 spread test and changelog update. Resolves #5491. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged squash fix resolving #5491 where project variables failed to evaluate due to a craft-application 5 rebase. Aligns with upstream craft-application changes and includes updated spread tests and changelog. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#5491
(confidence 100%)
Reported broken project-variable expansion in URLs; closed by this fix.
-
Related To:
canonical/craft-application#762
(confidence 98%)
Upstream craft-application change cited as the source of the correction.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #334 fix: apply yaml transforms first | craft-application | merged | Merged in canonical/craft-application#334 (commit feb8072b), applying YAML transforms before project-variable expansion; adopted by snapcraft#4779 via craft-application 2.6.3. | |
| #5491 `${SNAPCRAFT_PROJECT_VERSION}` no longer works in URLs | snapcraft | closed | Regression in Snapcraft 8.9 broke ${SNAPCRAFT_PROJECT_VERSION} (and _NAME) expansion in part sources. Fixed by merged PR #5499 ("fix: evaluate variables in project file", commit abd5db829) and shipped in Snapcraft 8.9.2; issue closed after release announcement by mr-cal. | |
| #5500 Handle project variables with curly braces in app commands | snapcraft | open | Triaged regression: since Snapcraft 8.5.1 (merged via #5183), app commands containing braced project variables like ${SNAPCRAFT_PROJECT_NAME} fail validation. Root cause identified; volunteer ready to PR a fix. | |
| #6464 fix(models): allow project variables in app commands | snapcraft | open | Allows well-formed ${SNAPCRAFT_*}/${CRAFT_*} project-variable references in app command fields by stripping them before snapd character validation; adds unit tests. Awaiting maintainer re-review after feedback. | |
| #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. | |
| #3748 parts: define variables and expand them in snapcraft.yaml | snapcraft | merged | Merged PR #3748 in commit fba20a970, adding global and step-specific SNAPCRAFT_* variables for snapcraft.yaml expansion and lifecycle environments. | |
| #4680 fix: show better error when project file is missing | snapcraft | closed | Merged in canonical/snapcraft#4680, improving the error shown when a project file is missing; the maintainer confirmed the code remained necessary for documentation links. | |
| #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. | |
| #1619418 parser needs to replace project level variables | snapcraft (launchpad) | closed | Parser-side substitution of SNAPCRAFT_PROJECT_NAME/VERSION landed via merged PR snapcore/snapcraft#773 (commit 362d6a5f5), closing the Launchpad bug that requested it. |