You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitLab服务器中执行.gitlab-ci.yml的进程及执行用户咨询

Answers to Your GitLab CI Questions

Hey there! Let me walk you through these two questions based on hands-on experience with GitLab CI/CD:

1. What's the process name that runs .gitlab-ci.yml on a GitLab server?

The core component responsible for executing the jobs defined in your .gitlab-ci.yml is GitLab Runner. The main process name for it is simply gitlab-runner.

A few quick clarifications:

  • If you installed GitLab Runner as a system service (common on Linux hosts), you can check its status with sudo systemctl status gitlab-runner—this will show the running gitlab-runner process directly.
  • For Dockerized GitLab Runners, the gitlab-runner process runs inside the Runner container itself, and it spawns separate job containers to execute your pipeline scripts.

2. How to find the process and user executing .gitlab-ci.yml (especially for scp commands to Docker mounts)?

Here's a step-by-step breakdown to track this down:

Identify the GitLab Runner process

Run this command on your GitLab Runner host to list related processes:

ps aux | grep gitlab-runner

This will show you the gitlab-runner process ID, the user it runs under (by default, a dedicated gitlab-runner user created during installation), and other details like its command line arguments.

Determine the user executing your pipeline scripts

The user depends on the executor your Runner is configured to use:

  • Shell executor: Your .gitlab-ci.yml scripts run directly on the Runner host as the gitlab-runner user. You can confirm this by adding a quick test job to your pipeline:
    check-exec-user:
      script:
        - whoami
        - id
    
    Running this job will log the username and user ID right in the pipeline output.
  • Docker executor: Your scripts run inside a Docker container spawned by the Runner. The default user inside the container is usually root (unless your job's Docker image explicitly specifies a different user). Add the same whoami step to your job to verify.

Key notes for your scp scenario

Since your script uses scp to copy files to a Docker-mounted path:

  • If using the Shell executor, make sure the gitlab-runner user has read/write permissions on the Docker mount directory on the host.
  • If using the Docker executor, ensure the mount is accessible inside the job container (you may need to configure volume mounts in your Runner's config or job definition) and that the container user has permissions to write to it.
  • Also, check if the gitlab-runner user (or container user) has SSH keys set up for the target host in the scp command—this is almost certainly how the former developer configured authentication for the file transfer.

内容的提问来源于stack exchange,提问作者Ciasto piekarz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:46:24