Why did Gitlab job fail? No such file or directory ERROR: Job failed: exit status 1

Why did Gitlab job fail? No such file or directory ERROR: Job failed: exit status 1

这是我的gitlab-ci.yml文件

stages:
  - build_dev

build_dev:
  stage: build_dev
  only:
    refs:
      - master
  tags:
    - Fluffa-fe
  script:
    - pwd
    - ls -lah
    - cd /var/www/html/fluffa.company/fe
    - git pull
    - CI=false && npm install && npm run build
    - chown -R www-data:www-data /var/www/html/ 

我的工作失败了

$ cd /var/www/html/fluffa.company/fe
bash: line 116: cd: /var/www/html/fluffa.company/fe: No such file or directory
ERROR: Job failed: exit status 1

为什么?它似乎找不到容器路径吗? 我检查了我的服务器 Docker 容器挂载点

"Mounts": [
    {
        "Type": "bind",
        "Source": "/webfolder/docker-lab/dev/dev_fluffa/fe/ssh",
        "Destination": "/root/.ssh",
        "Mode": "",
        "RW": true,
        "Propagation": "rprivate"
    },
    {
        "Type": "bind",
        "Source": "/webfolder/fluffa.company",
        "Destination": "/var/www/html/fluffa.company",
        "Mode": "",
        "RW": true,
        "Propagation": "rprivate"
    }
],

如何解决这个问题?

假设管道在您的 Docker 容器中执行,将 ls -alrth /var/www/html/fluffa.company 命令添加到您的 script

这将允许您检查:

  • 如果父文件夹存在
  • 如果与其相关的权限(或其子文件夹 fe)允许 gitlab-ci 脚本访问它。