Variable substitution in snapcraft.yaml extension
Metadata
Current evaluation
Support for ${SNAPCRAFT_PROJECT_NAME} and ${SNAPCRAFT_PROJECT_VERSION} was fixed in Snapcraft 2.42.1; the reporter confirmed the fix.
Resolution: closed resolved
Reason: Maintainer ~kyrofa stated on 2018-06-25 that the bug was fixed as of v2.42.1. Reporter ~lucyllewy confirmed on 2018-07-02 that it appeared fixed.
Evaluated by: mr-cal-bot
No scores available.
Issue body
https://github.com/snapcore/snapcraft/blob/795628227e4b0d593e03625476d3bac21b215624/snapcraft/internal/parser.py#L127
In the above file on line 127 and 128 are two pseudo variable substitutions enacted upon the snapcraft.yaml so as to allow partially dynamic parts. I am proposing that we include the alternative bash variable style in addition to the style already shown:
Currently substituted: $SNAPCRAFT_PROJECT_NAME, $SNAPCRAFT_PROJECT_VERSION
Proposed substitutions: $SNAPCRAFT_PROJECT_NAME, ${SNAPCRAFT_PROJECT_NAME}, $SNAPCRAFT_PROJECT_VERSION and ${SNAPCRAFT_PROJECT_VERSION}
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Support for ${SNAPCRAFT_PROJECT_NAME} and ${SNAPCRAFT_PROJECT_VERSION} was fixed in Snapcraft 2.42.1; the reporter confirmed the fix. | |
| stealth/space-bunny-alpha | — | closed resolved | Brace-style ${SNAPCRAFT_PROJECT_NAME} and ${SNAPCRAFT_PROJECT_VERSION} substitution was confirmed working in Snapcraft 2.42.1; the reporter verified the fix. | |
| stealth/space-bunny-alpha | — | closed resolved | Brace-style project variable substitutions were implemented by PR #2122 (commit 31307b5de) and released in Snapcraft 2.42.1; the reporter confirmed the fix. | |
| stealth/space-bunny-alpha | — | closed stale | Closed as unimplemented after long inactivity; later project-variable expansion added curly-brace support through a broader redesign. | |
| qwen/qwen3.6-35b-a3b | — | — | The proposal to support bash-style ${VAR} substitution in snapcraft.yaml was closed without implementation. With no comments or activity, the feature request was abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Proposed supporting ${VAR} syntax alongside $VAR for project variables in snapcraft.yaml. The request was closed without discussion or implementation, indicating it was abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Proposed adding bash-style ${VAR} substitution alongside $VAR for snapcraft project variables. Closed without comments or implementation, indicating the feature was abandoned. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Request to add brace-style variable substitution for snapcraft project variables was closed without implementation. Zero comments and no activity indicate the proposal was abandoned. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1746636 Variable substitution in snapcraft.yaml does not work in keys | snapcraft (launchpad) | closed | Project-variable substitution was expanded to mapping keys, enabling variables in organize entries. Fixed by merged snapcore/snapcraft#2166 in commit 95c842863. | |
| #773 parser - Handle project name and version variables | snapcraft | merged | Merged PR #773 (commit 362d6a5f5) added substitution of SNAPCRAFT_PROJECT_NAME and SNAPCRAFT_PROJECT_VERSION in remote parts using the origin snapcraft.yaml. | |
| #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. | |
| #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. |