简体   繁体   中英

How many Gitlab runners I need for n environments

I am new in gitlab, I would like to know: does a runner serve for every environment in a gitlab pipeline?. or I need to install a runner for every stage?

You can have one gitlab runner for all stages.

You need to have different gitlab runners if you need to have different environments for your jobs, and if you are using a shell executor. Imagine that you have two different servers, where the first one has all the compilers and tools needed to build your program while your second server has all the programs that you need for testing it. You could then set up a gitlab runner on each of these servers, and use a tag to differ between them. The first runner could then have build as the tag while the second could have test . In your jobs you could then have:

build-job:
  tags:
    - build
  script:
    - msbuild myproject.sln
  artifacts:
    paths:
      - my-project-test.exe

test-job:
  tags:
    - test
  script:
    - .\my-project-test.exe

The build job would then be picked up by any gitlab runner that you have defined that has the tag build . In the same way, your test job would be picked up by a gitlab runner that has the tag test .

You can also have multiple runners with the same tags if you need to be able to have many builds/tests running at the same time on different servers. If you have many gitlab runners with the tag build , the jobs with the tag build would be distributed equally among these runners.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM