The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jouni Riimala
Contributor
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Riley Venable
Community Champion
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.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events