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

How to run a node project using postgress db (populated by a seed file) in the bitbucket pipeline ?

Jouni Riimala February 20, 2023

Hi, 

I have a node project using postgres db via sequelize. My purpose is to run integration tests within pipeline.   

Installation phase goes well, but then it complains that it doesn't find the table where to push seed file (predefined record, which can be pushed to the table). Issue is that tables have not yet been created as those are created when the project starts after npm start command. Tried to add npm start after npm install, but then it just runs continuously.
How to make this work, is there a way to make npm start to run on background ?
I would appreciate example :)
pipelines:
default:
- step:
image: node
script:
- npm install
- npm run seed
- npm test
services:
- postgres
definitions:
services:
postgres:
image: postgres
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

1 answer

0 votes
Riley Venable
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 20, 2023

You can try adding the command "npm start &" to your bitbucket-pipelines.yml file after the "npm install" command. This will run the "npm start" command in the background, allowing the "npm run seed" and "npm test" commands to run afterwards.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events