How do I create 2 jobs that run on different platforms?

北城余情 提交于 2019-12-01 22:18:35

问题


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.

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.


回答1:


You can use the tag system for runner.

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.

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

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 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


来源:https://stackoverflow.com/questions/32412248/how-do-i-create-2-jobs-that-run-on-different-platforms

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