'gitlab-runner:Pipeling is pending infinitely

I install a Specific Runners,and the status is actived.

my .gitlab-ci.ymi file code:

stages:
  - build

build_maven:
  stage: build
  only:
    - master
  script:
    - echo "hello CI/CD"
  tags: 
    - vue-dev-pub

when I push the master branch,the gitlab-runner is running,but it's pending infinitely。

the job page show:

This job has not started yet

This job is in pending state and is waiting to be picked by a runner

if I excute the runner manually,the job can pass.

the command of gitlab-runner verify shows:

Runtime platform                                    arch=amd64 os=linux pid=24616 revision=d0b76032 version=12.0.2
WARNING: Running in user-mode.                     
WARNING: The user-mode requires you to manually start builds processing: 
WARNING: $ gitlab-runner run                       
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   
                                                   
Verifying runner... is alive                        runner=T4iKvsT3

I am waiting for you respond,thanks!



Solution 1:[1]

If you run the runner manually in debug mode gitlab-runner --debug run you may see the actual error message, in my case it was:

WARNING: Failed to process runner builds=0 error=failed to update executor: missing Machine options executor=docker+machine runner=pSUsX4yR

That's because on runner creation, I selected option docker+machine rather than docker.

After amending /etc/gitlab-runner/config.toml to docker and running gitlab-runner restart followed by gitlab-runner verify, pipeline started running again.

Solution 2:[2]

I had a similar problem with my (shell) runners on linux. It would work fine on runners installed and registered on one of my computers but not another. (Even as tags matched correctly in runner and job)

After gitlab-runner register I would get:

New runner. Has not connected yet

After gitlab-runner verify that error would go away. But I would get

This job is in pending state and is waiting to be picked by a runner

After gitlab-runner restart

It would all work.

gitlab-runner status

gitlab-runner: Service is running!

Solution 3:[3]

The tags section in your .gitlab-ci.yml file specifies this job has to be picked by a runner that has the same tags (reference).

tags: 
    - vue-dev-pub

So unless there is actually a runner available for your project that has the vue-dev-pub tag it will keep waiting for one to become available.

Solution 4:[4]

Maybe you have tagged your runner but your job has no tags. Refer :how to run untagged jobs enter image description here https://stackoverflow.com/a/53371027/10570524

Solution 5:[5]

first, remove the old config in sys

rm /etc/systemd/system/gitlab-runner.servicetemd

now, you need install gitlab-runner with gitlab user:

gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner

root installations fail

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pramaganus
Solution 2
Solution 3 Stefan van Gastel
Solution 4 Mohammad Noman
Solution 5 Marcelo Guedes