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

odo create --devfile ./devfile.yaml deletes current devfile #3542

Closed
kadel opened this issue Jul 10, 2020 · 3 comments · Fixed by #3582
Closed

odo create --devfile ./devfile.yaml deletes current devfile #3542

kadel opened this issue Jul 10, 2020 · 3 comments · Fixed by #3582
Assignees
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects

Comments

@kadel
Copy link
Member

kadel commented Jul 10, 2020

If I run odo create with --devfile flag that points to the devfile in current directory odo just replaces it with empty file :-( Which is pretty ugly, as it just destroyed my work :-(

The reason I would like to be able to run with --devfile devfile.yaml is that I want for odo to use my already existing devfile and also be able to provide custom odo component name.

▶ odo create frontend --devfile devfile.yaml
Experimental mode is enabled, use at your own risk

Validation
 ✓  Creating a devfile component from devfile path: /Users/tkral/tmp/odo-examples/demo-frontend/devfile.yaml [90653ns]
 ✓  Validating devfile component [134579ns]

Please use `odo push` command to create the component with source deployed

▶ cat devfile.yaml

Correct behavior should be to just keep my current devfile.yaml untouched.

/kind bug
/area devfile
/area component
/priority high

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 10, 2020
@openshift-ci-robot
Copy link
Collaborator

@kadel: The label(s) area/create cannot be applied, because the repository doesn't have them

In response to this:

If I run odo create with --devfile flag that points to the devfile in current directory odo just replaces it with empty file :-( Which is pretty ugly, as it just destroyed my work :-(

The reason I would like to be able to run with --devfile devfile.yaml is that I want for odo to use my already existing devfile and also be able to provide custom odo component name.

▶ odo create frontend --devfile devfile.yaml
Experimental mode is enabled, use at your own risk

Validation
✓  Creating a devfile component from devfile path: /Users/tkral/tmp/odo-examples/demo-frontend/devfile.yaml [90653ns]
✓  Validating devfile component [134579ns]

Please use `odo push` command to create the component with source deployed

▶ cat devfile.yaml

/kind bug
/area devfile
/area create
/priority high

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). labels Jul 10, 2020
@girishramnani girishramnani added this to For consideration in Sprint 187 via automation Jul 13, 2020
@GeekArthur
Copy link
Contributor

Duplicate of #3452.

Temporary workaround:
You can run odo create in the current directory directly without using --devfile flag then odo can pick up the existing devfile in the current directory.

Permanent fix:
To fix this, we can just add validation code at the beginning of the file copy function https://github.com/openshift/odo/blob/master/pkg/util/util.go#L1081 to return the function directly if source and destination paths are the same.

I believe the problem is that since we don't catch this edge case in the file copy function, then os.Create() and os.Open() conflicts with each other so that generating an empty devfile.

@adisky
Copy link
Contributor

adisky commented Jul 15, 2020

since #3452 and this one similar we should close one.

@girishramnani girishramnani moved this from For consideration to For review in Sprint 187 Jul 16, 2020
Sprint 187 automation moved this from For review to Done Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/bug Categorizes issue or PR as related to a bug. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
No open projects
Sprint 187
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants