Gitlab Windows runner 收到作业时转为不运行

Posted

技术标签:

【中文标题】Gitlab Windows runner 收到作业时转为不运行【英文标题】:Gitlab Windows runner turns to not running when receive a job 【发布时间】:2019-11-25 07:26:27 【问题描述】:

我完全按照官方document设置我的Windows运行器,我可以成功注册和安装运行器,我在注册执行器时使用shell,启动运行器后检查状态,它显示运行没有任何问题。但是当我触发一个带有 windows runner 标记的作业时,该作业会一直挂起,当我再次检查 runner 状态时,它会变成 not running

我在 Window 7 和 Window 10 上都试过了,都遇到了同样的问题。

我也试着跑了

gitlab-runner --debug run

但日志只是显示跑步者可以接收作业,但无声无息地崩溃了。

C:\GitLab-Runner>gitlab-runner.exe --debug run
Runtime platform                                    arch=amd64 os=windows pid=15912 revision=d0b76032 version=12.0.2
Starting multi-runner from C:\GitLab-Runner\config.toml ...  builds=0
Checking runtime mode                               GOOS=windows uid=-1
Configuration loaded                                builds=0
listenaddress: ""
sessionserver:
  listenaddress: ""
  advertiseaddress: ""
  sessiontimeout: 1800
concurrent: 1
checkinterval: 0
loglevel: null
logformat: null
user: ""
runners:
- name: window 10
  limit: 0
  outputlimit: 0
  requestconcurrency: 0
  runnercredentials:
    url: https://gitlab.com/
    token: 6e46f139636cfea3ce2301be1b4225
    tlscafile: ""
    tlscertfile: ""
    tlskeyfile: ""
  runnersettings:
    executor: shell
    buildsdir: ""
    cachedir: ""
    cloneurl: ""
    environment: []
    preclonescript: ""
    prebuildscript: ""
    postbuildscript: ""
    debugtracedisabled: false
    shell: powershell
    custombuilddir:
      enabled: false
    ssh: null
    docker: null
    parallels: null
    virtualbox: null
    cache:
      type: ""
      path: ""
      shared: false
      s3:
        serveraddress: ""
        accesskey: ""
        secretkey: ""
        bucketname: ""
        bucketlocation: ""
        insecure: false
      gcs:
        cachegcscredentials:
          accessid: ""
          privatekey: ""
        credentialsfile: ""
        bucketname: ""
    machine: null
    kubernetes: null
sentrydsn: null
modtime: 2019-07-16T14:59:02.7487831+02:00
loaded: true
  builds=0
listen_address not defined, metrics & debug endpoints disabled  builds=0
[session_server].listen_address not defined, session endpoints disabled  builds=0
Starting worker                                     builds=0 worker=0
Feeding runners to channel                          builds=0
Dialing: tcp gitlab.com:443 ...
Checking for jobs... nothing                        runner=6ee6f139
Feeding runners to channel                          builds=0
Checking for jobs... nothing                        runner=6ee6f139
Feeding runners to channel                          builds=0
Checking for jobs... received                       job=33225 repo_url=https://gitlab.com/my-project/repo.git runner=6ee6f139
Failed to requeue the runner:                       builds=1 runner=6ee6f139
Running with gitlab-runner 12.0.2 (d0b76032)        job=33225 project=278 runner=6ee6f139
  on window 10 6ee6f139                             job=33225 project=278 runner=6ee6f139
Shell configuration: environment: []
dockercommand:
- PowerShell
- -NoProfile
- -NoLogo
- -InputFormat
- text
- -OutputFormat
- text
- -NonInteractive
- -ExecutionPolicy
- Bypass
- -Command
- '-'
command: powershell
arguments:
- -noprofile
- -noninteractive
- -executionpolicy
- Bypass
- -command
passfile: true
extension: ps1
  job=33225 project=278 runner=6ee6f139
Using Shell executor...                             job=33225 project=278 runner=6ee6f139
Waiting for signals...                              job=33225 project=278 runner=6ee6f139
Executing build stage                               build_stage=prepare_script job=33225 project=278 runner=6ee6f139
Executing build stage                               build_stage=get_sources job=33225 project=278 runner=6ee6f139

【问题讨论】:

【参考方案1】:

我设法找出原因。 我的GitLab版本是11.4.0-ee,Windows gitlab runner版本是12.0.2,从日志可以看出。在我将运行器降级到版本 11.11.4 后,它可以立即运行,没有任何问题。在作业日志中,我可以看到一条消息:

DEPRECATION: this GitLab server doesn't support refspecs, gitlab-runner 12.0 will no longer work with this version of GitLab

我认为升级 Gitlab 服务器应该也能解决问题。这是版本不匹配的问题。

【讨论】:

以上是关于Gitlab Windows runner 收到作业时转为不运行的主要内容,如果未能解决你的问题,请参考以下文章

GItlab作CI/CD时,想快点,有啥招?

Gitlab windows Runner lastcontact 显示从不

在带有 Docker 桌面的 GitLab CI 管道上使用适用于 Windows 的 Gitlab-Runner

GitLab Runner 在 32 位 Windows 上的问题

Windows 上的 Gitlab Build Runner 使用 HTTP 而不是 SSH

Windows 10 OpenSSH ssh-add“代理拒绝操作”(GitLab Windows Shared Runner)