Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

No such file or directory for pipeline script

Rastalamm January 21, 2019

When running the staging branch from my pipeline, it's failing and throwing the below error

+ cd /srv/repo
bash: cd: /srv/repo: No such file or directory

 

Below is my bitbucket-pipelines.yml file

image: "node:6.10.0"
pipelines:
branches:
default:
- step:
script:
- echo 'this is the default script and should do nothing!'
staging:
- step:
script:
- echo 'Building and Deploying the staging branch'
- ssh user@ip
- cd /srv/repo
- git pull
- git checkout staging
- npm install
- pm2 restart staging-api

 

The `/srv/repo` directory does exist on the `ip` server. Why is the pipeline failing and stating that the directory does not exist?

 

1 answer

2 votes
Jeroen De Raedt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 24, 2019

Hi @Rastalamm,

when you execute `cd user@ip` you are not doing this as part of your SSH session, you are doing this in the build container. 

Try something like this: `

sh -c '/bin/sh -c cd /srv/repo && ls -l'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events