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

Error messages when creating build with --image-source and image not found are confusing. #17925

Closed
GrahamDumpleton opened this issue Dec 23, 2017 · 3 comments

Comments

@GrahamDumpleton
Copy link

If using oc new-build to create a new build and you want to use the --image-source and --image-source-path options, the error messages produced when you pass a name to --image-source which doesn't match an available image stream are confusing as they point to unrelated issues that do not exist.

Version
oc v3.7.0+7ed6862
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth

Server https://127.0.0.1:8443
openshift v3.7.0+7ed6862
kubernetes v1.7.6+a08f5eeb62
Steps To Reproduce

Run:

oc new-build --name imagesourcetest python~https://github.com/openshift-katacoda/blog-django-py --source-image xxx --source-image-path=yyy --dry-run
Current Result

Get the error output:

error: Errors occurred while determining argument types:

python~https://github.com/openshift-katacoda/blog-django-py as a Git repository URL:  fatal: I don't handle protocol 'python~https'

python~https://github.com/openshift-katacoda/blog-django-py as a local directory pointing to a Git repository:  stat python~https://github.com/openshift-katacoda/blog-django-py: no such file or directory

Errors occurred during resource creation:
error: no match for "xxx"
Expected Result

Don't expect to see the middle two messages and expect a more informative error for the real problem referenced in the last message.

Additional Information

None.

@bparees
Copy link
Contributor

bparees commented Jan 3, 2018

@gabemontero "no match for xxx" is not an error during resource creation, so it's strange that it's reported as such. As for the message itself, "unable to locate resource for xxx" might be more helpful, or maybe @GrahamDumpleton has a different suggestion for what would be informative to him.

It would also be nice if we could skip outputting the "errors occurred while determining argument types" if we ultimately did succeed in resolving the arguments to something. (and only output the errors that occurred while testing the arguments, if verbose logging is enabled).

@gabemontero
Copy link
Contributor

The PR I am about to submit no produces this:

gmontero ~/go/src/github.com/openshift/origin  (new-app-bld-msgs)$ oc new-build --name imagesourcetest python~https://github.com/openshift-katacoda/blog-django-py --source-image xxx --source-image-path=yyy --dry-run
error: unable to locate resource for "xxx"

The 'oc new-build' 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. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to force the use of an image that was not matched

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

@bparees
Copy link
Contributor

bparees commented Jan 24, 2018

looks better to me. @GrahamDumpleton ?

openshift-merge-robot added a commit that referenced this issue Feb 8, 2018
Automatic merge from submit-queue (batch tested with PRs 18454, 18504, 18510, 18481, 18272).

adjust newapp/newbuild error messages (arg classification vs. actual …

…processing

Fixes #17925

@openshift/sig-developer-experience ptal

Now produces:

```
gmontero ~/go/src/github.com/openshift/origin  (new-app-bld-msgs)$ oc new-build --name imagesourcetest python~https://github.com/openshift-katacoda/blog-django-py --source-image xxx --source-image-path=yyy --dry-run
error: unable to locate resource for "xxx"

The 'oc new-build' 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. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to force the use of an image that was not matched

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

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants