-
Notifications
You must be signed in to change notification settings - Fork 244
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
Adds exec command for devfile components with kube push target #3083
Adds exec command for devfile components with kube push target #3083
Conversation
/retest |
Codecov Report
@@ Coverage Diff @@
## master #3083 +/- ##
==========================================
- Coverage 46.27% 46.13% -0.15%
==========================================
Files 112 112
Lines 11386 11422 +36
==========================================
Hits 5269 5269
- Misses 5608 5644 +36
Partials 509 509
Continue to review full report at Codecov.
|
15bb2aa
to
26bf3cb
Compare
return errors.Wrapf(err, "error while retrieving container for odo component %s", a.ComponentName) | ||
} | ||
|
||
runCommand, err := common.GetRunCommand(a.Devfile.Data, "") |
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.
How we will handle here, if runCommand
was passed as an odo flag --run-command
during odo push
?
Same problem i am getting for odo log
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.
We can add a flag for that. But during the discussion, we decided to go with the default container and command for now and implement that later.
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.
Any update on this?
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.
But during the discussion, we decided to go with the default container and command for now and implement that later.
We had decided to use the default run container during the discussion.
pkg/odo/cli/component/exec.go
Outdated
namespace string | ||
|
||
command []string | ||
EnvSpecificInfo *envinfo.EnvSpecificInfo |
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.
why additionally using EnvSpecificInfo
? we have it in context
inside ComponentOptions
?
(not specific for your PR, it is duplicate at other places as well)
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.
Fixed
a8abe66
to
be1505c
Compare
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.
@mik-dass if i run odo exec
outside context dir, It gives error ✗ open /home/**/devfile.yaml: no such file or directory
. can we wrap this error to component not found, Please run odo exec from component directory or use odo create to create a component.
// ExecRecommendedCommandName is the recommended exec command name | ||
const ExecRecommendedCommandName = "exec" | ||
|
||
var execExample = ktemplates.Examples(` # Executes a command inside the component |
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.
can we give some examples here? currently it shows
Examples:
# Executes a command inside the component
odo exec
pkg/odo/cli/component/exec.go
Outdated
// Complete completes exec args | ||
func (eo *ExecOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { | ||
if cmd.ArgsLenAtDash() <= -1 { | ||
return fmt.Errorf("no command was given for the exec command") |
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.
could we elaborate error message here
command not provided
please provide a command to execute, odo exec -- <command to be executed>
@adisky Fixed. |
@@ -138,6 +138,7 @@ jobs: | |||
- travis_wait make test-cmd-devfile-watch | |||
- travis_wait make test-cmd-devfile-delete | |||
- travis_wait make test-cmd-devfile-registry | |||
- travis_wait make test-cmd-devfile-exec |
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.
update name for the test as well
@@ -165,6 +166,7 @@ jobs: | |||
- travis_wait make test-cmd-docker-devfile-catalog | |||
- travis_wait make test-cmd-docker-devfile-delete | |||
- travis_wait make test-cmd-docker-devfile-url | |||
- travis_wait make test-cmd-docker-devfile-exec |
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.
same here
@@ -196,5 +198,6 @@ jobs: | |||
- travis_wait make test-cmd-devfile-watch | |||
- travis_wait make test-cmd-devfile-push | |||
- travis_wait make test-cmd-devfile-debug | |||
- travis_wait make test-cmd-devfile-exec |
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.
same here
if err != nil { | ||
return errors.Wrapf(err, "unable to get pod for component %s", a.ComponentName) | ||
} | ||
|
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.
shouldn't we check running status for pod?
@adisky Fixed |
/retest |
@mik-dass check the tests, other than it looks good to me |
/retest |
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: girishramnani 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 |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
Adds a
odo exec
command which executes a user given command for components with kube push targets.Which issue(s) this PR fixes:
Fixes #2857
How to test changes / Special notes to the reviewer:
odo exec -- ls <valid_command>
and the valid command should be executed in the pod.