Forums

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

How do I add additional setup steps to services in Bitbucket Pipelines

Haley Loyd
June 16, 2019

I'm using Bitbucket Pipelines to run integration tests. I need to spin up a docker container to mimic the database so the tests can run. However, before I can run the tests, I need to add seed data to the database.

It seems like whether I add the mongo images as a service or add docker as a service, I still have to figure out a way to do the setup in the image from the script section of the default step, which is in a separate container.

That seems like a lot of unnecessary work, so my question is, is there an easier way? 

For example:

image: dotnet

pipelines:
default:
- step:
services:
- database
script:
- dotnet restore
- dotnet build

definitions:
services:
database:
image: mongo
<it would be really nice if I could add setup steps here>


 

1 answer

1 accepted

0 votes
Answer accepted
Tom Bradshaw
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2019

Hey Haley,

At the moment it's not possible to run commands against a service. To get around this you'll probably have to construct a custom docker image. In this custom image you would be able to run a script to add the data you require as part of the docker build so you won't have to run anything as part of the build.

Can I also get you to add a feature request for running script commands against services at https://bitbucket.org/site/master/issues/ since this is an interesting feature that others might want as well.

If you have any questions let me know.

Cheers,
Tom

Haley Loyd
June 17, 2019

I created a feature request like you requested. Thank you for your answer, Tom!

Like • SebastiĆ”n Orellana likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events