Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
531 views
in Technique[技术] by (71.8m points)

node.js - Gitlab CI/CD hangs when committing changes

Good Evening, I am trying to implement Gitlab CI/CD using the Angular ng test command. The pipeline runs,

but hangs. I know Karma uses chrome. I am not sure what to add. Any help is appreciated thank you.

image: node:latest

before_script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl
    - npm link @angular/cli

stages:
    - test
    - production

unit-test:
    stage: test
    image: trion/ng-cli-karma:${CLI_VERSION}
    script:
        - npm install 
        - ng test
    only:
        - master

production:
    type: deploy
    stage: production
    image: ruby:latest
    script:
        - dpl --provider=heroku --app=$HEROKU_APP_PRODUCTION --api-key=$HEROKU_API_KEY
    only:
        - master
question from:https://stackoverflow.com/questions/65649293/gitlab-ci-cd-hangs-when-committing-changes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Do the tests run and then the pipeline hangs? If that is the case, I bet it is because ng test runs in watch mode and is always running looking for changes.

To fix it, change ng test to ng test --watch=false --browsers=ChromeHeadless.

I changed the browser to be headless Chrome as well (optional) and this should bring a slight increase in speed in your CI/CD

The flags can be found here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...