-
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
Implement odo log
for devfiles
#3384
Implement odo log
for devfiles
#3384
Conversation
odo log
for devfilesodo log
for devfiles
Codecov Report
@@ Coverage Diff @@
## master #3384 +/- ##
==========================================
- Coverage 46.45% 46.18% -0.27%
==========================================
Files 112 112
Lines 11237 11333 +96
==========================================
+ Hits 5220 5234 +14
- Misses 5513 5593 +80
- Partials 504 506 +2
Continue to review full report at Codecov.
|
odo log
for devfilesodo log
for devfiles
@adisky this PR needs rebase |
|
||
func (a Adapter) Log(follow, debug bool) (io.ReadCloser, error) { | ||
|
||
exists, _ := utils.ComponentExists(a.Client, a.Devfile.Data, 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.
I am seeing this exists check in the beginning of every single adapter method
|
||
func (a Adapter) Log(follow, debug bool) (io.ReadCloser, error) { | ||
|
||
exists, _ := utils.ComponentExists(a.Client, a.Devfile.Data, 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.
we shouldn't ignore the error.
|
||
var command versionsCommon.DevfileCommand | ||
if debug { | ||
command, 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.
GetDebugCommand()
pkg/kclient/pods.go
Outdated
|
||
// If the log is being followed, set it to follow / don't wait | ||
if followLog { | ||
// TODO: https://github.com/kubernetes/kubernetes/pull/60696 |
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.
This seems to have been merged a long time back. Has it been updated now?
pkg/lclient/mock_client.go
Outdated
func (m *MockDockerClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) { | ||
return nil, nil | ||
} |
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.
Is this auto generated by MockGen
?
pkg/odo/cli/component/log.go
Outdated
} | ||
|
||
// NewLogOptions returns new instance of LogOptions | ||
func NewLogOptions() *LogOptions { | ||
return &LogOptions{false, "", &ComponentOptions{}} | ||
//return &LogOptions{false, "", &ComponentOptions{}, &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.
comments found
pkg/odo/cli/component/log.go
Outdated
// EnvSpecificInfo *envinfo.EnvSpecificInfo | ||
// devfile path |
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.
comments found
Debug is now merged. |
@mik-dass Thanks for review, addressed all your comments. |
return nil, err | ||
} | ||
if reflect.DeepEqual(versionsCommon.DevfileCommand{}, command) { | ||
return nil, errors.Errorf("no debug command found in devfile, please run \"odo logs\" for run command logs") |
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.
odo log
. odo logs
leads to
✗ Invalid command - see available commands/subcommands above
@@ -450,3 +451,40 @@ func (a Adapter) Delete(labels map[string]string) error { | |||
|
|||
return a.Client.DeleteDeployment(labels) | |||
} | |||
|
|||
func (a Adapter) Log(follow, debug bool) (io.ReadCloser, error) { |
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.
Some comments for this function
/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 |
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.
Works for me
/lgtm
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context) | ||
|
||
helper.CmdShouldPass("odo", "push", "--project", namespace) | ||
helper.CmdShouldFail("odo", "log", "--debug") |
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.
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.
/hold
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.
Updated, failing as all devfiles in registry now have debug 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.
Still failing https://deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gcs/origin-ci-test/pr-logs/pull/openshift_odo/3384/pull-ci-openshift-odo-master-v4.4-integration-e2e/1280783116180393984#1:build-log.txt%3A603 I guess it is still pulling the devfile from the registry
|
/retest |
@@ -198,3 +198,4 @@ jobs: | |||
- travis_wait make test-cmd-devfile-debug | |||
- travis_wait make test-cmd-devfile-delete | |||
- travis_wait make test-cmd-devfile-create | |||
- travis_wait make test-cmd-devfile-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.
please update the name of the test to include log as well
Add log tests in travis
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.
/lgtm
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
Implement
odo log
for devfiles, It logs run command output.Which issue(s) this PR fixes:
Fixes #3260
How to test changes / Special notes to the reviewer:
odo create nodejs
odo push
Run
odo log
to check the run command logs.Run
odo log --debug
to check the debug command logs