Setting release version in snapcraft build

Casey Marshall casey.marshall at canonical.com
Thu Sep 1 17:05:32 UTC 2016


When automating the build process for snaps, I'd like to be able to provide
the release version as an argument to snapcraft, which could then be used
as a variable in the snapcraft.yaml.

For example, say I'd like to release "foo" version "1.2.3". I'd then like
to build the snap with version: 1.2.3, and use the git tag "v1.2.3" in its
source. For example:

name: foo
version: ${release-version}
...
parts:
  foo:
    source: git at ...
    source-tag: v${release-version}

The alternatives at the moment seem to be:

1. Parse the version out of snapcraft.yaml, using that as the authoritative
release version string. Workable for new projects, but a tough sell for
existing projects with an established release process.

2. Generate the snapcraft.yaml from a template (jinja, for example), which
works but is kind of awkward.

So, how about a ${release-version} variable in snapcraft.yaml, which you
could set on the snapcraft command-line with a --release-version flag? This
would be darn useful for Jenkins CI scripts that build snaps.

Does this sound like a reasonable feature to add to snapcraft? Or is there
already a preferred method for managing the release version string?

-Casey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160901/69b589da/attachment.html>


More information about the Snapcraft mailing list