Skip to content

Running multiple jobs though concurrent is set to 1 in config.toml

We are using Macs as GitLab runners to build our iOS applications. We have multiple projects with build and test jobs in their pipelines and each project has multiple kinds of build jobs. Due to the fact Apple Xcode allows building one project at a time, we want to make sure only one build job runs in one runner(Mac) at any given time.

We have only one runner configured in our Mac and set the configuration concurrent=1 and limit=1 as per this documentation. With this configuration, we expect only one job to run on a given runner at any given time, but we found out that two jobs are running at the same time on the same runner with this configuration. I found it very confusing and dangerous.

Here is the runner config file we have

% cat ~/.gitlab-runner/config.toml
concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "gitlab-runner-mac-01"
  limit = 1
  output_limit = 65535
  url = "https://gitlab.xxx.com"
  token = "xxxxxxxxxxxxx"
  executor = "shell"
  [runners.custom_build_dir]
    enabled = true
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Here is the Gitlab runner version we ae using

Version:      14.9.1
Git revision: bd40e3da
Git branch:   14-9-stable
GO version:   go1.17.8
Built:        2022-03-22T21:20:41+00:00
OS/Arch:      darwin/amd64

GitLab Enterprise Edition 14.9.5-ee

Here is our gitlab-ci.yml file config where we have set up the same gitlab runner to every job and we are expecting all jobs to be triggered sequentially as we have configured the runner to run only one job at a time. But we found out build-job1 and build-job2 started at the same time on the same gitlab-runner-mac-01 runner which is very confusing.

stages:          # List of stages for jobs, and their order of execution
  - build
  - test
  - deploy

build-job1:       # This job runs in the build stage, which runs first.
  stage: build
  script:
    - echo "Compiling the code..."
    - echo "Compile complete."
    - sleep 60
  tags:
    - gitlab-runner-mac-01

build-job2:       # This job runs in the build stage, which runs first.
  stage: build
  script:
    - echo "Compiling the code..."
    - echo "Compile complete."
    - sleep 60
  tags:
    - gitlab-runner-mac-01

build-job3:       # This job runs in the build stage, which runs first.
  stage: build
  script:
    - echo "Compiling the code..."
    - echo "Compile complete."
    - sleep 60
  tags:
    - gitlab-runner-mac-01

unit-test-job:   # This job runs in the test stage.
  stage: test    # It only starts when the job in the build stage completes successfully.
  script:
    - echo "Running unit tests... This will take about 60 seconds."
    - sleep 60
    - echo "Code coverage is 90%"
  tags:
    - gitlab-runner-mac-01

lint-test-job:   # This job also runs in the test stage.
  stage: test    # It can run at the same time as unit-test-job (in parallel).
  script:
    - echo "Linting code... This will take about 10 seconds."
    - sleep 60
    - echo "No lint issues found."
  tags:
    - gitlab-runner-mac-01

deploy-job:      # This job runs in the deploy stage.
  stage: deploy  # It only runs when *both* jobs in the test stage completed successfully.
  script:
    - echo "Deploying application..."
    - echo "Application successfully deployed."
  tags:
    - gitlab-runner-mac-01

Screen_Shot_2022-07-08_at_12.14.57_PM

I think it's the basic and important feature in a runner. I have read all documentation and tried everything but looks like this is how it's working. Looks like there is a bug with gitlab-runner?

I am happy to try any suggestions and provide more details if needed to debug this issue. We are

Edited by Sridhar Nelloru