← Back to issue list

SNAPCRAFT_ environment variables not exposed to version-script

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1809068
Type
issue
State
closed
Author
~brlin
Labels
—
Created
Updated
Closed

Current evaluation

Closed after maintainers directed users from version-script to snapcraftctl set-version; no fix was cited for the missing SNAPCRAFT_* variables.

Resolution: closed not a bug

Reason: Maintainer Sergiusens recommended using snapcraftctl set-version instead. That mechanism was added in PR #2063, and version-script was later deprecated in commit 59ec3601b.

Evaluated by: mr-cal-bot

No scores available.

Issue body

``` Determining the version from the project repo (version-script). + init + local upstream_version packaging_revision + printenv ./snap/local/build-utilities/set-snap-version.bash: line 26: SNAPCRAFT_PROJECT_NAME: unbound variable ++ sed 's/^v//' + upstream_version= The version-script failed to run (exit code 1) ``` in the set-snap-version.bash I was trying to get the upstream repo's version by calling: ``` git \  -C parts/"${SNAPCRAFT_PROJECT_NAME}"/src \  describe ``` This won't be possible if snapcraft doesn't expose the SNAPCRAFT_* environment variables like it usually does in other lifecycle steps. NOTE the output of `printenv` in the trace, currently no environment variables are exposed at all.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed after maintainers directed users from version-script to snapcraftctl set-version; no fix was cited for the missing SNAPCRAFT_* variables.
stealth/space-bunny-alpha — closed not a bug Closed after maintainers directed users to set metadata in a part with snapcraftctl set-version; top-level version-script was deprecated in favor of adopt-info.
stealth/space-bunny-alpha — closed not a bug Closed with guidance to set versions through `snapcraftctl set-version` instead of relying on SNAPCRAFT_* variables in a version script; no fixing PR or commit was cited.
stealth/space-bunny-alpha — closed stale Closed with no recorded fix or explanation; matching Launchpad bug #1809068 was also unresolved. version-script was later deprecated in Snapcraft commit 59ec3601b.
qwen/qwen3.6-35b-a3b — — Closed without resolution or comments. The missing SNAPCRAFT_* environment variables in version-script were not addressed, indicating the issue was abandoned.
qwen/qwen3.6-35b-a3b — — Abandoned and closed without resolution. The missing SNAPCRAFT_ environment variables in version-script were never addressed.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The report details missing SNAPCRAFT_ environment variables in version-script execution, but zero comments and significant inactivity indicate the issue was abandoned without a fix.
qwen3.6-35b-a3b-mtp-q6 — — Abandoned and closed without resolution. The version-script failed because SNAPCRAFT_* environment variables were not exposed during execution. No fix was implemented.

Update history

Date Change
created

Related work

  • Superseded By: canonical/snapcraft#2063 (confidence 88%)

    Added the recommended snapcraftctl set-version mechanism that replaced version-script usage.

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.
75%
#1923835 $SNAPCRAFT_PROJECT_VERSION isn't working for source once set via snapcraftctl snapcraft (launchpad) closed Closed as expected behavior: SNAPCRAFT_PROJECT_VERSION reflects snapcraft.yaml metadata and is not updated for the current environment by set-version.
72%
#1822265 SNAPCRAFT_BUILD_ENVIRONMENT_* change doesn't apply to existing VMs snapcraft (launchpad) closed Closed by maintainer sergiusens (2019-04-17) as intended behaviour: SNAPCRAFT_BUILD_ENVIRONMENT_* are development/debugging-only variables, so no change was made to apply them to an existing Multipass VM.
71%
#2696 shell_utils: Add SNAPCRAFT_DEBUG_SCRIPTS env variable snapcraft closed Closed unmerged after script debugging landed elsewhere; maintainers said that implementation still needed adjustments based on the discussion in #2696.
71%
#3568 cli: enable SNAPCRAFT_TARGET_ARCH envvar matching --target-arch snapcraft closed Closed unmerged after maintainers rejected expanding environment-variable support for CLI options; SNAPCRAFT_TARGET_ARCH was not accepted as an alternative to --target-arch.
70%
#6025 Snapcraft ignores SNAPCRAFT_BUILD_ENVIRONMENT_* environment variables on MacOS snapcraft open Documented SNAPCRAFT_BUILD_ENVIRONMENT_CPU/MEMORY are ignored on macOS; maintainer confirms Multipass CPU/memory hardcoded and points to upstream craft-providers#531. Docs still promise the vars work.
70%