Skip to content
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

Fix multi-cluster domain register #6552

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

dkrotx
Copy link
Member

@dkrotx dkrotx commented Dec 10, 2024

What changed?
Fix multi-cluster domain register/update command in CLI

Why?
The commands which used cluster names (domain register/update) were
broken. Previously with urfave v1 we did a hack - we collected posional
arguments and implicitely took all of them as clusters.
Thus, these crazy invocations worked:

$ cadence domain register --clusters clusterA clusterB --other_opt ...
$ cadence domain register --clusters clusterA --other_opt ... clusterB
...

urfave v2 requires posional arguments to be at the end (makes sense!),
that's why the above invocations are not working. One could be very
confused with error-message cadence-cli gives in this case.

The solution is to make it explicit:

$ cadence domain register --clusters clusterA,clusterB
$ cadence domain register --clusters clusterA --clusters clusterB # a
bit weird IMO, I'd recommend the next example
$ cadence domain register --cl clusterA --cl clusterB

How did you test it?
Existing unit tests + added one more unit-test to capture --cl A --cl B semantics works

Potential risks

Release notes

Documentation Changes
I don't think we mention this anywhere in documentation, but I think the
new approach is more obvious and, after all, it works!
In anyway, the command' --help explains it nicely:
"Clusters (example: --clusters clusterA,clusterB or --cl clusterA --cl clusterB)"

The commands which used cluster names (domain register/update) were
broken. Previously with urfave v1 we did a hack - we collected posional
arguments and implicitely took all of them as clusters.
Thus, these crazy invocations worked:
```
$ cadence domain register --clusters clusterA clusterB --other_opt ...
$ cadence domain register --clusters clusterA --other_opt ... clusterB
...
```
urfave v2 requires posional arguments to be at the end (makes sense!),
that's why the above invocations are not working. One could be very
confused with error-message cadence-cli gives in this case.

The solution is to make it explicit:
```
$ cadence domain register --clusters clusterA,clusterB
$ cadence domain register --clusters clusterA --clusters clusterB # a
bit weird IMO, I'd recommend the next example
$ cadence domain register --cl clusterA --cl clusterB
```

I don't think we mention this anywhere in documentation, but I think the
new approach is more obvious and, after all, it works!
In anyway, the command' --help explains it nicely:
"Clusters (example: --clusters clusterA,clusterB or --cl clusterA --cl clusterB)"
@dkrotx dkrotx enabled auto-merge (squash) December 10, 2024 18:00
@dkrotx dkrotx disabled auto-merge December 10, 2024 19:46
@dkrotx dkrotx enabled auto-merge (squash) December 10, 2024 19:47
@dkrotx dkrotx disabled auto-merge December 10, 2024 21:32
@dkrotx dkrotx merged commit 536caf7 into cadence-workflow:master Dec 10, 2024
17 checks passed
jakobht added a commit that referenced this pull request Feb 7, 2025
…6658)

What changed?
Added a check to error out when positional arguments are specified in domain commands.

Why?
In this pr: #6552 we fixed the behaviour of the --cl c1 c2 argument in the domain commands to be instead --cl c1,c2. This was needed due to the update of the urfave CLI framework to v2 (see the PR for more info).

In much of our documentation we still mention that the clusters in the domain commands should be specified as --cl c1 c2 however as mention this no longer works.

Before this PR, anything after the first positional argument was ignored, so the command cadence --do foo domain register --cl c1 c2 --st securityToken was interpreted as cadence --do foo domain register --cl c1  with c2 --st securityToken as ignored positional arguments. This command will error out with "No permission to do this operation." which is very misleading.

The new error will make the user immediately aware of the problem and direct them to the help documentation.

How did you test it?

Potential risks

Release notes

Documentation Changes
Yes wee should fix documentation, at least in these two places:

https://cadenceworkflow.io/docs/cli
https://cadenceworkflow.io/docs/concepts/cross-dc-replication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants