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

How to set the path for Bitbucket Pipeline to Package.json in sub folder?

Michael Taylor June 19, 2019

I am trying to configure a Node.js bitbucket pipeline to execute some commands in a package.json file that is in a different directory than the bitbucket-pipelines.yml in the root directory of the repo.

 

Currently, the pipelines are unable to locate the package.json to execute commands.

 

How can I set the path for the package.json where commands should be executed?

1 answer

1 accepted

2 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2019

Hi @Michael Taylor

 

The script of your pipeline is executed line by line just as if it was in a shell. So first change directory to the one you need, then run commands you want to run in that directory:

- step:
script:
- cd relative/path/from/root
- npm ...

I hope this helps.

Cheers,
Daniil

Michael Taylor June 20, 2019

Are unix commands in general supported for bitbucket pipelines?

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2019

These commands are running inside of the docker container running an image you specified in the Pipelines configuration file, so anything that works there will work as a pipeline step.

By the way, you can actually try to run the pipeline locally – might be useful for initial setup as well as for debugging.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events