Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to continue running scripts if one of them fails? GITLAB CI

here is my yml file:

stages:
  - testing
  - deploy 

docker_job:
  stage: testing
  tags:
    - docker
  image: atools/chrome-headless:java11-node14-latest 
  
  before_script:
    - npm ci 
    - npx playwright install 
    - npm install allure-commandline --save-dev
  
  script:
    - npm run BookingTestDEV --project=BookingTesting
    - npx playwright test --project=BookEngineTests
    - npm run BookingTestNEO --project=BookingTesting


  after_script:
    - npx allure generate allure-results --clean 
  rules:
      - when: always
  allow_failure: true
  artifacts: 
    when: always
    paths:
      - ./allure-report
    expire_in: 7 day 

pages: 
  stage: deploy
  script:
    - mkdir public 
    - mv ./allure-report/* public
  artifacts:
    paths:
      - public
  rules:
    - when: always
    

if first script
– npm run BookingTestDEV –project=BookingTesting fails, other will be skipped, how to run them anyway ? is there any analog of if(): always like on github ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In most cases, the pipeline should fail if one of the commands throws an exit code that is not 0. However, in some cases, the rest of the commands should run anyway. A possible solution for this would be to add || true at the end of the command.

For example:

 script:
    - npm run BookingTestDEV --project=BookingTesting || true
    - npx playwright test --project=BookEngineTests
    - npm run BookingTestNEO --project=BookingTesting
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading