How to release to channel=stable with Travis CI

Hi, I set up my Folding at Home snap to build and release using TravisCI.

This is the relevant portion of the travis.yml (thanks to @crascit for his good one on cmake)

- stage: deploy
  if: repo = fcole90/fah-snap and branch = master and type = push
  os: linux
  deploy:
    provider: snap
    snap: folding-at-home-fcole90_*.snap
    channel: stable
    cleanup: false
    skip_cleanup: true

What happens is that the release gets nevertheless pushed to edge instead of stable :confused: Should I write latest/stable instead? Or is it a bug?

Update

Neither setting stable or latest/stable works. Shall I submit an issue to Travis or is it an issue of the Snap Store?

Does your token have capabilities to deploy to stable? It could also be a problem with the dpl v1 scripts. Try the dpl v2 scripts: https://docs.travis-ci.com/user/deployment-v2/providers/snap/

And a slightly off-topic piece of advice: Travis is probably not the CI provider to invest time into as they are beginning to shut down their ā€œ(almost) unlimited free builds for OSS reposā€ plans. See https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing

1 Like

Hi, yes my, I assume my token is for all channels, as I didnā€™t specify any when obtaining it.

About the issue, it seems like itā€™s ignoring the channel string. Otherwise I would imagine it would throw some error (either Travis or from the Snap store)

About using v2 scripts, I can try them, the syntax seem the same as what Iā€™m using now. Also I see something strange, they define a edge: true in an example but there is no definition for such key. Iā€™m wondering if I should then set it to false, and I just didnā€™t happen to know it because itā€™s not documented :sweat_smile:

Abot travis shutting down OSS projects, in the article you linked I only found that they set some max minutes to avoid people abusing that like to make TOR nodes and similar. Also it seems Linux VMs have otherwise no billing change. Did I miss some relevant piece? :blush:

This might be a Travis CI issue, the code for dpl is open source https://github.com/travis-ci/dpl/blob/master/lib/dpl/providers/snap.rb

I am not a ruby expert but I see not issues with the code after a brief look, maybe @kyrofa can help out

1 Like

Hi, does anyone have any recommendation for this? It would be really helpful to have an automated release to stable, so we donā€™t have to manually go to the store and release, thatā€™s quite a loss of time :confused:

While not specific to Travis CI, I posted how Warzone 2100 handles this here:

You may be able to do something similar with a Launchpad repo to automate stable channel releases for your project.

Thanks a lot! :smiley: I was expecting something more straightforward, but I will definitely check and try to implement your solution! :blush:

BTW, I think something on the snap store side is not working as expected, I donā€™t think it was ever meant to require such advanced trickery :sweat_smile:

I just noticed that the command push is not replaced by upload. I donā€™t know if itā€™s related to this, but I changed it in a pull request: https://github.com/travis-ci/dpl/pull/1227

@sergiusens @pastdue I could finally find a solution

I added the following to my travis.yml

script:
   # build snap first, now deploy
  - echo $SNAP_TOKEN | snapcraft login --with -
  - snapcraft whoami
  - snapcraft upload --release=stable folding-at-home-fcole90_*.snap

It is now releasing to the right channel! :sunglasses:

You can see the full file here

I think it was previously not working due to Travis not using snapcraft upload but snapcraft push, which is deprecated: bug . Thanks to @sergiusens who linked me the code, I didnā€™t even know it was available.

I will update once and if my pull request is accepted, to tell you if we can then use just the Travis deploy formula, without needing any custom script

Interesting, as while push is deprecated, it is still aliased to upload. Great that you got it working.

1 Like

Here you go, the free allocations for OSS are on hold: https://news.ycombinator.com/item?id=25338983

1 Like