Skip to content

Support for creating multichannel licenses #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2024
Merged

Conversation

marccampbell
Copy link
Member

Support creating multi-channel licenses

@marccampbell marccampbell force-pushed the multi-channel-licenses branch from 5d3512e to 265c77c Compare July 5, 2024 14:31
@@ -62,28 +67,49 @@ func (r *runners) updateCustomer(cmd *cobra.Command, _ []string) (err error) {
r.args.customerUpdateType = "prod"
}

channelID := ""
if r.args.customerUpdateChannel != "" {
channels := []kotsclient.CustomerChannel{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should validate somewhere above that if multiple channels are specified, then customerCreateDefaultChannel must have a value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going for:

You can specify which is default, but if you don't specify, the first is the default. I included that in the help text.

ID: channel.ID,
}

if r.args.customerCreateDefaultChannel == requestedChannel {
Copy link
Member

@divolgin divolgin Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customerCreateDefaultChannel can be an empty string. This should be allowed only when single channel is specified, which should always have IsDefault set.

nm, I see this below

FourSigma
FourSigma previously approved these changes Jul 5, 2024
@CLAassistant
Copy link

CLAassistant commented Jul 8, 2024

CLA assistant check
All committers have signed the CLA.

@pandemicsyn pandemicsyn requested a review from divolgin July 8, 2024 18:14
divolgin
divolgin previously approved these changes Jul 8, 2024
@pandemicsyn
Copy link
Member

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

@pandemicsyn pandemicsyn requested a review from divolgin July 10, 2024 17:14
@pandemicsyn pandemicsyn merged commit 889daf0 into main Jul 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants