Axel Steiner
Axel Steiner

Reputation: 23

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"

Upvotes: 1

Views: 2143

Answers (1)

swysocki
swysocki

Reputation: 1076

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"

Upvotes: 2

Related Questions