nodeshift-archived / ubi8-s2i-web-app

Apache License 2.0
26 stars 28 forks source link

modern-web-apps-openshift-part-1 angular-web-app build fails #44

Closed zensonic closed 5 years ago

zensonic commented 5 years ago

Hi

Trying to follow https://developers.redhat.com/blog/2018/10/04/modern-web-apps-openshift-part-1/ for angular. Works nicely for react. but fails for angular, see last lines. Am I doing something wrong, or?

[~]$ npx @angular/cli new angular-web-app ? Would you like to add Angular routing? No ? Which stylesheet format would you like to use? CSS CREATE angular-web-app/README.md (1030 bytes) CREATE angular-web-app/.editorconfig (246 bytes) CREATE angular-web-app/.gitignore (629 bytes) CREATE angular-web-app/angular.json (3497 bytes) CREATE angular-web-app/package.json (1288 bytes) CREATE angular-web-app/tsconfig.json (470 bytes) CREATE angular-web-app/tslint.json (1985 bytes) CREATE angular-web-app/browserslist (429 bytes) CREATE angular-web-app/karma.conf.js (1027 bytes) CREATE angular-web-app/tsconfig.app.json (210 bytes) CREATE angular-web-app/tsconfig.spec.json (270 bytes) CREATE angular-web-app/src/favicon.ico (5430 bytes) CREATE angular-web-app/src/index.html (300 bytes) CREATE angular-web-app/src/main.ts (372 bytes) CREATE angular-web-app/src/polyfills.ts (2838 bytes) CREATE angular-web-app/src/styles.css (80 bytes) CREATE angular-web-app/src/test.ts (642 bytes) CREATE angular-web-app/src/assets/.gitkeep (0 bytes) CREATE angular-web-app/src/environments/environment.prod.ts (51 bytes) CREATE angular-web-app/src/environments/environment.ts (662 bytes) CREATE angular-web-app/src/app/app.module.ts (314 bytes) CREATE angular-web-app/src/app/app.component.css (0 bytes) CREATE angular-web-app/src/app/app.component.html (1120 bytes) CREATE angular-web-app/src/app/app.component.spec.ts (1005 bytes) CREATE angular-web-app/src/app/app.component.ts (219 bytes) CREATE angular-web-app/e2e/protractor.conf.js (810 bytes) CREATE angular-web-app/e2e/tsconfig.json (214 bytes) CREATE angular-web-app/e2e/src/app.e2e-spec.ts (644 bytes) CREATE angular-web-app/e2e/src/app.po.ts (251 bytes)

core-js@2.6.9 postinstall /home/zensonic/angular-web-app/node_modules/babel-runtime/node_modules/core-js node scripts/postinstall || echo "ignore"

core-js@2.6.9 postinstall /home/zensonic/angular-web-app/node_modules/karma/node_modules/core-js node scripts/postinstall || echo "ignore"

@angular/cli@8.0.3 postinstall /home/zensonic/angular-web-app/node_modules/@angular/cli node ./bin/postinstall/script.js

? Would you like to share anonymous usage data with the Angular Team at Google under Google’s Privacy Policy at https://policies.google.com/privacy? For more details and how to change this setting, see http://angular.io/analytics. No npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1012 packages from 1041 contributors and audited 19005 packages in 27.665s found 0 vulnerabilities

Successfully initialized git.

[~]$ cd angular-web-app/ [angular-web-app]$ npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.x --build.env OUTPUT_DIR=dist/angular-web-app --expose npx: installed 209 in 3.365s 2019-06-19T12:08:01.514Z INFO loading configuration 2019-06-19T12:08:01.521Z INFO using namespace hest42 at https://openshift02:8443 2019-06-19T12:08:01.532Z WARNING a file property was not found in your package.json, archiving the current directory. 2019-06-19T12:08:01.532Z INFO creating archive of .editorconfig, .gitignore, README.md, angular.json, browserslist, e2e, karma.conf.js, package-lock.json, package.json, src, tsconfig.app.json, tsconfig.json, tsconfig.spec.json, tslint.json 2019-06-19T12:08:01.601Z INFO using existing build configuration angular-web-app-s2i 2019-06-19T12:08:01.609Z INFO using existing image stream angular-web-app 2019-06-19T12:08:01.609Z INFO uploading binary archive /home/zensonic/angular-web-app/tmp/nodeshift/build/archive.tar 2019-06-19T12:08:06.032Z INFO binary upload complete 2019-06-19T12:08:06.033Z INFO waiting for build to finish 2019-06-19T12:08:10.419Z TRACE Using bucharestgold/centos7-s2i-web-app:10.x as the s2i builder image 2019-06-19T12:08:10.860Z TRACE ls: cannot access /tmp/src/node_modules: No such file or directory 2019-06-19T12:08:10.864Z TRACE ---> Installing application source 2019-06-19T12:08:10.882Z TRACE ---> Building your Web Application from source 2019-06-19T12:08:10.883Z TRACE Current git config 2019-06-19T12:08:10.912Z TRACE url.https://github.com.insteadof=git@github.com: 2019-06-19T12:08:10.912Z TRACE url.https://.insteadof=ssh:// 2019-06-19T12:08:10.913Z TRACE url.https://github.com.insteadof=ssh://git@github.com 2019-06-19T12:08:10.913Z TRACE ---> Using 'yarn install' with YARN_ARGS 2019-06-19T12:08:11.670Z TRACE yarn install v1.10.1 2019-06-19T12:08:11.708Z TRACE info No lockfile found. 2019-06-19T12:08:11.715Z TRACE warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. 2019-06-19T12:08:11.719Z TRACE [1/4] Resolving packages... 2019-06-19T12:08:20.615Z TRACE [2/4] Fetching packages... 2019-06-19T12:08:37.498Z TRACE info fsevents@1.2.9: The platform "linux" is incompatible with this module. 2019-06-19T12:08:37.499Z TRACE info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. 2019-06-19T12:08:37.513Z TRACE [3/4] Linking dependencies... 2019-06-19T12:08:43.031Z TRACE [4/4] Building fresh packages... 2019-06-19T12:08:44.030Z TRACE success Saved lockfile. 2019-06-19T12:08:44.035Z TRACE Done in 32.37s. 2019-06-19T12:08:44.299Z TRACE yarn run v1.10.1 2019-06-19T12:08:44.368Z TRACE $ ng build 2019-06-19T12:08:56.658Z TRACE 2019-06-19T12:08:56.658Z TRACE Date: 2019-06-19T12:08:52.745Z 2019-06-19T12:08:56.659Z TRACE Hash: 10631c58ccfba69fc6e8 2019-06-19T12:08:56.659Z TRACE Time: 8543ms 2019-06-19T12:08:56.659Z TRACE chunk {main} main-es5.js, main-es5.js.map (main) 8.67 kB [initial] [rendered] 2019-06-19T12:08:56.660Z TRACE chunk {polyfills} polyfills-es5.js, polyfills-es5.js.map (polyfills) 632 kB [initial] [rendered] 2019-06-19T12:08:56.660Z TRACE chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.08 kB [entry] [rendered] 2019-06-19T12:08:56.660Z TRACE chunk {styles} styles-es5.js, styles-es5.js.map (styles) 16.3 kB [initial] [rendered] 2019-06-19T12:08:56.660Z TRACE chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 3.46 MB [initial] [rendered] 2019-06-19T12:09:02.611Z TRACE 2019-06-19T12:09:02.611Z TRACE Date: 2019-06-19T12:08:58.699Z 2019-06-19T12:09:02.612Z TRACE Hash: ef2d9a7760484269e400 2019-06-19T12:09:02.612Z TRACE Time: 5898ms 2019-06-19T12:09:02.612Z TRACE chunk {main} main-es2015.js, main-es2015.js.map (main) 8.49 kB [initial] [rendered] 2019-06-19T12:09:02.613Z TRACE chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 274 kB [initial] [rendered] 2019-06-19T12:09:02.613Z TRACE chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.08 kB [entry] [rendered] 2019-06-19T12:09:02.613Z TRACE chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 16.3 kB [initial] [rendered] 2019-06-19T12:09:02.613Z TRACE chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 3.35 MB [initial] [rendered] 2019-06-19T12:09:02.692Z TRACE Done in 18.40s. 2019-06-19T12:09:02.700Z TRACE ----> moving built web application to /opt/app-root/output 2019-06-19T12:09:02.709Z TRACE mv: cannot stat './build/*': No such file or directory 2019-06-19T12:09:03.476Z TRACE error: build error: non-zero (13) exit code from bucharestgold/centos7-s2i-web-app:10.x 2019-06-19T12:09:06.295Z ERROR build failed with message: Assemble script failed. 2019-06-19T12:09:06.296Z ERROR Assemble script failed.

[angular-web-app]$ oc version oc v3.11.0+0cbc58b kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift02:8443 openshift v3.11.98 kubernetes v1.11.0+d4cacc0 [angular-web-app]$ npm -v 6.9.0 [angular-web-app]$ npx -v 6.9.0 [angular-web-app]$ node -v v10.16.0

lholmquist commented 5 years ago

That npx nodeshift command looks correct, but it doesn't look like the OUTPUT_DIR env var is getting updated in the build config. I see this:

2019-06-19T12:09:02.700Z TRACE ----> moving built web application to /opt/app-root/output
2019-06-19T12:09:02.709Z TRACE mv: cannot stat './build/*': No such file or directory

DId you happen to run the commands and forgot to add that OUTPUT_DIR because i see this

2019-06-19T12:08:01.601Z INFO using existing build configuration angular-web-app-s2i

That the deployment is using an existing build configuration, to force a new build config to be created you can add the --build.recreate=buildConfig flag when running the nodeshift command

zensonic commented 5 years ago

Hi

You are my hero!

Fair point about an old bc being the issue. Removed it and it worked. Thanks.

Will close the bug.

[angular-web-app]$ oc delete bc/angular-web-app-s2i buildconfig.build.openshift.io "angular-web-app-s2i" deleted

[angular-web-app]$ rm lock.json [angular-web-app]$ npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.x --build.env OUTPUT_DIR=dist/angular-web-app --expose npx: installed 209 in 3.645s

2019-06-19T13:10:24.320Z INFO loading configuration 2019-06-19T13:10:24.327Z INFO using namespace hest42 at https://openshift02:8443 2019-06-19T13:10:24.339Z WARNING a file property was not found in your package.json, archiving the current directory. 2019-06-19T13:10:24.339Z INFO creating archive of .editorconfig, .gitignore, README.md, angular.json, browserslist, e2e, karma.conf.js, package.json, src, tsconfig.app.json, tsconfig.json, tsconfig.spec.json, tslint.json 2019-06-19T13:10:24.404Z INFO creating build configuration angular-web-app-s2i 2019-06-19T13:10:24.405Z INFO Using s2i image bucharestgold/centos7-s2i-web-app with tag 10.x 2019-06-19T13:10:24.426Z INFO using existing image stream angular-web-app 2019-06-19T13:10:24.426Z INFO uploading binary archive /home/zensonic/angular-web-app/tmp/nodeshift/build/archive.tar 2019-06-19T13:10:28.021Z INFO binary upload complete 2019-06-19T13:10:28.022Z INFO waiting for build to finish 2019-06-19T13:10:32.419Z TRACE Using bucharestgold/centos7-s2i-web-app:10.x as the s2i builder image 2019-06-19T13:10:32.592Z TRACE ls: cannot access /tmp/src/node_modules: No such file or directory 2019-06-19T13:10:32.597Z TRACE ---> Installing application source 2019-06-19T13:10:32.606Z TRACE ---> Building your Web Application from source 2019-06-19T13:10:32.606Z TRACE Current git config 2019-06-19T13:10:32.617Z TRACE url.https://github.com.insteadof=git@github.com: 2019-06-19T13:10:32.617Z TRACE url.https://.insteadof=ssh:// 2019-06-19T13:10:32.617Z TRACE url.https://github.com.insteadof=ssh://git@github.com 2019-06-19T13:10:32.620Z TRACE ---> Installing dependencies 2019-06-19T13:10:32.620Z TRACE ---> Using 'npm install' 2019-06-19T13:10:56.668Z TRACE added 1012 packages from 1041 contributors and audited 19005 packages in 23.085s 2019-06-19T13:10:56.672Z TRACE found 0 vulnerabilities 2019-06-19T13:10:56.672Z TRACE 2019-06-19T13:10:56.904Z TRACE npm info it worked if it ends with ok 2019-06-19T13:10:56.904Z TRACE npm info using npm@6.4.1 2019-06-19T13:10:56.904Z TRACE npm info using node@v10.12.0 2019-06-19T13:10:56.960Z TRACE npm info lifecycle angular-web-app@0.0.0~prebuild: angular-web-app@0.0.0 2019-06-19T13:10:56.964Z TRACE npm info lifecycle angular-web-app@0.0.0~build: angular-web-app@0.0.0 2019-06-19T13:10:56.967Z TRACE 2019-06-19T13:10:56.968Z TRACE > angular-web-app@0.0.0 build /opt/app-root/src 2019-06-19T13:10:56.968Z TRACE > ng build 2019-06-19T13:10:56.968Z TRACE 2019-06-19T13:11:08.556Z TRACE 2019-06-19T13:11:08.556Z TRACE Date: 2019-06-19T13:11:04.656Z 2019-06-19T13:11:08.557Z TRACE Hash: 0533cca4990eaee1efa8 2019-06-19T13:11:08.557Z TRACE Time: 8253ms 2019-06-19T13:11:08.557Z TRACE chunk {main} main-es5.js, main-es5.js.map (main) 8.67 kB [initial] [rendered] 2019-06-19T13:11:08.558Z TRACE chunk {polyfills} polyfills-es5.js, polyfills-es5.js.map (polyfills) 546 kB [initial] [rendered] 2019-06-19T13:11:08.558Z TRACE chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.08 kB [entry] [rendered] 2019-06-19T13:11:08.558Z TRACE chunk {styles} styles-es5.js, styles-es5.js.map (styles) 16.3 kB [initial] [rendered] 2019-06-19T13:11:08.558Z TRACE chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 3.46 MB [initial] [rendered] 2019-06-19T13:11:14.504Z TRACE 2019-06-19T13:11:14.504Z TRACE Date: 2019-06-19T13:11:10.604Z 2019-06-19T13:11:14.504Z TRACE Hash: 9ec10e9ed327e84a98b2 2019-06-19T13:11:14.504Z TRACE Time: 5898ms 2019-06-19T13:11:14.505Z TRACE chunk {main} main-es2015.js, main-es2015.js.map (main) 8.49 kB [initial] [rendered] 2019-06-19T13:11:14.505Z TRACE chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 248 kB [initial] [rendered] 2019-06-19T13:11:14.505Z TRACE chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.08 kB [entry] [rendered] 2019-06-19T13:11:14.505Z TRACE chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 16.3 kB [initial] [rendered] 2019-06-19T13:11:14.505Z TRACE chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 3.35 MB [initial] [rendered] 2019-06-19T13:11:14.575Z TRACE npm info lifecycle angular-web-app@0.0.0~postbuild: angular-web-app@0.0.0 2019-06-19T13:11:14.583Z TRACE npm timing npm Completed in 17706ms 2019-06-19T13:11:14.583Z TRACE npm info ok 2019-06-19T13:11:14.584Z TRACE ---> Cleaning up npm cache 2019-06-19T13:11:15.144Z TRACE ----> moving built web application to /opt/app-root/output 2019-06-19T13:11:15.151Z TRACE ---> Fix permissions on app-root 2019-06-19T13:11:38.044Z TRACE 2019-06-19T13:11:38.044Z TRACE Pushing image docker-registry.default.svc:5000/hest42/angular-web-app:latest ... 2019-06-19T13:11:38.366Z TRACE Pushed 0/8 layers, 0% complete 2019-06-19T13:12:02.830Z TRACE Pushed 1/8 layers, 12% complete 2019-06-19T13:12:02.994Z TRACE Push successful 2019-06-19T13:12:07.577Z INFO build angular-web-app-s2i-1 complete 2019-06-19T13:12:07.579Z WARNING No .nodeshift directory 2019-06-19T13:12:07.629Z INFO openshift.yaml and openshift.json written to /home/zensonic/angular-web-app/tmp/nodeshift/resource/ 2019-06-19T13:12:07.638Z INFO creating deployment configuration angular-web-app 2019-06-19T13:12:07.640Z INFO creating new service angular-web-app 2019-06-19T13:12:07.645Z INFO creating new route angular-web-app 2019-06-19T13:12:07.655Z INFO route host mapping angular-web-app-hest42.apps.hest.dk 2019-06-19T13:12:07.658Z INFO complete

[angular-web-app]$ oc get dc NAME REVISION DESIRED CURRENT TRIGGERED BY angular-web-app 1 1 1 config,image(angular-web-app:latest) react-web-app 1 1 1 config,image(react-web-app:latest) [angular-web-app]$ oc get pods NAME READY STATUS RESTARTS AGE angular-web-app-1-56l8d 1/1 Running 0 1m angular-web-app-s2i-1-build 0/1 Completed 0 3m react-web-app-1-48wnd 1/1 Running 0 1h react-web-app-s2i-1-build 0/1 Completed 0 1h

lholmquist commented 5 years ago

:+1:

jared201 commented 4 years ago

stumble on the same issue:

$  npx nodeshift --strictSSL=false --dockerImage=nodeshift/ubi8-s2i-web-app --imageTag=10.x --build.env OUTPUT_DIR=dist/angular-web-app --expose --build.recreate=build Config
npx: installed 218 in 39.336s
2020-08-26T10:29:54.484Z INFO loading configuration
2020-08-26T10:29:54.509Z INFO using namespace ruby-digispace-uat at https://master3.osp.pccw.com:8443
2020-08-26T10:29:54.546Z WARNING a file property was not found in your package.json, archiving the current directory.
2020-08-26T10:29:54.559Z INFO creating archive of .browserslistrc, .editorconfig, .gitignore, angular.json, e2e, karma.conf.js, package-lock.json, package.json, README.md, src, tsconfig.app.json, tsconfig.base.json, tsconfig.json, tsconfig.spec.json, tslint.json
2020-08-26T10:29:54.833Z INFO creating build configuration angular-web-app-s2i
2020-08-26T10:29:54.839Z INFO Using the Source Build Strategy
2020-08-26T10:29:54.841Z INFO Using s2i image nodeshift/ubi8-s2i-web-app with tag 10.x
2020-08-26T10:29:55.281Z INFO creating ImageStream angular-web-app
2020-08-26T10:29:55.436Z INFO uploading binary archive C:\Users\81257354.CORPHQ-HK-PCCW\angular-web-app/tmp/nodeshift/build/archive.tar
2020-08-26T10:30:04.953Z INFO binary upload complete
2020-08-26T10:30:04.955Z INFO waiting for build to finish
2020-08-26T10:30:15.835Z TRACE Using nodeshift/ubi8-s2i-web-app:10.x as the s2i builder image
2020-08-26T10:30:17.150Z TRACE ls: cannot access '/tmp/src/node_modules': No such file or directory
2020-08-26T10:30:17.167Z TRACE ---> Installing application source
2020-08-26T10:30:17.206Z TRACE ---> Building your Web Application from source
2020-08-26T10:30:17.207Z TRACE Current git config
2020-08-26T10:30:17.338Z TRACE ---> Installing dependencies
2020-08-26T10:30:17.343Z TRACE ---> Using 'npm install'
2020-08-26T10:45:34.043Z ERROR build failed with message: Assemble script failed.
2020-08-26T10:45:34.045Z ERROR Assemble script failed.

I'm not running minishift, I'm on full license instance on-premise OpenShift but can't find any meaningful log to see what's causing this issue.