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

Updates environment variable output #2213

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Sep 30, 2019

Bolds the info message for outputting the environment variables as well
as changes the grammar.

Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

@cdrage cdrage force-pushed the update-message-environment-variables branch from bd14112 to 99ff50b Compare October 1, 2019 12:48
@cdrage
Copy link
Member Author

cdrage commented Oct 1, 2019

Thanks @dharmit :) fixed!

@cdrage
Copy link
Member Author

cdrage commented Oct 1, 2019

/test v4.2-integration

@dharmit
Copy link
Member

dharmit commented Oct 1, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharmit

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Oct 1, 2019
Bolds the info message for outputting the environment variables as well
as changes the grammar.
@cdrage cdrage force-pushed the update-message-environment-variables branch from 99ff50b to d9d2835 Compare October 2, 2019 18:47
@cdrage
Copy link
Member Author

cdrage commented Oct 2, 2019

Changed the output a bit, let me know what you think @kadel @girishramnani

~/nodejs-ex  master ✗                                                                                                                                                                                                                                                                                                                                              351d ◒  ⍉
▶ odo unlink dh-mysql-apb                                       
 ✓  Service dh-mysql-apb has been successfully unlinked from the component frontend

The below secret environment variables were removed from the 'frontend' component:

· DB_USER
· DB_HOST
· DB_NAME
· DB_PASSWORD
· DB_PORT
· DB_TYPE

~/nodejs-ex  master ✗                                                                                                                                                                                                                                                                                                                                               351d ◒  
▶ odo link dh-mysql-apb  
 ✓  Service dh-mysql-apb has been successfully linked from the component frontend

The below secret environment variables were added to the 'frontend' component:

· DB_PASSWORD
· DB_PORT
· DB_TYPE
· DB_USER
· DB_HOST
· DB_NAME

You can now access the environment variables from within the component pod, for example:
$DB_NAME is now available within component dh-mysql-apb

@dharmit
Copy link
Member

dharmit commented Oct 7, 2019

You can now access the environment variables from within the component pod, for example:
oc rsc <pod-name>
echo $DB_NAME

IMHO, this will be confusing to the users who're not familiar with OpenShift terminology. I think we're trying to abstract most things about OpenShift/oc via odo. A user who's not aware of what a pod means, would wonder what's going on, no? For a user using odo via VS Code adapters, we will have to choose different message (in json output, I guess) because they're likely not aware of what odo or oc is.

Besides that, oc rsc <pod-name> is a command that one has to execute from the development system, right? The statement You can now access the environment variables from within the component pod, for example made me think that it's a command that could be executed from inside the pod. But it could be just me.

@cdrage
Copy link
Member Author

cdrage commented Oct 7, 2019

@dharmit Yeah, I thought the same thing too, but wasn't too sure. I'll remove that output.

When we merge in #2233 we can simply say use odo describe to see what environment variables are available.

@cdrage
Copy link
Member Author

cdrage commented Oct 7, 2019

It will now look like this:

You can now access the environment variables from within the component pod, for example:
$DB_NAME is now available within component dh-mysql-apb

@kadel
Copy link
Member

kadel commented Oct 9, 2019

▶ odo link dh-mysql-apb  
 ✓  Service dh-mysql-apb has been successfully linked from the component frontend

The below secret environment variables were added to the 'frontend' component:

· DB_PASSWORD
· DB_PORT
· DB_TYPE
· DB_USER
· DB_HOST
· DB_NAME

You can now access the environment variables from within the component pod, for example:
$DB_NAME is now available within component dh-mysql-apb

The last statement is not true. $DB_NAME is now available within component dh-mysql-apb it should be $DB_NAME is now available within component nodejs-something.
You are linking nodejs component with mysql. So the environment variables are added to the nodejs component not mysql

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Oct 9, 2019
@girishramnani
Copy link
Contributor

girishramnani commented Oct 9, 2019

▶ odo link dh-mysql-apb  
 ✓  Service dh-mysql-apb has been successfully linked from the component frontend

The below secret environment variables were added to the 'frontend' component:

· DB_PASSWORD
· DB_PORT
· DB_TYPE
· DB_USER
· DB_HOST
· DB_NAME

You can now access the environment variables from within the component pod, for example:
$DB_NAME is now available within component dh-mysql-apb

The last statement is not true. $DB_NAME is now available within component dh-mysql-apb it should be $DB_NAME is now available within component nodejs-something.
You are linking nodejs component with mysql. So the environment variables are added to the nodejs component not mysql

/hold

@cdrage the issue mentioned by tomas seems to be happening because the first argument is taken as component name so you might have to get the component name from the localConfigInfo or a better option might be to make o.Component() populate with the correct value.

@cdrage
Copy link
Member Author

cdrage commented Oct 9, 2019

@kadel @girishramnani

The output was actually incorrect.. some copy-and-paste foo must of messed it up, but here is the correct output:

▶ odo link mongodb-persistent                                      
 ✓  Service mongodb-persistent has been successfully linked from the component nodejs-nodejs-ex-eapl

The below secret environment variables were added to the 'nodejs-nodejs-ex-eapl' component:

· admin_password
· database_name
· password
· uri
· username

You can now access the environment variables from within the component pod, for example:
$username is now available as a variable within component nodejs-nodejs-ex-eapl

@cdrage cdrage force-pushed the update-message-environment-variables branch from ca31d89 to 083bf18 Compare October 9, 2019 12:39
@girishramnani
Copy link
Contributor

From the code, it seemed that component name was populated from the first arg, I could be wrong

@girishramnani
Copy link
Contributor

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Oct 11, 2019
@girishramnani
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Oct 11, 2019
@cdrage
Copy link
Member Author

cdrage commented Oct 11, 2019

@girishramnani See line: https://github.com/openshift/odo/blob/083bf1852627793927304f24a61cf21b3011f6ca/pkg/odo/cli/component/common_link.go#L118 previously used in the code for o.Component().

Was simply a bad copy and paste from me. The code is correct :)

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit e1eecd2 into redhat-developer:master Oct 11, 2019
@cdrage cdrage deleted the update-message-environment-variables branch January 14, 2022 14:57
@rm3l rm3l added the estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants