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

This job is stuck because the project doesn‘t have any runners online assigned to it.Go to Runners,第1张

1.确认gitlab-runner是不是挂了,如果不是绿色的标点就是挂了
2.没有设置Indicates whether this runner can pick jobs without tags
3.在.gitlab-ci.yml指定tags

stages:
  - build 

docker-build:
  stage: build
  tags:
    - mytag # 这里是gitlab-runner的tag

4.重新装一个runner

wget https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
mv gitlab-ci-multi-runner-linux-amd64 /usr/bin/gitlab-runner
chmod +x /usr/bin/gitlab-runner 

mkdir -p /app/gitlab-runner
gitlab-runner install --user=root --working-directory=/app/gitlab-runner

gitlab-runner start
gitlab-runner status

注册
[root@localhost ~]# gitlab-runner register 
Running in system-mode.                            
                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.com/
Please enter the gitlab-ci token for this runner:
aaxxxxxxxxxG
Please enter the gitlab-ci description for this runner:
[localhost.localdomain]: my-runner
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock Runner to current project [true/false]:
[false]: true
Registering runner... succeeded                     runner=aaHC-nZR
Please enter the executor: docker-ssh, parallels, shell, ssh, virtualbox, docker+machine, kubernetes, docker, docker-ssh+machine:
docker
Please enter the default Docker image (e.g. ruby:2.1):
alpine:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 
[root@localhost ~]# gitlab-runner restart
[root@localhost ~]# gitlab-runner status
gitlab-runner: Service is running!

helloworld测试
.gitlab-ci.yml

stages:
  - build 

docker-build:
  stage: build
  image: 
    name: golang
    entrypoint: [""]
  tags:
    - my-tag # 这里是gitlab-runner的tag
  script:
    - pwd
    - ls
    - go build 1.go

1.go

package main
import "fmt"
func main() {
    fmt.Println("1111111")
}

可以看到构建成功。

重新安装runner
https://blog.csdn.net/joy_cz/article/details/90400025
https://www.cnblogs.com/houss/p/11341059.html

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/996091.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存