gitlab runner 问题汇集

gitlab runner 需要版本尽量和gitlab一致

 

1. gitlab docker executor: 错误  " gitlab runner Could not resolve host:   abc.com "

fatal: unable to access 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.localhost.com/root/test.git/': Could not resolve host: gitlab.localhost.co

 

  需要在docker executor内增加一句  "network_mode = "host"

vim /etc/gitlab-runner/config.toml

[[runners]]
  name = "docker"
  url = "xxx"
  id = 10
  token = "xxx"
  token_obtained_at = 2023-04-19T04:28:16Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.docker]
    tls_verify = false
    image = "ubuntu:20.04"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    network_mode = "host"

refer: https://stackoverflow.com/questions/50325932/gitlab-runner-docker-could-not-resolve-host

  

 

2. gitlab shell executor 错误:

"gitlab shell Job failed: prepare environment: exit status 1."

解决方法, 注释掉 /home/gitlab-runner/.bash_logout 的所有内容

# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

#if [ "$SHLVL" = 1 ]; then
#    [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
#fi

 

 refer : https://stackoverflow.com/questions/63154881/the-runner-of-type-shell-dont-work-job-failed-system-failure-preparing-envi

 

posted @ 2023-04-19 15:12  戴维德善业福  阅读(89)  评论(0编辑  收藏  举报