gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Select executor type based on job tags

Open yangm97 opened this issue 8 months ago • 2 comments

Is your feature request related to a problem? Please describe.

Some pipelines use more than one runner type, for instance docker on build and shell on deploy, or a build for macOS and another for Linux.

The gitlab-runner daemon itself supports declaring multiple runners on the same machine and jobs are distributed based on tags.

Describe the solution you'd like

In order to mimic the behavior of distributing the jobs from a pipeline to multiple runners the user would set a set of mappings of tag->executor_type.

It may be useful to implement some defaults based on common usage patterns. From the official documentation we get examples such as:

  • dind for docker-in-docker
  • macos, saas-macos-medium-m1, saas-macos-large-m2pro for shell on macOS
  • shell for shell on Linux

Describe alternatives you've considered

A workaround for this is to not run the pipeline all at once but rather "micro-manage" each step so the correct executor can be enforced.

Additional context Add any other context or screenshots about the feature request here.

yangm97 avatar Apr 09 '25 19:04 yangm97

I'm not sure I understand how this would benefit your local flow Please attach a good example that illustrates problems that this feature would address.

firecow avatar Apr 13 '25 11:04 firecow

Hi, it will also help me in my case : I have a .gitlab-ci.yml which has build stage for both OS: windows and linux and the only way to differentiate the jobs are tags :

build:windows-shared:
  stage: build
  tags:
    - win10
    - build
  script:
    - cmake.exe -S . -B CI -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" -DBUILD_SHARE .....
    - cmake.exe --install CI --config Release
    - cd CI
    - ctest.exe --output-on-failure -C Release
  artifacts:
    paths:
      - CI
    expire_in: 2 hour

build:ubuntu-static:
  stage: build
  tags:
    - ubuntu
    - build
  script:
    - cmake -S . -B CI -DCMAKE_BUILD_TY ......
    - cd CI
    - ctest --output-on-failure -C Release
  artifacts:
    paths:
      - CI
    expire_in: 2 hour

jclaisse avatar Apr 24 '25 15:04 jclaisse