odo push fails for devfile nodejs, if non default project is used

Created on 12 May 2020  ยท  11Comments  ยท  Source: openshift/odo

/kind bug

What versions of software are you using?

Operating System: all

Output of odo version: master

How did you run odo exactly?

While using a minishift cluster in the backend and having experimental mode enabled, I tried to push a nodejs component.

Actual behavior

$ odo create nodejs
Experimental mode is enabled, use at your own risk
Validation
 โœ“  Checking devfile compatibility [29955ns]
 โœ“  Validating devfile component [49755ns]
Please use `odo push` command to create the component with source deployed

$ odo push
Validation
 โœ“  Validating the devfile [19025ns]
Creating Kubernetes resources for component nodejs
 โœ“  Waiting for component to start [7s]
Applying URL changes
 โœ“  URLs are synced with the cluster, no changes are required.
Syncing to component nodejs
 โœ“  Checking files for pushing [691059ns]
 โœ“  Syncing files to the component [186ms]
Executing devfile commands for component nodejs
 โœ—  
Unable to exec command [/bin/sh -c cd ${CHE_PROJECTS_ROOT}/nodejs-web-app/app && npm install]: 
/bin/sh: line 0: cd: /projects/nodejs-web-app/app: No such file or directory
 โœ—  Executing devbuild command "npm install" [62ms]
 โœ—  Failed to start component with name nodejs.
Error: Failed to create the component: unable to execute the build command: error while streaming command: command terminated with exit code 1

Expected behavior

odo push should have succeeded

/priority high
/area devfile

aredevfile kinbug prioritHigh

Most helpful comment

as discussed on slack with @dharmit, he is using this project to deploy https://github.com/sclorg/nodejs-ex, the default devfile https://github.com/elsony/devfile-registry/blob/master/devfiles/nodejs/devfile.yaml#L25 is project specific, we should make it generic.

I tried removing the workdir and it worked.

$ odo push --show-log

Validation
 โœ“  Validating the devfile [29149ns]

Creating Kubernetes resources for component mynodejs
 โœ“  Waiting for component to start [13s]

Applying URL changes
 โœ“  URLs are synced with the cluster, no changes are required.

Syncing to component mynodejs
 โœ“  Syncing files to the component [194ms]

Executing devfile commands for component mynodejs
 โ€ข  Executing devbuild command "npm install"  ...
npm WARN saveError ENOENT: no such file or directory, open '/projects/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/projects/package.json'
npm WARN projects No description
npm WARN projects No repository field.
npm WARN projects No README data
npm WARN projects No license field.

up to date in 2.784s
found 0 vulnerabilities

 โœ“  Executing devbuild command "npm install" [3s]
devdebug                                   OK
devrun                                     OK
 โ—“  Executing devrun command "nodemon app.js"devrun: started
 โœ“  Executing devrun command "nodemon app.js" [1s]

Pushing devfile component mynodejs
 โœ“  Changes successfully pushed to component

All 11 comments

as discussed on slack with @dharmit, he is using this project to deploy https://github.com/sclorg/nodejs-ex, the default devfile https://github.com/elsony/devfile-registry/blob/master/devfiles/nodejs/devfile.yaml#L25 is project specific, we should make it generic.

I tried removing the workdir and it worked.

$ odo push --show-log

Validation
 โœ“  Validating the devfile [29149ns]

Creating Kubernetes resources for component mynodejs
 โœ“  Waiting for component to start [13s]

Applying URL changes
 โœ“  URLs are synced with the cluster, no changes are required.

Syncing to component mynodejs
 โœ“  Syncing files to the component [194ms]

Executing devfile commands for component mynodejs
 โ€ข  Executing devbuild command "npm install"  ...
npm WARN saveError ENOENT: no such file or directory, open '/projects/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/projects/package.json'
npm WARN projects No description
npm WARN projects No repository field.
npm WARN projects No README data
npm WARN projects No license field.

up to date in 2.784s
found 0 vulnerabilities

 โœ“  Executing devbuild command "npm install" [3s]
devdebug                                   OK
devrun                                     OK
 โ—“  Executing devrun command "nodemon app.js"devrun: started
 โœ“  Executing devrun command "nodemon app.js" [1s]

Pushing devfile component mynodejs
 โœ“  Changes successfully pushed to component

Closing this since my expectation was incorrect.

/close

@dharmit: Closing this issue.

In response to this:

Closing this since my expectation was incorrect.

/close

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.

@dharmit why closed it? devfiles should be generic not project specific.

I agree. But using a specific devfile from a specific registry is going to be project specific, no? :thinking:

I agree. But using a specific devfile from a specific registry is going to be project specific, no?

I think no, at least the common one which we are providing is expected to work with multiple projects.

I think no, at least the common one which we are providing is expected to work with multiple projects.

Is it common among different component types, i.e., nodejs, java, etc.? And where (which registry) is it available from?

I think no, at least the common one which we are providing is expected to work with multiple projects.

Is it common among different component types, i.e., nodejs, java, etc.? And where (which registry) is it available from?

from common one here i meant not stored in a project repository, no not common for component types, but you should be able to deploy different applications(of same component type) with one devfile.

AFAIK devfiles which are supported by odo, should not be project specific i.e the nodejs devfile should be able to work with other nodejs projects too.
https://github.com/elsony/devfile-registry/blob/master/devfiles/nodejs/devfile.yaml#L9

Actually even with s2i components there were a certain conventions that needed to be followed like having a npm start script or the executable file for python was to be named main.py, so we need to have opinionated devfiles designed for specific reasons.

This can be closed now, resolved for v2 devfiles
https://github.com/odo-devfiles/registry/blob/master/devfiles/nodejs/devfile.yaml

Actually for v1 we are expecting a /app folder inside each nodejs app, thus failing for applications that does not have /app folder.
Resolved in new v2 file
https://github.com/elsony/devfile-registry/blob/master/devfiles/nodejs/devfile.yaml#L25

/close

@adisky: Closing this issue.

In response to this:

This can be closed now, resolved for v2 devfiles
https://github.com/odo-devfiles/registry/blob/master/devfiles/nodejs/devfile.yaml

Actually for v1 we are expecting a /app folder inside each nodejs app, thus failing for applications that does not have /app folder.
Resolved in new v2 file
https://github.com/elsony/devfile-registry/blob/master/devfiles/nodejs/devfile.yaml#L25

/close

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prietyc123 picture prietyc123  ยท  7Comments

dharmit picture dharmit  ยท  6Comments

valaparthvi picture valaparthvi  ยท  3Comments

surajnarwade picture surajnarwade  ยท  5Comments

mik-dass picture mik-dass  ยท  7Comments