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>
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
I created a feature request like you requested. Thank you for your answer, Tom!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.