英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论