Shell 类型的 Runner 不起作用:作业失败(系统故障):准备环境:

Art*_*ius 8 gitlab gitlab-ci-runner gitlab-ce

1-环境:

  • Gitlab-CE
  • GitLab 13.2.1 (b55baf593e6)
  • 亚搏体育应用外壳 13.3.0
  • 亚搏体育app主力v8.37.0
  • GitLab API v4
  • 红宝石 2.6.6p146
  • 导轨 6.0.3.1
  • PostgreSQL 11.7
  • Debian GNU / Linux 10 服务器(破坏者)

2- .gitlab-ci.yml 文件:

before_script:
  - echo "--------- STARTING WORK ------------"

job_homologacao:
   only:
     - homologation
   script:
     - cd /home/ati/
     - mkdir test
     - echo "got here"

job_producao:
   only:
     - master
   script:
     - cd /home/ati/test/
     - echo "got here"
Run Code Online (Sandbox Code Playgroud)

3- 执行 运行程序时出现错误:在运行程序上使用 gitlab-runner 13.2.1 (efa30e33) 运行,使用 Akx_BvYF shell 准备“shell”执行器使用 Shell 执行程序...准备环境在 Hermes 上运行...错误:作业失败(系统故障):准备环境:退出状态 1. 检查https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading了解更多信息

4- 更正尝试: 我阅读并执行了代码中包含的所有程序:

Art*_*ius 29

我错误地编辑了位于我的 Home /home/ati/ 中的文件 .bash_logout

Gitlab 安装 gitlab-runner 时在 /home/gitlab-runner/ 为他创建一个 Home

我只需要对 /home/gitlab-runner/.bash_logout 文件的内容发表评论,就可以使工作正常进行。

  • 我将该文件重命名为 .bash_logout_bkp。发现这个方法比较简单。 (4认同)
  • 我希望他们(gitlab)在[链接](https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading)的文档中添加这一点 (2认同)

gpo*_*ier 15

如果您的跑步者在 Ubuntu 20.04 上,请查看:https : //gitlab.com/gitlab-org/gitlab-runner/-/issues/26605

解决方案:

sudo rm /home/gitlab-runner/.bash_logout
Run Code Online (Sandbox Code Playgroud)


shi*_*tel 5

首先找到 gitlab runner 的主目录。

$ ps aux | grep gitlab-runner
/usr/bin/gitlab-runner run --working-directory /var/lib/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner
Run Code Online (Sandbox Code Playgroud)

现在,检查.bash_logout是否存在。

$ ls -lah /var/lib/gitlab-runner/
total 20K
drwxr-xr-x  4 gitlab-runner root          4.0K Dec  1 02:53 .
drwxr-xr-x 42 root          root          4.0K Nov 11 03:29 ..
-rwxr--r--  1 gitlab-runner gitlab-runner   30 Dec  1 02:53 .bash_logout
drwxr-xr-x  2 gitlab-runner gitlab-runner 4.0K Dec  1 02:26 .terraform.d
drwxrwxr-x  3 gitlab-runner gitlab-runner 4.0K Nov 11 03:23 builds
Run Code Online (Sandbox Code Playgroud)

最后,打开.bash_logout文件并注释掉所有行并保存。

 $ vim /var/lib/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
Run Code Online (Sandbox Code Playgroud)

ps:最初的答案是由Jonathan Allen Jonathan Allen (@sc_jallen)在 gilab-runner 问题上给出的。