Gitlab CI管道出现作业失败和超时错误

时间:2020-01-09 06:52:25

标签: node.js angularjs gitlab gitlab-ci

Gitlab管道构建无法继续进行,并且卡在了Chrome启动器上

09 01 2020 06:47:03.311:WARN [发射器]:ChromeHeadless还没有 在60000毫秒内捕获,杀死。 2020年9月1日06:47:05.315:警告 [发布者]:ChromeHeadless并未在2000毫秒内被杀死,因此发送了SIGKILL。 2020年9月1日06:47:07.318:警告[发射器]:ChromeHeadless未被杀死 由SIGKILL在2000毫秒内继续进行。

这里是gitlab-ci.yml

image: node:latest

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/

before_script:
  - cd frontend
  - export CHROME_BIN=/usr/bin/google-chrome
  - apt-get update && apt-get install -y unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
  - npm install -g @angular/cli
  - npm uninstall --save-dev node-sass
  - npm install --save-dev node-sass@4.13.0
  - npm uninstall --silent
  - npm i --save-dev puppeteer
  - export NODE_ENV=development
  - npm install --silent
  - npm rebuild node-sass
  - npm i -D karma-chrome-launcher


stages:
  - test
  - build

job 1:
  stage: test
  script:
  - node_modules/.bin/ng test --browsers ChromeHeadless --watch=true

job 2:
  stage: test
  script: node_modules/.bin/ng e2e --browsers ChromeHeadless --watch=true
release_job:
  stage: build
  script: node_modules/.bin/ng build --prod --aot
  artifacts:
    name: "project-$CI_COMMIT_REF_NAME"
    paths:
      - dist/
  only:
    - tags

这里是karma.config.js

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const process = require('process');
process.env.CHROME_BIN='/usr/bin/google-chrome'
process.env.NO_PROXY = 'localhost, 0.0.0.0/4201, 0.0.0.0/9876';
module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-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: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome_no_sandbox','Chrome_without_security','ChromeHeadless'],
    singleRun: false,
    customLaunchers: {
      Chrome_no_sandbox: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      },
      Chrome_without_security: {
        base: 'Chrome',
        flags: ['--disable-web-security', '--disable-site-isolation-trials','--remote-debugging-port=9222']
      }
    },
    concurrency: Infinity,
    singleRun: true
  });
};

0 个答案:

没有答案