← Back to issue list

$SNAPCRAFT_PROJECT_VERSION isn't working for source once set via snapcraftctl

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1923835
Type
issue
State
closed
Author
~3v1n0
Labels
—
Created
Updated
Closed

Current evaluation

Closed as expected behavior: SNAPCRAFT_PROJECT_VERSION reflects snapcraft.yaml metadata and is not updated for the current environment by set-version.

Resolution: closed not a bug

Reason: Maintainer Sergiusens clarified on 2021-07-08 that SNAPCRAFT_PROJECT_VERSION is tied to the metadata in snapcraft.yaml; the requested behavior would require changing the current environment. No resolving PR or commit was identified.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I was trying to do something like this: parts: mypart: plugin: dump source: - on amd64: $SNAPCRAFT_PROJECT_DIR/app/dist/mypart-${SNAPCRAFT_PROJECT_VERSION}_amd64.deb override-pull: | deb="$(ls $SNAPCRAFT_PROJECT_DIR/app/dist/mypart-*.deb)" snapcraftctl set-version "$(basename "$deb" | grep -Eo "[0-9]+.[0-9]+.[0-9]+")" snapcraftctl pull Hoping that at the pull phase the version was now set and so could be used in the source, but looks like it's unset at this level, and not propagated around when set via set-version.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed as expected behavior: SNAPCRAFT_PROJECT_VERSION reflects snapcraft.yaml metadata and is not updated for the current environment by set-version.
stealth/space-bunny-alpha — closed stale Closed with no code fix ~5 years after ~sergiusens explained SNAPCRAFT_PROJECT_VERSION is static (bound to snapcraft.yaml), so snapcraftctl set-version in override-pull cannot affect source expansion. Same topic as snapcraft#4231.
stealth/space-bunny-alpha — closed stale Closed without a fix after about five years of inactivity; source expansion is static, so snapcraftctl set-version in override-pull does not update SNAPCRAFT_PROJECT_VERSION.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The issue reported that SNAPCRAFT_PROJECT_VERSION set via snapcraftctl set-version does not propagate to the source field. With zero comments and inactivity, it was abandoned.
qwen/qwen3.6-35b-a3b — — The bug where $SNAPCRAFT_PROJECT_VERSION fails to propagate in source fields after snapcraftctl set-version was closed without resolution or comments, indicating the report was abandoned.
qwen/qwen3.6-35b-a3b — — Abandoned. Setting SNAPCRAFT_PROJECT_VERSION via snapcraftctl set-version fails to propagate to the source field during the pull phase. Closed with no comments or resolution.
qwen3.6-35b-a3b-mtp-q6 — — Closed without comments or resolution, likely abandoned. The reported $SNAPCRAFT_PROJECT_VERSION propagation bug remains unfixed.

Update history

Date Change
created

Related issues

Issue Project State Summary Similarity
#4231 SNAPCRAFT_PROJECT_VERSION is empty if not explicitly set at top level snapcraft closed Closed as intended static behavior: Snapcraft does not dynamically refresh project variables, and the part-environment documentation was clarified on 2023-08-11.
77%
#1809068 SNAPCRAFT_ environment variables not exposed to version-script snapcraft (launchpad) closed Closed after maintainers directed users from version-script to snapcraftctl set-version; no fix was cited for the missing SNAPCRAFT_* variables.
72%
#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.
71%