Gitlab CI每个阶段有不同的执行器 [英] Gitlab CI Different executor per stage

查看:209
本文介绍了Gitlab CI每个阶段有不同的执行器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可能在gitlab-ci.yml中有两个阶段,一个阶段用dockerRunner运行,而另一个阶段用shell运行?

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?

想象一下,我想在docker容器中运行测试,但是我想在容器本地的shell中运行deploy阶段.

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

推荐答案

不完全是阶段,但是您可以使用

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.

添加(在运行器创建期间或以后在项目设置->运行器中)将 docker 标记添加到Docker运行器,并将 shell 标记添加到Shell运行器.然后,您可以在 .gitlab-ci.yml 文件中设置tags:

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]

这篇关于Gitlab CI每个阶段有不同的执行器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆