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

GitLab流水线实现将分支中手动上传的文件复制至Runner执行节点

GitLab Pipeline: Copy Manually Uploaded Files to Runner Node

Got it, let's break this down simply. When you manually upload files to your GitLab branch, those files are part of your repository now. GitLab Runner automatically clones your entire branch into the ${CI_PROJECT_DIR} directory on the execution node when the pipeline runs—so technically, those files are already there! But if you need to copy them to another location on the Runner node or just verify their presence, here's how to tweak your pipeline YAML:

Working Pipeline Configuration

stages:
  - file_handling

copy_uploaded_files:
  stage: file_handling
  script:
    # Optional: List files to confirm your uploaded files are present
    - ls -l ${CI_PROJECT_DIR}
    # Example: Copy your uploaded file to a target directory on the Runner node
    # Make sure the Runner has write permissions for the target path!
    - cp your-uploaded-file.ext /path/you/want/to/copy/to/
    # If you just want to duplicate the file within the project directory (e.g., backup)
    - cp your-uploaded-file.ext ${CI_PROJECT_DIR}/backup/
  tags:
    - windows  # Keep this if you're using a Windows-based Runner

Key Notes

  • Files are already in the Runner by default: The Runner pulls your full branch code during pipeline setup, so any files you uploaded manually are already in ${CI_PROJECT_DIR}. No copy is needed if you just need to access them in your pipeline jobs.
  • Windows Runner adjustments: If your Runner is on Windows, replace the cp command with Windows' native copy syntax, like this:
    - copy your-uploaded-file.ext C:\path\to\target\directory\
    
  • Permissions check: If you're copying to a system-level directory (like /usr/local/ on Linux or C:\Program Files\ on Windows), ensure the Runner user has write access to that location—otherwise the copy will fail.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.28 10:32:50