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

Make --output a global parameter, disable logging, fix bug #1898

Merged

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Jul 10, 2019

This PR:

  • Makes -o or --output a global parameter
  • Disables logging completely when performing -o json, including
    using verbosity -v
  • Fixes a minor bug within some commands where -o json wasn't
    detected corretly due to a local flag being used outputFlag rather
    than OutputFlag

@cdrage cdrage added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jul 10, 2019
@cdrage
Copy link
Member Author

cdrage commented Jul 10, 2019

/hold

making some changes for debugging

@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 Jul 10, 2019
@cdrage cdrage force-pushed the no-logging-when-json branch 3 times, most recently from 79140f1 to 4a729cf Compare July 12, 2019 15:01
@cdrage
Copy link
Member Author

cdrage commented Jul 12, 2019

/retest

@cdrage cdrage force-pushed the no-logging-when-json branch 2 times, most recently from a3212be to 140c9fd Compare July 16, 2019 18:31
@cdrage cdrage removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jul 16, 2019
@cdrage
Copy link
Member Author

cdrage commented Jul 16, 2019

Had to combine some of my commits, but this is ready for review 👍 @surajnarwade @kadel @mik-dass @amitkrout

@amitkrout
Copy link
Contributor

#1782 (comment)
/test integration

@mik-dass
Copy link
Contributor

[odo]  ✗  Failed to create component with name ref-test. Please use `odo config view` to view settings used to create component. Error: unable to wait for build ref-test-app-1 to run: timed out waiting for the condition

/retest

// set new status
isTerm := IsTerminal(s.writer)
s.status = status

// If we are in debug mode, don't spin!
if !isTerm || debug {
fmt.Fprintf(s.writer, prefixSpacing+getSpacingString()+suffixSpacing+"%s ...\n", s.status)
} else {
} else if !json {
Copy link
Contributor

@mik-dass mik-dass Jul 17, 2019

Choose a reason for hiding this comment

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

why not use IsJSON() function here too instead of passing a extra parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I should of changed the old code here.. Thanks!

@cdrage
Copy link
Member Author

cdrage commented Jul 17, 2019

@mik-dass thanks for the review, updated again!

@cdrage
Copy link
Member Author

cdrage commented Jul 17, 2019

/retest

// We use "flag" in order to make this accessible throughtout ALL of odo, rather than the
// above traditional "persistentflags" usage that does not make it a pointer within the 'pflag'
// package
flag.CommandLine.String("o", "", "Specify output format, supported format: json")
Copy link
Member Author

Choose a reason for hiding this comment

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

@kadel With the way that global parameters are added with the standard flag library as well as the limitation on adding multiple flag aliases, either only -o OR --output can be added.

Would you be fine @kadel @dgolovin with removing --output (I dont see it being used much) with just -o ?

@mik-dass
Copy link
Contributor

 waited 4m0s but couldn't find running pod matching selector: 'deploymentconfig=nodejs-push-atonce-nodejs-push-context-test

/retest

@cdrage
Copy link
Member Author

cdrage commented Jul 18, 2019

/retest

@mik-dass
Copy link
Contributor

[odo]  ✗  waited 4m0s but couldn't find running pod matching selector: 'deploymentconfig=nodejs-app'

/retest

@mik-dass
Copy link
Contributor

/retest

Copy link
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mik-dass

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 Jul 26, 2019
@cdrage cdrage force-pushed the no-logging-when-json branch 2 times, most recently from ee5b504 to f8f5e19 Compare July 26, 2019 19:47
@cdrage
Copy link
Member Author

cdrage commented Jul 26, 2019

Tests finally pass 👍
@surajnarwade @kadel @girishramnani @amitkrout @dharmit @mohammedzee1000 @dharmit review?

This PR:
- Makes `-o` or `--output` a global parameter
- Disables logging completely when performing `-o json`, including
using verbosity `-v`
- Fixes a minor bug within some commands where `-o json` wasn't
detected corretly due to a local flag being used `outputFlag` rather
than `OutputFlag`
@cdrage
Copy link
Member Author

cdrage commented Jul 29, 2019

/retest

Copy link
Contributor

@mohammedzee1000 mohammedzee1000 left a comment

Choose a reason for hiding this comment

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

Codewise looking good. Not sure why we have failure related to looking for a value FOO.
https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/openshift_odo/1898/pull-ci-openshift-odo-master-integration/1054#0:build-log.txt%3A8438
At initial glance, does not seem to be related to this code cgange

@dharmit
Copy link
Member

dharmit commented Jul 30, 2019

Codewise looking good. Not sure why we have failure related to looking for a value FOO.
https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/openshift_odo/1898/pull-ci-openshift-odo-master-integration/1054#0:build-log.txt%3A8438
At initial glance, does not seem to be related to this code cgange

The test in question was added by me as a part of #1860. I believe I should have modified the code to check for FOO instead of FOO: as is the case in couple of lines above at: https://github.com/openshift/odo/blob/d3a1084deccceb45b9010c757bc63a8f739b9e0b/tests/integration/component.go#L504

If this fails repeatedly at the same place, we can try doing that change.

@amitkrout
Copy link
Contributor

/test integration

@amitkrout
Copy link
Contributor

amitkrout commented Jul 30, 2019

Codewise looking good. Not sure why we have failure related to looking for a value FOO.
https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/openshift_odo/1898/pull-ci-openshift-odo-master-integration/1054#0:build-log.txt%3A8438
At initial glance, does not seem to be related to this code cgange

The test in question was added by me as a part of #1860. I believe I should have modified the code to check for FOO instead of FOO: as is the case in couple of lines above at:

https://github.com/openshift/odo/blob/d3a1084deccceb45b9010c757bc63a8f739b9e0b/tests/integration/component.go#L504

If this fails repeatedly at the same place, we can try doing that change.

@dharmit The issue is hitting due to line https://github.com/openshift/odo/blob/master/tests/integration/component.go#L507. Due to the parallel run on two test node oc describe is looking into some other dc currently active in some other name space.

stdOut = helper.CmdShouldPass("oc", "describe", "dc", "-n", project)

will fix the issue

Copy link
Contributor

@amitkrout amitkrout left a comment

Choose a reason for hiding this comment

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

This PR:
Makes -o or --output a global parameter

@cdrage Thanks for the pr. Can you please add some more context of why we need this change.

Disables logging completely when performing -o json, including
using verbosity -v

+1, make sense

Fixes a minor bug within some commands where -o json wasn't
detected corretly due to a local flag being used outputFlag rather
than OutputFlag

Looks like a bug fix. Can you guide the steps to reproduce it. I am asking because it will be helpful to analyze/write the possible test case if any.

Copy link
Contributor

@surajnarwade surajnarwade left a comment

Choose a reason for hiding this comment

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

Codewise LGTM

/lgtm

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

cdrage commented Jul 30, 2019

/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 Jul 30, 2019
@cdrage
Copy link
Member Author

cdrage commented Jul 30, 2019

/refresh

@openshift-merge-robot openshift-merge-robot merged commit dd181e6 into redhat-developer:master Jul 30, 2019
@cdrage cdrage deleted the no-logging-when-json branch January 14, 2022 14:53
@rm3l rm3l added estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. and removed size/L labels 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/L (20-40) Rough sizing for Epics. About 2 sprints of work for a 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

9 participants