Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab runner fails to start. This job is stuck because you don't have any active runners online with any of these tags assigned to them: ios

I have a remote runner:

ci$ gitlab-runner --version Version: 12.2.0

The .gitlab-ci.yml :

stages:
  - build
  - deploy

variables:
  LANG: "en_US.UTF-8"
  LC_ALL: "en_US.UTF-8"

build:
  tags:
    - ios
  stage: build
  script:
    - bundle exec fastlane build
  except:
    - develop
    - master
    - /^rc\/.*$/
  environment:
    name: production

deploy:
  tags:
    - ios
  stage: deploy
  before_script:
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
    - ssh -vv [email protected]
    - git config --global user.email "[email protected]"
    - git config --global user.name "username"
    - git branch
    - git branch -r
  script:
    - bundle exec fastlane deploy
  only:
    - develop
    - master
    - /^rc\/.*$/
  environment:
    name: production

post:
  stage: .post
  when: always
  script:
    - bundle exec fastlane clear_data_CI

Gitlab CI fails to run, drops this warning first:

This job is stuck because the project doesn't have any runners online assigned to it.

Go to Runners page And later:

There has been a timeout failure or the job got stuck. Check your timeout limits or try again

So tags are added, but it stopped running. Remote runner is working properly. Any issues?

like image 978
Jkrist Avatar asked Feb 07 '20 08:02

Jkrist


People also ask

How do you fix this job is stuck because the project doesn't have any runners online assigned to it?

Go to the project's Settings > CI/CD and expand the Runners section. Find the runner you want to pick untagged jobs and make sure it's enabled. Click the pencil button. Check the Run untagged jobs option.

Why is my GitLab runner locked?

Thanks! The “locked” tag means it can only be used by specific projects. You haven't said much about your environment, but I guess having a runner on an EC2 instance implies that you're using gitlab.com.


1 Answers

You have to make sure that the remote runner you are referring to is:

  • Actually running
  • Listed as an activated runner in your project's Runners section
  • Configured to follow/listen to the same tags

Go to your repo's Gitlab project settings. Then find the section for CI / CD > Runners. You should see something like the image below:

enter image description here

Here we see that there is a runner (df51f559) configured for the project, and it is running (green). If your repo's .gitlab-ci.yml is using tags, then that runner must also have the same tags. So here, if your job is expecting a runner with ios tag, then this UI should also show the runner to have an ios tag.

You can verify the runner token using gitlab-runner verify or list:

root@buildpc:~# gitlab-runner verify
...
Verifying runner... is alive             runner=df51f559

root@buildpc:~# gitlab-runner list
my-runner                                Executor=docker Token=df51f55995e68cccb3ada8c1458ec7 URL=http://192.168.1.61/

Here my-runner's

  • Token must match the token displayed in the Runners page
  • URL must match the base URL of your Gitlab project

If you can't see an activated runner, that section has instructions on how to register a new runner for your project. You can also refer to Gitlab's Registering Runners help docs.

If you have admin access to your Gitlab instance, you can also go to the Admin dashboard, Runners, select a runner from the available ones, then manually add it to your project. You can also edit the tags.

enter image description here

Lastly, as mentioned in the comments, if you originally had no active runners then you successfully added one, you need to restart the job. AFAIK, when a job gets stuck because there is no runner, it does not automatically resume when a runner becomes available. You'll have to manually retry or re-trigger the job.

like image 97
Gino Mempin Avatar answered Sep 21 '22 18:09

Gino Mempin