Arguments for "snapcraft build"

Some times we have a snap that we would like to build in different ways (say, “debug” as opposed to a “normal” build), and it would be good to be able to do so directly using snapcraft, instead of having different snapcraft.yaml files.

Something like

snapcraft build --build-arg arg1 --build-arg arg2 ...

would help. Those argument could be exposed to scripts in snapcraft.yaml with env vars (like $SNAPCRAFT_BUILD_ARGS_COUNT, $SNAPCRAFT_BUILD_ARG1, $SNAPCRAFT_BUILD_ARG2 etc.).

4 Likes