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 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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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
TAGS
AUG Leaders

Atlassian Community Events