Jump to content

Циклы для gitlab-ci


TidalPoo
 Share

Recommended Posts

Иногда работая с gitlab ci/cd требуется в цикле запустить какую-либо job с разными переменными. Чаще для таких целей делают вот так:

.job_template: &job_template
  stage: build
  variables:
    key: value1
  script:
    - echo "Hello World $key"

job1:
  <<: *job_template
  variables:
    key: value2


job2:
  <<: *job_template
  variables:
    key: value3


job3:
  <<: *job_template
  variables:
    key: value4

Но с версии 14.1 можно использовать "параллельные матрицы":

job:
  stage: build
  script:
    - echo "Hello World $key"
  parallel:
    matrix:
      - key: value1
      - key: value2
      - key: value3
      - key: value4

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...