Bug 1275549 - Build failed when using 'oc new-app --context-dir'
Build failed when using 'oc new-app --context-dir'
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Scott Dodson
Wang Haoran
Depends On:
  Show dependency treegraph
Reported: 2015-10-27 04:35 EDT by Wang Haoran
Modified: 2015-11-23 09:44 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-23 09:44:11 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Wang Haoran 2015-10-27 04:35:22 EDT
Description of problem:

After create app using oc new-app --context-dir , the build will failed.Since the files under contextdir should copy to the src dir in the build pod, not the whole git repo.
Version-Release number of selected component (if applicable):
openshift v3.0.2.903-29-g49953d6
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4
oc v3.0.2.903-29-g49953d6

How reproducible:

Steps to Reproduce:
1.create a project
$oc new-project test
2.new app
$oc new-app  https://github.com/openshift/sti-nodejs.git --context-dir=0.10/test/test-app/ --name='nodejs-test'
3.check the build log
$oc get build
$oc build-logs nodejs-test-1

Actual results:
the build failed
I1027 04:09:46.950918       1 sti.go:448] ---> Installing application source
I1027 04:09:46.982971       1 sti.go:448] ---> Building your Node application from source
E1027 04:09:48.033881       1 util.go:85] npm info it worked if it ends with ok
E1027 04:09:48.033911       1 util.go:85] npm info using npm@1.4.28
E1027 04:09:48.033930       1 util.go:85] npm info using node@v0.10.35
E1027 04:09:48.254073       1 util.go:85] npm ERR! install Couldn't read dependencies
E1027 04:09:48.254108       1 util.go:85] npm ERR! package.json ENOENT, open '/opt/app-root/src/package.json'
E1027 04:09:48.254135       1 util.go:85] npm ERR! package.json This is most likely not a problem with npm itself.
E1027 04:09:48.254143       1 util.go:85] npm ERR! package.json npm can't find a package.json file in your current directory.
E1027 04:09:48.254149       1 util.go:85] 
E1027 04:09:48.254155       1 util.go:85] npm ERR! System Linux 3.10.0-324.el7.x86_64
E1027 04:09:48.254161       1 util.go:85] npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "install" "-d"
E1027 04:09:48.254167       1 util.go:85] npm ERR! cwd /opt/app-root/src
E1027 04:09:48.254173       1 util.go:85] npm ERR! node -v v0.10.35
E1027 04:09:48.254351       1 util.go:85] npm ERR! npm -v 1.4.28
E1027 04:09:48.254363       1 util.go:85] npm ERR! path /opt/app-root/src/package.json
E1027 04:09:48.254369       1 util.go:85] npm ERR! code ENOPACKAGEJSON
E1027 04:09:48.254377       1 util.go:85] npm ERR! errno 34
E1027 04:09:48.254401       1 util.go:85] npm ERR! 
E1027 04:09:48.254438       1 util.go:85] npm ERR! Additional logging details can be found in:
E1027 04:09:48.254461       1 util.go:85] npm ERR!     /opt/app-root/src/npm-debug.log
E1027 04:09:48.254474       1 util.go:85] npm ERR! not ok code 0

Expected results:
the build should success.

Additional info:
using sti command manually will success.like this:
s2i build https://github.com/openshift/sti-nodejs.git --context-dir=0.10/test/test-app/ openshift/nodejs-010-centos7 nodejs-sample-app
Comment 2 Ben Parees 2015-10-27 15:50:53 EDT
I tested this and it worked as expected.  If you can recreate it, please provide the following additional information:

1) the json for the buildconfig that was defined by new-app
2) run openshift with --loglevel=5 provide the failing build logs from that (setting openshift to loglevel 5 also enables verbose logging for the builds)
Comment 3 Wang Haoran 2015-10-27 22:15:26 EDT
Ben ,I test it again, same problem, see the buiconfig and build log with level 5.
Comment 4 Ben Parees 2015-10-27 22:58:14 EDT
i'm afraid you're going to need to wait for a new puddle to verify this, it appears the fix for context-dir behavior isn't in the level you're using.  can you confirm against origin?
Comment 5 Ben Parees 2015-10-27 23:17:00 EDT
looks like the commit in question that fixed this was f076ce8eac7f5dab51f69de4e48d5a56adb99fd5 which went into origin on 10/24.

it was broken since b10d7000b8a149e823e2874916fe9ca399e23aff which went in on 10/15.
Comment 6 Wang Haoran 2015-10-28 01:39:58 EDT
it works with origin env , will verify again when the fix is merged to ose
Comment 7 Wang Haoran 2015-10-29 08:13:08 EDT
verified on this version:
openshift v3.0.2.903-114-g2849767
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4

still failed.
Comment 8 Ben Parees 2015-10-29 11:05:28 EDT
Looks like the images weren't rebuilt with that puddle and this fix requires a new origin-sti-builder image.

Assigning to scott to move to ON_QA when that happens.
Comment 9 Scott Dodson 2015-11-02 16:22:28 EST
Images have been rebuilt.
Comment 10 Wang Haoran 2015-11-03 00:33:38 EST
Verified with version:
openshift v3.0.2.905
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4

Note You need to log in before you can comment on or make changes to this bug.