Right now Snapcraft has the
enable-ci command that currently integrates with Travis via the Travis gem. It fetches an attenuated macaroon, encrypts it using the Travis gem (which also saves the password into the Travis environment for the project in question), and modifies the .travis.yml file accordingly.
However, even that integration doesn’t work for all cases (e.g. when the snapcraft.yaml and .travis.yml are not next to each other), and we’re now looking to add support for other CI systems, and are finding that others do not work the same way as Travis. For example, Circle CI has no similar CLI tool. In an effort to make integrating snaps into a generic CI simpler, we need to extract some of that functionality into commands. Specifically, the ability to fetch and utilize an attenuated macaroon.
I propose this CLI change:
- Add a
get-token [--packages <packages>] [--channels <channels>] [--acls <acls>] FILEcommand that creates a file containing the macaroon attenuated as requested.
- Add a
--tokenoption to the
logincommand to login using the generated token file instead of username/password.
This simple change will unlock a lot of capabilities in any CI, and make future CI integrations much smoother.