0

I'm new to Jenkins environment.

I was asked to upgrade Angular 7.x app which was built 3 to 5 yrs back into Angular 13. Upgrading the Angular app is done. now I want to deploy my UI changes through JENKINs. But my build getting failed. its been 4 days I'm trying to resolve the issues but couldn't make it,

Could someone help me to point out what the exact issue am facing and what needs to be done in order to resolve the build issue.

package.json

{
  "name": "@xxx-some-theme/this-is-my-angular-app-ui",
  "version": "4.1.0",
  "description": "Angular Frontend UI for Fraud Center APP TCC Limits",
  "scripts": {
    "ng": "ng",
    "build": "ng build",
    "build:watch": "ng build --watch",
    "test:ci": "ng test --browsers=ChromeHeadless --watch=false",
    "lint": "eslint --ext .js,.ts src",
    "jenkins": "run-s lint test:jenkins build:jenkins",
    "prebuild": "npm run lint",
    "pretest": "npm run lint",
    "build:jenkins": "ng build --prod --aot --build-optimizer --optimization --progress false",
    "test:jenkins": "ng test --code-coverage --watch false --progress false",
    "postbuild": "save-build-version",
    "postjenkins": "save-build-version"
  },
  "files": [
    "/dist",
    "nginx.conf",
    "mime.types"
  ],
  "dependencies": {
    "@angular/animations": "13.3.11",
    "@angular/cdk": "7.3.5",
    "@angular/common": "13.3.11",
    "@angular/compiler": "13.3.11",
    "@angular/core": "13.3.11",
    "@angular/forms": "13.3.11",
    "@angular/http": "7.2.15",
    "@angular/platform-browser": "13.3.11",
    "@angular/platform-browser-dynamic": "13.3.11",
    "@angular/router": "13.3.11",
    "@ngx-translate/core": "11.0.1",
    "@ngx-translate/http-loader": "4.0.0",
    "cerialize": "0.1.18",
    "chart.js": "3.8.0",
    "core-js": "2.5.3",
    "font-awesome": "4.7.0",
    "lodash": "4.17.5",
    "moment": "2.24.0",
    "moment-timezone": "0.5.23",
    "ngx-bootstrap": "5.5.0",
    "ngx-cookie": "2.0.1",
    "ngx-toastr": "8.2.1",
    "primeicons": "1.0.0",
    "primeng": "9.1.3",
    "quill": "1.3.7",
    "rxjs": "6.5.2",
    "rxjs-compat": "6.6.7",
    "tslib": "^2.4.0",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "13.3.8",
    "@angular-eslint/builder": "13.5.0",
    "@angular-eslint/eslint-plugin": "13.5.0",
    "@angular-eslint/eslint-plugin-template": "13.5.0",
    "@angular-eslint/schematics": "13.5.0",
    "@angular-eslint/template-parser": "13.5.0",
    "@angular/cli": "13.3.8",
    "@angular/compiler-cli": "13.3.11",
    "@angular/language-service": "13.3.11",
    "@types/jasmine": "3.3.12",
    "@types/jasminewd2": "2.0.6",
    "@types/lodash": "4.14.123",
    "@types/moment-timezone": "0.5.12",
    "@types/node": "11.11.6",
    "@typescript-eslint/eslint-plugin": "5.27.1",
    "@typescript-eslint/parser": "5.27.1",
    "codelyzer": "4.5.0",
    "eslint": "^8.17.0",
    "jasmine-core": "3.3.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "6.4.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.5",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.0",
    "karma-phantomjs-launcher": "1.0.4",
    "lodash-es": "4.17.21",
    "npm-run-all": "4.1.5",
    "sass": "1.22.9",
    "sonar-scanner": "3.1.0",
    "ts-node": "8.0.3",
    "tsconfig-paths": "4.0.0",
    "tslib": "2.4.0",
    "tslint": "6.1.3",
    "tslint-sonarts": "1.9.0",
    "typescript": "4.6.4"
  }
}

karma.config.js

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client:{
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '../coverage/ngx-this-is-my-app'),
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true,
      thresholds: {
        global: {
          statements: 80,
          lines: 80,
          branches: 80,
          functions: 80,
        },
      }
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['PhantomJS', 'ChromeHeadless'],
    singleRun: false,
    restartOnFileChange: true,
    customLaunchers: {
      ChromeHeadless: {
        base: "Chrome",
        flags: [
          "--headless",
          "--disable-gpu",
          "--no-sandbox",
          "--remote-debugging-port=9222"
        ],
      }
    },
  });
};

part 1 Error

Key: srcDir Value: null
[Pipeline] echo
Key: nodeVersion Value: 14
[Pipeline] echo
Key: npmCommand Value: npm run jenkins
[Pipeline] echo
Key: preScript Value: [npm ci]
[Pipeline] echo
Key: postScript Value: null
[Pipeline] echo
Key: phantomjs Value: true
[Pipeline] deleteDir
[Pipeline] unstash
[Pipeline] echo
NODE PATH: /SOME-LOCATION/javascript/node-v14.17.3-linux-x64
[Pipeline] tool
[Pipeline] sh
+ curl -f -o phantomjs-2.1.1.zip https://artifacts.TEST-COMPANY.int/artifactory/maven-external-release/phantomjs/phantomjs/2.1.1/phantomjs-2.1.1.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 43 24.9M   43 10.8M    0     0  9277k      0  0:00:02  0:00:01  0:00:01 9277k
100 24.9M  100 24.9M    0     0  17.6M      0  0:00:01  0:00:01 --:--:-- 17.6M
[Pipeline] sh
+ unzip -o phantomjs-2.1.1.zip
Archive:  phantomjs-2.1.1.zip
  inflating: phantomjs-static        
[Pipeline] sh
+ mkdir -p bin
[Pipeline] sh
+ mv phantomjs-static bin/phantomjs
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ npm ci

> [email protected] install /SOME-LOCATION/jenkins/workspace/we-dont-need-this/PLEASE/IGNORE/THIS/node_modules/nice-napi
> node-gyp-build

gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: connect ETIMEDOUT dummy-ip-address:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
gyp ERR! System Linux 3.10.0-1160.59.1.el7.x86_64
gyp ERR! command "/SOME-LOCATION/javascript/node-v14.17.3-linux-x64/bin/node" "/SOME-LOCATION/javascript/node-v14.17.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /SOME-LOCATION/jenkins/workspace/we-dont-need-this/PLEASE/IGNORE/THIS/node_modules/nice-napi
gyp ERR! node -v v14.17.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

part 2 Error

- primeng/spinner [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/splitbutton [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/steps [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/table [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/tabmenu [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/tabview [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/terminal [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/tieredmenu [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/toast [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/togglebutton [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/toolbar [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/treetable [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/tree [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/tristatecheckbox [es2015/esm2015] (https://github.com/primefaces/primeng)
- primeng/virtualscroller [es2015/esm2015] (https://github.com/primefaces/primeng)
- @another-custom/lib-common [es2015/esm2015] (git+https://globalrepository.company-local.int/stash/scm/app-name/ngx-demo.git)
- @another-custom-2/lib-common [es2015/esm2015] (git+https://globalrepository.company-local.int/stash/scm/app-name/ngx-demo-utils.git)
- @another-custom-3/lmodel-data [es2015/esm2015] (git+https://globalrepository.company-local.int/stash/scm/app-name/cc-demo-data-model.git)
- primeng [es2015/esm2015] (https://github.com/primefaces/primeng)
Encourage the library authors to publish an Ivy distribution.
09 08 2022 01:13:36.349:INFO [karma-server]: Karma v6.4.0 server started at http://localhost:9876/
09 08 2022 01:13:36.352:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
09 08 2022 01:13:36.357:INFO [launcher]: Starting browser Chrome
09 08 2022 01:13:36.358:ERROR [launcher]: No binary for Chrome browser on your platform.
  Please, set "CHROME_BIN" env variable.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CUSTOM/LIBRARY/WE/CAN/IGNORE/[email protected] test:jenkins: `ng test --code-coverage --watch false --progress false`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the CUSTOM/LIBRARY/WE/CAN/IGNORE/[email protected] test:jenkins script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     SOME-LOCATION/jenkins/workspace/WE/CAN/IGNORE/THIS/nodejs_data/.npm/_logs/2022-08-09T06_13_36_812Z-debug.log
ERROR: "test:jenkins" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CUSTOM/LIBRARY/WE/CAN/IGNORE/[email protected] jenkins: `run-s lint test:jenkins build:jenkins`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the CUSTOM/LIBRARY/WE/CAN/IGNORE/[email protected] jenkins script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     SOME-LOCATION/jenkins/workspace/WE/CAN/IGNORE/THIS/nodejs_data/.npm/_logs/2022-08-09T06_13_36_957Z-debug.log
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] echo
Error during processing of stage BuildNodeApplication caused by script returned exit code 1
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] echo
hudson.AbortException: script returned exit code 1

What am I doing wrong? What needs to be done here?

1 Answer 1

0

Part one is a failure to install node-gyp. The error is a connection timeout to some ipaddress:

stack Error: connect ETIMEDOUT dummy-ip-address:443 

The second error is because chrome is not installed on the Jenkins Agents where you are running the build.

09 08 2022 01:13:36.358:ERROR [launcher]: No binary for Chrome browser on your platform.
  Please, set "CHROME_BIN" env variable.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CUSTOM/LIBRARY/WE/CAN/IGNORE/[email protected] test:jenkins: `ng test --code-coverage --watch false --progress false`
npm ERR! Exit status 1

Neither of these are really "Jenkins" issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.