如何创建在不同平台上运行的2个作业? [英] How do I create 2 jobs that run on different platforms?
问题描述
我正在使用Gitlab-ci-multi-runner,使用OSX机器(bash shell)和Windows 7机器(batch命令).每当我推动时,我都希望它在两个跑步者上进行构建和测试.但是显然,每个平台的命令需要略有不同.我不想使用docker.
I'm using the Gitlab-ci-multi-runner, using an OSX machine (bash shell) and a Windows 7 machine (batch commands). Whenever I push I want it to build and test on both runners. But obviously the commands need to be slightly different for each platform. I do not wish to use docker.
我一直在查看 http://doc.gitlab.com/ci/yaml/README.html ,但似乎没有关于某个阶段的特定流道耦合的任何信息.
I've been looking at http://doc.gitlab.com/ci/yaml/README.html but there doesn't seem to be anything about specific runner coupling for a stage.
推荐答案
您可以将标签系统用于跑步者.
You can use the tag system for runner.
我想你有两个跑步者.带有windows
作为标签的Windows和带有osx
作为标签的OS X.
I suppose that you have two runner. The Windows one with windows
as tag and the OS X one with osx
as tag.
因此,现在您可以在运行之前按回收标签选择跑步者.
So, now you can select runner by reclaim tag before running.
使用的.gitlab-ci.yml应该是这样的:
The used .gitlab-ci.yml should be like this:
MyWindowsJob:
tags:
- windows
script:
- echo Say hello from windows
MyOSXJob:
tags:
- osx
script:
- uname -a
- echo Say hello from osx
如果要在多个版本的os上构建,则最好在标记中添加版本号.例如:
If you will build on more than one version of os you should better add version number in tag. For example:
- OS X v10.9小牛:
osx
和osx_v10.9
- OS X v10.10优胜美地:
osx
和osx_v10.10
- OS X v10.11 El Capitan:
osx
和osx_v10.11
- OS X v10.9 Mavericks:
osx
andosx_v10.9
- OS X v10.10 Yosemite:
osx
andosx_v10.10
- OS X v10.11 El Capitan:
osx
andosx_v10.11
这篇关于如何创建在不同平台上运行的2个作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!