Home > Net >  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

Time:05-24

This is my gitlab-ci.yml file

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/ 

My job fails

$ 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

Why? Does it seem it it can not find container path? I checked on my server Docker container mount points

"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"
    }
],

How to fix this?

CodePudding user response:

Assuming the pipeline is executed in your Docker container, add a ls -alrth /var/www/html/fluffa.company command to your script.

That will allow you to check:

  • if the parent folder exists
  • if the rights associated with it (or its subfolder fe) allows for the gitlab-ci script to access it.
  • Related