简体   繁体   English

(gitlab-runner) Docker 在 0 秒后完成

[英](gitlab-runner) Docker finishes after 0 seconds

This is the log.这是日志。

Running with gitlab-runner 13.0.1 (xxx)
  on x-runner xxx
Preparing the "docker" executor
Job succeeded

The Job succeeded message comes after 0 seconds after the Preparing the "docker" executor message. Job succeeded消息在Preparing the "docker" executor消息后 0 秒后出现。

The scripts is echo hello and npm ci脚本是echo hellonpm ci


Update : When I do docker exec -it gitlab-runner gitlab-runner --debug run , I get the error panic: runtime error: invalid memory address or nil pointer dereference after starting a pipeline.更新:当我执行docker exec -it gitlab-runner gitlab-runner --debug run时,我得到错误panic: runtime error: invalid memory address or nil pointer dereference在启动管道后。 How do I fix this?我该如何解决?


Update :更新

Versions版本

gitlab: 12.9.0
gitlab-runner: 13.0.1
docker: 19.03.11, build 42e35e61f3

Config配置

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "nuc-runner"
  url = "https://gitlab.x.y/"
  token = "xyz"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

Update :更新

.gitlab-cli.yml .gitlab-cli.yml

# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options

stages:
  - install
  - build
  - test
  - clean

build:
  stage: build
  script: npm run build

install:
  stage: install
  script: npm ci

test:
  stage: test
  script: npm run test

clean:
  stage: clean
  script: npm run clean


Update更新

When I type当我输入

root@xxxxxxxxxxxx:/# gitlab-runner status

Stdout标准输出

Runtime platform                                    arch=amd64 os=linux pid=365 revision=21cb397c version=13.0.1
gitlab-runner: Service is not running.

It turns out to not be the config in any way that caused the error.事实证明,这不是导致错误的任何方式的配置。 I didn't install the runner correctly.我没有正确安装跑步者。 Another error was gitlab-runner service not starting as mentioned here that was caused by installing gitlab-runner via apt.另一个错误是 gitlab-runner 服务没有像这里提到的那样启动,这是由通过 apt 安装 gitlab-runner 引起的。

How to solve installed with apt problem.如何解决安装 apt 的问题。

$ sudo su
root:~# cd /var/lib
root:/var/lib# mkdir gitlab-runner
root:/var/lib# chown gitlab-runner:gitlab-runner gitlab-runner/
root:/var/lib# service gitlab-runner restart

How to solve not installed correctly problem.如何解决未正确安装的问题。

$ gitlab-runner install -u root
$ sudo reboot

I don't see an image definition in any of the stages.我在任何阶段都没有看到image定义。 Without that, I don't think there's anything for the docker executor to do.没有它,我认为 docker 执行器无事可做。 I'm only used to seeing the script section listed as an array, not sure if the string value is also valid.我只习惯于将脚本部分列为数组,不确定字符串值是否也有效。 The result, if you want to use the node:lts image to run these, would look like:结果,如果您想使用node:lts图像来运行这些,将如下所示:

stages:
  - install
  - build
  - test
  - clean

build:
  stage: build
  image: node:lts
  script:
  - npm run build

install:
  stage: install
  image: node:lts
  script:
  - npm ci

test:
  stage: test
  image: node:lts
  script:
  - npm run test

clean:
  stage: clean
  image: node:lts
  script:
  - npm run clean

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM