GitLab非根自托管的Runner失败,显示“没有这个文件或目录”。

huangapple go评论60阅读模式
英文:

GitLab non-root self-managed runners fail with "No such file or directory"

问题

以下是您要翻译的内容:

"I'm running a GitLab non-root self-managed runners as a daemon

$ cat /etc/systemd/system/gitlab-runner-ansible.service
[Unit]
Description=GitLab Runner as ansible
After=syslog.target network.target
ConditionFileIsExecutable=/usr/local/bin/gitlab-runner

[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/local/bin/gitlab-runner "run" "--working-directory" "/home/ansible" "--config" "/home/ansible/.gitlab-runner/config.toml" "--service" "gitlab-runner-ansible" "--syslog" "--user" "ansible"

Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target

and I registered a runner

$ gitlab-runner list
Runtime platform                                    arch=amd64 os=linux pid=1206452 revision=de7731dd version=12.1.0
Listing configured runners                          ConfigFile=/home/ansible/.gitlab-runner/config.toml
orc2_production                                     Executor=shell Token=secret-token URL=https://my.gitlab.com/

The runner get a task and fail to process with the following journalctl log

Apr 19 17:34:28 svko-ilcm03 su[1205544]: (to ansible) root on none
Apr 19 17:34:28 svko-ilcm03 su[1205544]: pam_unix(su:session): session opened for user ansible(uid=1001) by (uid=0)
Apr 19 17:34:28 svko-ilcm03 su[1205544]: pam_unix(su:session): session closed for user ansible
Apr 19 17:34:28 svko-ilcm03 gitlab-runner-ansible[1204663]: WARNING: Job failed: exit status 1                  duration=209.648477ms job=82078 project=2705 runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner[1204663]: WARNING: Job failed: exit status 1                  duration=209.648477ms job=82078 project=2705 runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner-ansible[1204663]: ERROR: Failed to process runner                     builds=0 error=exit status 1 executor=shell runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner[1204663]: ERROR: Failed to process runner                     builds=0 error=exit status 1 executor=shell runner=Psx6ypMS

In the GitLab web interface, I find

Running with gitlab-runner 12.1.0 (de7731dd)
  on orc2_production Psx6ypMS
Using Shell executor... 00:00
Running on svko-ilcm03... 00:00
bash: line 106: cd: /home/ansible/builds/Psx6ypMS/0/ilcm/orc2: No such file or directory 00:00
ERROR: Job failed: exit status 1

Why is the GitLab runner not cloning my project?"

英文:

I'm running a GitLab non-root self-managed runners as a daemon

$ cat /etc/systemd/system/gitlab-runner-ansible.service
[Unit]
Description=GitLab Runner as ansible
After=syslog.target network.target
ConditionFileIsExecutable=/usr/local/bin/gitlab-runner

[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/local/bin/gitlab-runner "run" "--working-directory" "/home/ansible" "--config" "/home/ansible/.gitlab-runner/config.toml" "--service" "gitlab-runner-ansible" "--syslog" "--user" "ansible"

Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target

and I registered a runner

$ gitlab-runner list
Runtime platform                                    arch=amd64 os=linux pid=1206452 revision=de7731dd version=12.1.0
Listing configured runners                          ConfigFile=/home/ansible/.gitlab-runner/config.toml
orc2_production                                     Executor=shell Token=secret-token URL=https://my.gitlab.com/

The runner get a task and fail to process with the following journalctl log

Apr 19 17:34:28 svko-ilcm03 su[1205544]: (to ansible) root on none
Apr 19 17:34:28 svko-ilcm03 su[1205544]: pam_unix(su:session): session opened for user ansible(uid=1001) by (uid=0)
Apr 19 17:34:28 svko-ilcm03 su[1205544]: pam_unix(su:session): session closed for user ansible
Apr 19 17:34:28 svko-ilcm03 gitlab-runner-ansible[1204663]: WARNING: Job failed: exit status 1                  duration=209.648477ms job=82078 project=2705 runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner[1204663]: WARNING: Job failed: exit status 1                  duration=209.648477ms job=82078 project=2705 runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner-ansible[1204663]: ERROR: Failed to process runner                     builds=0 error=exit status 1 executor=shell runner=Psx6ypMS
Apr 19 17:34:28 svko-ilcm03 gitlab-runner[1204663]: ERROR: Failed to process runner                     builds=0 error=exit status 1 executor=shell runner=Psx6ypMS

In the GitLab web interface, I find

Running with gitlab-runner 12.1.0 (de7731dd)
  on orc2_production Psx6ypMS
Using Shell executor... 00:00
Running on svko-ilcm03... 00:00
bash: line 106: cd: /home/ansible/builds/Psx6ypMS/0/ilcm/orc2: No such file or directory 00:00
ERROR: Job failed: exit status 1

Why is the GitLab runner not cloning my project?

答案1

得分: 0

Remove /home/ansible/.bash_logout resolved the problem.

A deep explanation of the problem is provided by colinhogben at https://forum.gitlab.com/t/gitlab-runner-as-non-root-does-not-clone-repo/21935/6.

英文:

As pointed by Alex M in https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3849#note_134574796, remove /home/ansible/.bash_logout resolved the problem.

A deep explanation of the problem is provided by colinhogben at https://forum.gitlab.com/t/gitlab-runner-as-non-root-does-not-clone-repo/21935/6.

huangapple
  • 本文由 发表于 2023年4月19日 23:41:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76056433.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定