replicatedhq / replicated

A CLI to create, edit and promote releases in Replicated
https://vendor.replicated.com
MIT License
34 stars 23 forks source link

Support for creating multichannel licenses #398

Closed marccampbell closed 3 months ago

marccampbell commented 3 months ago

Support creating multi-channel licenses

CLAassistant commented 3 months ago

CLA assistant check
All committers have signed the CLA.

pandemicsyn commented 3 months ago

Hopefully last commit. Noticed a pair of bugs (using r.args.customerCreateDefaultChannel in the update subcommand, and missing that we never actually marked having found the default channel). While i was at it, also started throwing an error if the user supplies a default channel thats not actually in supplied channel set.

Demo - bogus default chan:

➜ bin/replicated customer update --customer=2iTuePdR497n6dDvm17YBCnfsy3 --channel Stable --channel Beta --default-channel=Nope --name "Local Dev Customer"
Update available: v0.77.1
To upgrade, run "brew upgrade replicatedhq/replicated/cli"
ERROR: default channel not found in specified channels

Perfect scenario:

➜ bin/replicated customer update --customer=2iTuePdR497n6dDvm17YBCnfsy3 --channel Stable --channel Beta --default-channel=Beta --name "Local Dev Customer"
Update available: v0.77.1
To upgrade, run "brew upgrade replicatedhq/replicated/cli"
ID                             NAME                  CHANNELS        EXPIRES    TYPE    CUSTOM_ID
2iTuePdR497n6dDvm17YBCnfsy3    Local Dev Customer     Stable Beta    Never      dev     Not Set

No default channel arg provided:

➜ bin/replicated customer update --customer=2iTuePdR497n6dDvm17YBCnfsy3 --channel Stable --channel Beta --name "Local Dev Customer"
Update available: v0.77.1
To upgrade, run "brew upgrade replicatedhq/replicated/cli"
    No default channel specified, defaulting to the first channel specified.

ID                             NAME                  CHANNELS        EXPIRES    TYPE    CUSTOM_ID
2iTuePdR497n6dDvm17YBCnfsy3    Local Dev Customer     Beta Stable    Never      dev     Not Set