Skip to content

make new-app error reports clearer #12978

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

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

gabemontero
Copy link
Contributor

@gabemontero gabemontero commented Feb 15, 2017

Fixes #12892

@openshift/devex ptal

Some sample output:

gmontero ~/go/src/github.com/openshift/origin  (issue12892)$ oc new-app --strategy=docker https://192.30.253.113/openshift/ruby-hello-world.git --dry-run
error: Errors occurred while determining argument types:

https://192.30.253.113/openshift/ruby-hello-world.git as a Git repository URL:  fatal: unable to access 'https://192.30.253.113/openshift/ruby-hello-world.git/': Unable to communicate securely with peer: requested domain name does not match the server's certificate.

https://192.30.253.113/openshift/ruby-hello-world.git as a local directory pointing to a Git repository:  stat https://192.30.253.113/openshift/ruby-hello-world.git: no such file or directory

Errors occurred during resource creation:
error: --strategy is specified and none of the arguments provided could be classified as a source code location
gmontero ~/go/src/github.com/openshift/origin  (issue12892)$ oc new-app https://www.google.com/openshift/nodejs-e --dry-run
error: Errors occurred while determining argument types:

https://www.google.com/openshift/nodejs-e as a Git repository URL:  fatal: repository 'https://www.google.com/openshift/nodejs-e/' not found

https://www.google.com/openshift/nodejs-e as a local directory pointing to a Git repository:  stat https://www.google.com/openshift/nodejs-e: no such file or directory

Errors occurred during resource creation:
error: unable to load template file "https://www.google.com/openshift/nodejs-e": unable to read URL "https://www.google.com/openshift/nodejs-e", server reported 404 Not Found, status code=404
error: no match for "https://www.google.com/openshift/nodejs-e"

The 'oc new-app' command will match arguments to the following types:

  1. Images tagged into image streams in the current project or the 'openshift' project
     - if you don't specify a tag, we'll add ':latest'
  2. Images in the Docker Hub, on remote registries, or on the local Docker engine
  3. Templates in the current project or the 'openshift' project
  4. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

See 'oc new-app -h' for examples.
gmontero ~/go/src/github.com/openshift/origin  (issue12892)$ oc new-app https://githb.com/openshift/nodejs-e --dry-run
error: Errors occurred while determining argument types:

https://githb.com/openshift/nodejs-e as a Git repository URL:  fatal: unable to access 'https://githb.com/openshift/nodejs-e/': Network file descriptor is not connected

https://githb.com/openshift/nodejs-e as a local directory pointing to a Git repository:  stat https://githb.com/openshift/nodejs-e: no such file or directory

Errors occurred during resource creation:
error: unable to load template file "https://githb.com/openshift/nodejs-e": Get https://githb.com/openshift/nodejs-e: dial tcp 158.69.145.48:443: i/o timeout
error: no match for "https://githb.com/openshift/nodejs-e"

The 'oc new-app' command will match arguments to the following types:

  1. Images tagged into image streams in the current project or the 'openshift' project
     - if you don't specify a tag, we'll add ':latest'
  2. Images in the Docker Hub, on remote registries, or on the local Docker engine
  3. Templates in the current project or the 'openshift' project
  4. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

See 'oc new-app -h' for examples.

remote, err := app.IsRemoteRepository(s)
c.ArgumentClassificationErrors["Remote access"] = err
local, err := app.IsDirectory(s)
c.ArgumentClassificationErrors["Local access"] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this whole block be protected by the if !validated condition, to mimic the switch behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

also only set the classification errors is err!=nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was originally that way (whole block, etc .etc.), and then broke slightly from that norm in this sense:

  1. The information as to whether the arg satisfied any of the tests seemed useful to me
  2. note I don't update the c.Components etc. for any of the subsequent classifications on a match has been made ... in that sense I preserve the switch behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And on classificatnoi errors and err != nil, again, that was intentional. If a classification passed, I wanted it illustrated by the fact that the error field was nil. If I don't add a key / nil err pair, then unless you know the entire list of classifications, you don't know what has passed if we only list the actual errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how the additional information is useful since there's nothing the user can do about it (eg if we think it's an environment variable, it doesn't really matter if we also think it's a source repo, or are sure it's not a source repo because of error X, it's still going to get processed/consumed as an environment variable).

If anything it may just lead to more confusion since anytime new-app fails overall(for unrelated reasons), it's going to print out messages talking about the error it got when trying to treat an env variable argument as a source repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

And on classificatnoi errors and err != nil, again, that was intentional. If a classification passed, I wanted it illustrated by the fact that the error field was nil. If I don't add a key / nil err pair, then unless you know the entire list of classifications, you don't know what has passed if we only list the actual errors.

yeah i sort of figured that was the intention, but for an end user it's a pretty ugly/confusing output. I might be convinced of keeping the nil value and doing better processing when printing the errors out to reformat the "nil" to something more informative to the user, but overall I think doing anything with it is tipping too far on the side of "what gabe+ben want to see to debug the problem" and not "what is useful to a user to see to know what they should do to fix it". For example "Component reference" means nothing at all to an end user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some internal ping-pong, I landed on not feeling strongly enough to dig in one side or the other :-) I'll switch back to the closer mimic of the switch behavior.

validated = true
}

err = app.IsComponentReference(s)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, guard with if !validated

}

err = app.IsComponentReference(s)
c.ArgumentClassificationErrors["Component reference processing"] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

only set this if err!=nil?

}

rc, err = app.IsPossibleTemplateFile(s)
c.ArgumentClassificationErrors["Template processing"] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

same comments as above.

@@ -612,7 +612,13 @@ func handleRunError(err error, baseName, commandName, commandPath string) error
transformError(err, baseName, commandName, commandPath, groups)
}
buf := &bytes.Buffer{}
fmt.Fprintf(buf, "Prior to API Object processing, here were the results from application argument classification:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

only print this if len(config.ArgumentClassificationErrors)>0
(in conjunction w/ not adding things to that map unless the value is non-nil, as mentioned below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK ... still debating the suggestions above, I agree with the len check.

for key, value := range config.ArgumentClassificationErrors {
fmt.Fprintf(buf, fmt.Sprintf("\n%s: %v\n", key, value))
}
fmt.Fprint(buf, "\n\nThen, the following errors were noted during API Object processing:\n\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/noted/occurred/ but this test will also have to be reworked to account for the possibility that it is the first output, once you make the change i suggested above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do rewording ... agreement on above suggestions still pending

@smarterclayton
Copy link
Contributor

What the heck is "API Object processing" and why is it showing up in an error message to an end user?

@gabemontero
Copy link
Contributor Author

:-) It was my attempt to categorize/summarize the fact that oc new-app will ultimately result in the creation of the objects specified in the template .... BuildConfigs, DeploymentConfigs, Services, Routes, Secrets.

Prior to the REST interactions with the master that result in creation, there is client side interpretation of the arguments that result in git invocations, file system checks, that could or could not fail for various reasons.

I tasked with exposing those failures for debug when oc new-app fails.

That opening phrase was an attempt to provided context.

But of course suggestions to change are appreciated (assuming you agree with exposing those errors if the command fails).

@gabemontero
Copy link
Contributor Author

Perhaps replace the entire fist sentence with: "Attempts to classify the arguments resulted in these errors:"

The for the next sentence go with "The following errors occurred after argument classification:"

@gabemontero
Copy link
Contributor Author

Updates to @bparees comments pushed.

Fixing "API Object processing" still pending ... waiting a bit to see what feedback arrives.

@@ -612,7 +612,15 @@ func handleRunError(err error, baseName, commandName, commandPath string) error
transformError(err, baseName, commandName, commandPath, groups)
}
buf := &bytes.Buffer{}
if config.ArgumentClassificationErrors != nil && len(config.ArgumentClassificationErrors) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

config.ArgumentClassificationErrors != nil is unnecessary: len(nil) == 0 in golang.

@@ -271,7 +271,15 @@ func handleBuildError(err error, baseName, commandName, commandPath string) erro
transformBuildError(err, baseName, commandName, commandPath, groups)
}
buf := &bytes.Buffer{}
if config.ArgumentClassificationErrors != nil && len(config.ArgumentClassificationErrors) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

config.ArgumentClassificationErrors != nil is unnecessary: len(nil) == 0 in golang.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

continue
}

// had to move off of elegant switch to capture errors for future display, but mimic
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems more like a commit comment than a code comment ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It certainly is .... between your comment and the exchange I had with @bparees, I believe the explanation has been sufficiently proliferated :-)

deleted with next push

for _, s := range args {
switch {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're ditching the switch statement, can you refactor into a separate function which then allows you to avoid all the nested ifs? i.e.:

if foo {
    // something
    return
}

if bar {
    // something else
    return
}

rather than

if foo {
    // something
} else {
    if bar {
        // something else
    } else {
        if baz ...
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, the refactor into functions made me realize I could preserve the switch - thanks!... part of next push

@jim-minter
Copy link
Contributor

Comments added. For what my view is worth, I feel pretty reluctant about this change on the basis that it feels like it's building more stuff on top of our shaky foundations and locking us more into them. I'm concerned this will make future code maintenance/cleanup harder, rather than easier.

If possible, I'd sooner see one of the following:

  • a more lightweight approach (if one exists) that satisfies the issue(s) raised, or
  • closing the issues won't fix, or
  • starting a document recording new-app shortcomings for a rewrite one day, or
  • implementing CLI arguments like --I'm-telling-you-this-is-a-remote-git-repo=https://www.github.com/openshift/nodejs-ex which would bypass our not-so-smart smarts for people to whom this kind of thing matters.

@gabemontero
Copy link
Contributor Author

Updates pushed include:

  • replacement of the "API Object .." text
  • changes stemming from @jim-minter 's suggestions

On @jim-minter 's concerns outside of the code change comments:

  • not convinced this change makes future rework more difficult ... also, I think some of the rework stemming from @jim-minter 's code comments helps here

  • a more lightweight approach did occur to me ... specifically the usability / readability of kcmduti.MultipleErrors and its compressed format is insufficient for our needs here IMO (see here ... folks may have noticed I added a //TODO asking about it in these changes. It has been my experience though that moving off of k8s helper functions is sometimes a tough sell in PR review. Replacing that output with some additional textual context and perhaps multi-line listing of errors could be sufficient to alleviate the confusion noted by users in recent issues.

  • the tactical vs. strategic change argument wrt oc new-app has lost traction with me at least .... for all the talk of replacing the current oc new-app, we don't even have a card/epic on our trello board yet for actually doing that, and I still see after a quick search 3 cards on our backlog that call for enhancements on the current implementation ... more tactical changes seem to be the reality

  • I like the --I'm telling you how to classify the argument idea. That feels more like a card than an bug issue though. And I'm inclined to improve the readability of the oc new-app error output in some fashion irrespective of this addition, but at least acknowledge the rationale in solving this in that fashion.

My two cents. @bparees - based on the responses from various folks, where's your head wrt this?

@bparees
Copy link
Contributor

bparees commented Feb 16, 2017

I still want to see this done, the current experience is bad.

a more lightweight approach (if one exists) that satisfies the issue(s) raised, or

i'm not sure what is particularly heavyweight about this, curious if the changes resulting from your feedback make you feel any better about it.

closing the issues won't fix, or

definitely not a fan of this, the current error behavior is pretty baffling to users. (and this PR spawned from a user issue in which the user was so confused by the behavior that they thought new-app didn't support ip address based source repos)

starting a document recording new-app shortcomings for a rewrite one day, or

i'm not against also doing this, at this point i'm sure a lot of us have a mental wishlist of "if i was writing new-app from scratch...." and it would certainly not hurt to have that written down.

implementing CLI arguments like --I'm-telling-you-this-is-a-remote-git-repo=https://www.github.com/openshift/nodejs-ex which would bypass our not-so-smart smarts for people to whom this kind of thing matters.

that's what --code, --template, --image, etc are for. and it is true that in the case of the original issue the user hit, if they'd rerun the command w/ --code they'd have gotten a more useful error:

sample-app (sc_metadata)$ oc new-app --code=https://192.30.253.113/openshift/nodejs-ex --dry-run
error: shallow cloning repository "https://192.30.253.113/openshift/nodejs-ex" to "/tmp/gen058686116" failed: Cloning into '/tmp/gen058686116'...
fatal: unable to access 'https://192.30.253.113/openshift/nodejs-ex/': Unable to communicate securely with peer: requested domain name does not match the server's certificate.

but obviously this user did not understand the failure they'd hit sufficiently to realize new-app had mis-categorized the argument and that telling new-app what the arg type was might get them more information...so i'm not convinced that's a sufficient solution (as evidenced by it not having been sufficient for the user who hit this)

@@ -612,7 +612,15 @@ func handleRunError(err error, baseName, commandName, commandPath string) error
transformError(err, baseName, commandName, commandPath, groups)
}
buf := &bytes.Buffer{}
if len(config.ArgumentClassificationErrors) > 0 {
fmt.Fprintf(buf, "Attempts to classify the arguments resulted in these errors:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

"Errors occurred while determining argument types:"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

for key, value := range config.ArgumentClassificationErrors {
fmt.Fprintf(buf, fmt.Sprintf("\n%s: %v\n", key, value))
}
fmt.Fprint(buf, "\nThe following errors occurred during application creation:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

"Errors occurred during resource creation:"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

@@ -599,7 +599,7 @@ func retryBuildConfig(info *resource.Info, err error) runtime.Object {
return nil
}

func handleRunError(err error, baseName, commandName, commandPath string) error {
func handleRunError(err error, baseName, commandName, commandPath string, config *newcmd.AppConfig) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

the only difference between this and handleBuildError is which function is invoked for transformation...seems like an opportunity to collapse some code (pass the transform function in as an argument)

Copy link
Contributor

Choose a reason for hiding this comment

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

(and might make @jim-minter feel better about the weight of the changes :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

for _, group := range groups {
//TODO how coupled are we to kcmdutil.MultipleErrors ... format is compressed, non-optimal readability
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not seeing a current need to change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

10-4

c.Components = append(c.Components, s)
return true
}
c.ArgumentClassificationErrors["Component reference processing"] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd like to see another term used here that will have meaning to the user. I think this is essentially checking if the value is either:

  1. an image
  2. an imagestreamtag
  3. a template that exists in the cluster(?)

if it weren't for 3 this would be easier to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll work off of the terminology in the suggestion

}

if derr != nil {
c.ArgumentClassificationErrors["Local access"] = derr
Copy link
Contributor

Choose a reason for hiding this comment

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

these two error keys don't make it clear the failure was related to trying to treat the argument as a source repo. (remote access to what? local access to what?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll work off of the terminology in the suggestion

case c.addEnvironmentArguments(s):
case c.addSourceArguments(s):
case c.addComponentArguments(s):
case c.addTemplateArguments(s):
Copy link
Contributor

Choose a reason for hiding this comment

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

if the user passes multiple arguments, this error accumulation and reporting logic breaks down. You need to accumulate the ArgumentClassificationErrors on a per argument basis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep I'll include the arg string in the key - good catch

os::cmd::expect_failure_and_text 'oc new-app https://githb.com/openshift/nodejs-e' 'Remote access: '
os::cmd::expect_failure_and_text 'oc new-build --strategy=docker https://192.30.253.113/openshift/ruby-hello-world.git' 'Remote access: '
os::cmd::expect_failure_and_text 'oc new-build https://www.google.com/openshift/nodejs-e' 'Remote access: '
os::cmd::expect_failure_and_text 'oc new-build https://githb.com/openshift/nodejs-e' 'Remote access: '
Copy link
Contributor

Choose a reason for hiding this comment

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

add a test w/ multiple arguments that all fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

@gabemontero
Copy link
Contributor Author

responses to latest @bparees comments pushed

@@ -599,7 +599,7 @@ func retryBuildConfig(info *resource.Info, err error) runtime.Object {
return nil
}

func handleRunError(err error, baseName, commandName, commandPath string) error {
func handleError(err error, baseName, commandName, commandPath string, config *newcmd.AppConfig, f func(err error, baseName, commandName, commandPath string, groups errorGroups)) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename f to transformError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure more informative less terse ... part of next push

for key, value := range config.ArgumentClassificationErrors {
fmt.Fprintf(buf, fmt.Sprintf("\n%s: %v\n", key, value))
}
fmt.Fprint(buf, "\nErrors occurred during resource creation:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be split so printing the \n is inside the if clause and printing the rest of the text outside?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I debated putting the "Errors occurred during resource creation:" in even if there were no ArgumentClassificationErrors, simply to add some context and clarification around the terse kcmdutil.MultipleErrors output.

You've tipped me in that direction. Part of next push.

c.Components = append(c.Components, s)
return true
}
c.ArgumentClassificationErrors[fmt.Sprintf("%s as a imagestream tag or docker image reference ", s)] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

a->an in a imagestream tag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

@@ -117,6 +117,8 @@ type AppConfig struct {

OSClient client.Interface
OriginNamespace string

ArgumentClassificationErrors map[string]error
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether

ArgumentClassificationErrors []struct {
    Key string
    Value error
}

may prove better, to keep ordering of messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm ... yeah, slightly more cumbersome to use, but the implementation does prescribe a precedence.

I'll prototype and see if it looks palatable.

Copy link
Contributor

Choose a reason for hiding this comment

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

and then I'll be quiet :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:-)

change is palatable ... about to push

return true
}
if err != nil {
c.ArgumentClassificationErrors[fmt.Sprintf("%s as a template in an accessible project", s)] = err
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the text right given it says as possible template file above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

case app.IsPossibleTemplateFile(s):
glog.V(2).Infof("treating %s as possible template file\n", s)
c.Components = append(c.Components, s)
case c.addEnvironmentArguments(s):
Copy link
Contributor

Choose a reason for hiding this comment

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

wonder whether calling these functions tryToAddFoo might make this a little clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of next push

@gabemontero
Copy link
Contributor Author

@bparees pushed changes stemming from your last set of code comments and updated the sample outputs in the description

}
fmt.Fprint(buf, "\n")
}
fmt.Fprint(buf, "Errors occurred during resource creation:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

this should also be conditional on there actually being at least one resource creation error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fact that we are in handleErrors at this point already ensures that there is at least one error. See the if err == nil return snippet at the top. I believe an additional check is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

yup, i see now. thanks.

os::cmd::expect_failure_and_text 'oc new-app https://githb.com/openshift/nodejs-e' 'as a GIT repository URL: '
os::cmd::expect_failure_and_text 'oc new-build --strategy=docker https://192.30.253.113/openshift/ruby-hello-world.git' 'as a GIT repository URL: '
os::cmd::expect_failure_and_text 'oc new-build https://www.google.com/openshift/nodejs-e' 'as a GIT repository URL: '
os::cmd::expect_failure_and_text 'oc new-build https://githb.com/openshift/nodejs-e' 'as a GIT repository URL: '
Copy link
Contributor

Choose a reason for hiding this comment

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

these all need to be fixed to Git

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doh!! .. the one time I didn't run test-cmd :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

script update pushed

@bparees
Copy link
Contributor

bparees commented Feb 20, 2017

lgtm but we're going to need a final signoff from @smarterclayton on the error messaging.

@gabemontero
Copy link
Contributor Author

@smarterclayton bump on you take on updated error message examples in PR description - thanks

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2017
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2017
@gabemontero gabemontero force-pushed the issue12892 branch 2 times, most recently from 987dd12 to 0a11b3a Compare March 2, 2017 14:39
@bparees
Copy link
Contributor

bparees commented Mar 2, 2017

@smarterclayton bump for review of new error output.

@bparees
Copy link
Contributor

bparees commented Mar 6, 2017

@openshift/cli-review ptal.

}
fmt.Fprint(buf, "\n")
}
fmt.Fprint(buf, "Errors occurred during resource creation:\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: fmt.Fprintln could be used instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switch to fmt.Fprintln pushed

@juanvallejo
Copy link
Contributor

@fabianofranz this lgtm from a cli perspective

@bparees
Copy link
Contributor

bparees commented Mar 6, 2017

thanks @juanvallejo
[merge]

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@gabemontero
Copy link
Contributor Author

Looks like a new-app extended test is not happy:

oc new-app 
13:36:52   should fail with a --name longer than 58 characters
13:36:52   /tmp/openshift/tito/rpmbuild-originie34Li/BUILD/origin-1.5.0/_output/local/go/src/github.com/openshift/origin/test/extended/builds/new_app.go:51



• Failure [17.397 seconds]
13:36:52 [builds][Conformance] oc new-app
13:36:52 /tmp/openshift/tito/rpmbuild-originie34Li/BUILD/origin-1.5.0/_output/local/go/src/github.com/openshift/origin/test/extended/builds/new_app.go:52
13:36:52   should fail with a --name longer than 58 characters [It]
13:36:52   /tmp/openshift/tito/rpmbuild-originie34Li/BUILD/origin-1.5.0/_output/local/go/src/github.com/openshift/origin/test/extended/builds/new_app.go:51
13:36:52 
13:36:52   Expected
13:36:52       <string>: error: Errors occurred during resource creation:
13:36:52       error: invalid name: a2345678901234567890123456789012345678901234567890123456789. Must be an a lower case alphanumeric (a-z, and 0-9) string with a maximum length of 58 characters, where the first character is a letter (a-z), and the '-' character is allowed anywhere except the first or last character.
13:36:52   to have prefix
13:36:52       <string>: error: invalid name: 
13:36:52 
13:36:52   /tmp/openshift/tito/rpmbuild-originie34Li/BUILD/origin-1.5.0/_output/local/go/src/github.com/openshift/origin/test/extended/builds/new_app.go:50

Didn't realize this extended test existed. I believe it is getting confused by the new, additional error messages that were added.

I'll start working on an update to the extended test to account for the new messages.

@gabemontero
Copy link
Contributor Author

Looks like something happened with pkg/generate/app/cmd/newapp_test.go after one of the rebases. Will need to address that too.

@gabemontero
Copy link
Contributor Author

OK fixes to those two items pushed.

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 5fa0f68

@bparees
Copy link
Contributor

bparees commented Mar 6, 2017

[merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/870/) (Base Commit: 5e64198)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 5fa0f68

@openshift-bot
Copy link
Contributor

openshift-bot commented Mar 7, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/870/) (Base Commit: da719a3) (Image: devenv-rhel7_6047)

@openshift-bot openshift-bot merged commit 4cd65ea into openshift:master Mar 7, 2017
@gabemontero gabemontero deleted the issue12892 branch March 7, 2017 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants