-
Notifications
You must be signed in to change notification settings - Fork 243
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
odo add binding - Bind as files UI update #5817
odo add binding - Bind as files UI update #5817
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
d06df24
to
271bd9d
Compare
/retest-required |
Signed-off-by: Parthvi Vala <pvala@redhat.com>
271bd9d
to
e6b62fc
Compare
pkg/binding/asker/survey_asker.go
Outdated
return answer, nil | ||
|
||
var bindAsFiles bool | ||
if answer == "Bind as Files" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, you should avoid testing the literal value directly. You could pass an int as AskOne to get the index of the result, and test on the index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I keep forgetting about using the index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not want to return the int value here, I want to evaluate the bindAsFiles
's bool here. So, even if I use int to store the value of user's answer, I would rely on the options to maintain. Something like below -
func (o *Survey) AskBindAsFiles() (bool, error) {
options := []string{"Bind as Files", "Bind as Environment Variables"}
question := &survey.Select{
Message: "How do you want to bind the service?",
Options: options,
}
var answer int
err := survey.AskOne(question, &answer)
if err != nil {
return true, err
}
var bindAsFiles bool
if answer == 0 {
bindAsFiles = true
}
return bindAsFiles, nil
}
This doesn't seem correct to me.
Is this what you were suggesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, this solution now relies on the order of the options, and not anymore on the content, which can be equally error prone.
Or, in your first version, you could make a constant with "Bind as files", to be sure one is not changed without the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Const sounds like a better idea, will do that.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feloy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/override ci/prow/v4.10-integration-e2e |
@valaparthvi: Overrode contexts on behalf of valaparthvi: ci/prow/v4.10-integration-e2e In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only doc review. Besides the requested/suggested changes, I feel that we should document the need to either have a running odo dev
in a separate terminal, or execute odo dev
after adding a binding if it's not running in a separate terminal.
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md
Outdated
Show resolved
Hide resolved
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review. Looks good, only minor suggestions.
// This is run before every Spec (It) | ||
var _ = BeforeEach(func() { | ||
if helper.IsKubernetesCluster() { | ||
Skip("Operators have not been setup on Kubernetes cluster yet. Remove this once the issue has been fixed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Why is that the case? I mean, what's blocking us from setting up Operators on k8s cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to take a jab at it again, but the last time we tried, we had some problem related to annotations' character limit with a certain OLM version. I work with a minikube cluster locally, so I can ascertain that it works well on a vanilla K8s cluster, but I'll have to take a look at test cluster again.
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
/lgtm |
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
…d-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
I don't think that has to be the case. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
/lgtm |
/override ci/prow/v4.10-integration-e2e |
@valaparthvi: Overrode contexts on behalf of valaparthvi: ci/prow/v4.10-integration-e2e In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
* odo add binding - Bind as files UI update Signed-off-by: Parthvi Vala <pvala@redhat.com> * Philippe's review * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update pkg/odo/cli/add/binding/binding.go Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * Update docs/website/versioned_docs/version-3.0.0/command-reference/add-binding.md Co-authored-by: Dharmit Shah <shahdharmit@gmail.com> * make consts private Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
Signed-off-by: Parthvi Vala pvala@redhat.com
What type of PR is this:
/kind feature
What does this PR do / why we need it:
This PR adds a more understandable question when asking how to service should be bound to the component.
Which issue(s) this PR fixes:
Fixes #5770
PR acceptance criteria:
Unit test
Integration test
Documentation (https://deploy-preview-5817--odo-docusaurus-preview.netlify.app/docs/3.0.0/command-reference/add-binding)
How to test changes / Special notes to the reviewer:
mkdir /tmp/101; cd /tmp/101
odo init --name restapi --devfile go --starter go-starter
odo add binding