如何创建在不同平台上运行的2个作业? [英] How do I create 2 jobs that run on different platforms?

查看:43
本文介绍了如何创建在不同平台上运行的2个作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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:

  1. OS X v10.9小牛:osxosx_v10.9
  2. OS X v10.10优胜美地:osxosx_v10.10
  3. OS X v10.11 El Capitan:osxosx_v10.11
  1. OS X v10.9 Mavericks: osx and osx_v10.9
  2. OS X v10.10 Yosemite: osx and osx_v10.10
  3. OS X v10.11 El Capitan: osx and osx_v10.11

这篇关于如何创建在不同平台上运行的2个作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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