Ability to run script commands against services in Bitbucket Pipelines

Issue #18928 closed
Haley Loyd created an issue

Currently, it is not possible to do any setup to services in Bitbucket Pipelines. However, it would be nice to be able to add seed data or run other kinds of commands before using the service in the main step script.

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>

Comments (4)

  1. aneita staff

    Hey Haley,

    Thanks for reaching out and for the suggestion.

    If you'd like to run scripts against your services, we recommend doing that as the first part to your build script. e.g. before the dotnet restore. Pipelines will wait until services are fully ready before it runs the script, and by running it within your step, your service will have access to the full build environment. This also gives you the ability to customise the service setup to each step.

    Let me know if this suits your use case. If not, can you please elaborate on your use case for requiring the service setup to be defined separately?

    Thanks,

    Aneita

  2. aneita staff

    Closing for now as I haven't heard back. Please feel free to reopen this ticket if it's still something you're interested in.

  3. Log in to comment