Gitlab CI Different executor per stage

大城市里の小女人 提交于 2019-12-23 02:29:09

问题


Is it possible to have 2 stages in gitlab-ci.yml and one to be run with docker runner but the other to be run with shell?

Imagine I want to run tests in a docker container but I want to run deploy stage in shell locally in the container.


回答1:


Not exactly stages but you can have different jobs to be run by different runners using tags configuration option which should give you exactly what you want.

Add (either during runner creation or later in Project settings -> Runners) tag docker to the Docker runner and tag shell to the shell runner. Then you can set the tags in your .gitlab-ci.yml file:

stages:
  - test
  - deploy

tests:
  stage: test
  tags:
    - docker
  script:
    - [test routine]

deployment:
  stage: deploy
  tags:
    - shell
  script:
    - [deployment routine]


来源:https://stackoverflow.com/questions/38483480/gitlab-ci-different-executor-per-stage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!