gitlab-cigitlab-ci-runner

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


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.


Solution

  • 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