It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipeline database service is not ready


I've encountered a issue using a database service and running my unit tests. The tests started before the database service was ready and due this the unit tests failed.

Has anybody else had similar behaviors?

1 answer

1 accepted

0 votes
Answer accepted
lassian Atlassian Team Jan 30, 2018

Hi Daniel,

There are a number of ways you can wait for a service to be ready before executing your test command in pipelines but it all depends on how your service is determined to be ready.

This question from the community has a bash script that awaits mariadb/mysql to be ready by testing if a TCP connection can be established to the databases port, you can tweak this port for your service aswell if its not one of those databases :) 

Waiting for dependant services

Whilst that script may work for databases it only awaits it to be ready for connections if you also require waiting for schema changes or data imports you will have to write your own custom bash scripts for this behaviour but the logic will be much the same poll checking (waiting) for the condition you are after.

Also feel free in the meantime to watch the following open feature request for this to be added to pipelines :)

Wait until services are ready


Hi Nathan,

thank you for your answer. I will try the solution with the shell script and hope this functionality will be implemented someday in bitbucket pipelines.  :)



hope this functionality will be implemented someday in bitbucket pipelines.  :)


Until Docker implements a standard event in which all containers can notify interested parties that they are truly ready (and every image honours it), Bitbucket Pipelines won't be able to wait for databases to be ready in any sort of standard way.

You'll need to health-check in a loop, e.g.

until docker run --rm --link my_db_container:pg --net my_db_network postgres pg_isready -U postgres -h pg > /dev/null 2>&1; do sleep 1; done


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Share your software development horror stories!

Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...

1,521 views 11 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you