简体   繁体   中英

Gitlab CI job parallel on different runners

I need to run 2 jobs parallel on a different OS. For this scenario I've to active runners on different servers with the required OS. Each runner has a unique tag, which I use for the jobs. But the jobs are running sequential, not parallel. Is there any keyword which I have to use, to run both jobs parallel?

my gitlab-ci.yml

stages:
  - test

rhel8:
  stage: test
  rules:
    - if: $TEST == "rhel8" || $TEST == "all"
  tags:
    - rhel8
  script:
    - echo "Test  RHEL 8"

rhel7:
  stage: test
  rules:
    - if: $TEST == "rhel7" || $TEST == "all"
  tags:
    - rhel7
  script:
    - echo "Test RHEL 7"

The parallel keyword is what you are looking for. Here is an example of using it to run the same job with different runner tags:

stages:
 - test

rhel:
  stage: test
  rules:
    - if: $TEST =~ '/^rhel.*/' || $TEST == "all"
  parallel:
    matrix:
      - TEST: rhel7
      - TEST: rhel8
  tags:
    - $TEST
  script:
    - echo "Test $TEST"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM