如果其中一个脚本失败,如何继续 运行 个脚本? GITLAB CI

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

这是我的 yml 文件:

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
    

如果第一个脚本 - npm 运行 BookingTestDEV --project=BookingTesting 失败,其他将被跳过,如何 运行 他们呢?有没有 if(): always like on github 的类似物?

在大多数情况下,如果其中一个命令抛出非 0 的退出代码,管道应该会失败。但是,在某些情况下,其余命令应该 运行 无论如何。一个可能的解决方案是在命令末尾添加 || true

例如:

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