Reputation: 26558
I have this pipeline file to unittest my project:
image: jameslin/python-test
pipelines:
default:
- step:
script:
- service mysql start
- pip install -r requirements/test.txt
- export DJANGO_CONFIGURATION=Test
- python manage.py test
but is it possible to switch to another docker image to deploy?
image: jameslin/python-deploy
pipelines:
default:
- step:
script:
- ansible-playbook deploy
I cannot seem to find any documentation saying either Yes or No.
Upvotes: 47
Views: 41515
Reputation: 6678
As of 2024, you can "run multiple Docker containers from your build pipeline" https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/
Services are defined in the definitions section of the bitbucket-pipelines.yml file.
default:
# "Build step is allocated 4096 MB of memory"
- step:
services:
- redis
- mysql
- docker
script:
- echo "Build container is allocated 2048 MB of memory"
- echo "Services are allocated the memory configured. docker 512 MB, redis 512 MB, mysql 1024 MB"
definitions:
services:
redis:
image: redis:3.2
memory: 512
docker:
memory: 512 # reduce memory for docker-in-docker from 1GB to 512MB
mysql:
image: mysql:5.7
# memory: 1024 # default value
variables:
MYSQL_DATABASE: my-db
MYSQL_ROOT_PASSWORD: $password
Upvotes: 0
Reputation: 23972
You can specify an image for each step. Like that:
pipelines:
default:
- step:
name: Build and test
image: node:8.6
script:
- npm install
- npm test
- npm run build
artifacts:
- dist/**
- step:
name: Deploy
image: python:3.5.1
trigger: manual
script:
- python deploy.py
Upvotes: 112
Reputation: 1472
I have not found any information saying yes or no either so what I have assumed is that since this image can be configured with all the languages and technology you need I would suggest this method:
image: yourusername/your-image
pipelines:
branches:
master:
- step:
script: # Modify the commands below to build your repository.
- echo "Starting pipelines for master"
- chmod +x your-task-configs.sh #necessary to get shell script to run in BB Pipelines
- ./your-task-configs.sh
feature/*:
- step:
script: # Modify the commands below to build your repository.
- echo "Starting pipelines for feature/*"
- npm install
- npm install -g grunt-cli
- npm install grunt --save-dev
- grunt build
Upvotes: 1
Reputation: 26558
Finally found it:
step (required) Defines a build execution unit. Steps are executed in the order in which they appear in the pipeline. Currently, each pipeline can have only one step (one for the default pipeline and one for each branch). You can override the main Docker image by specifying an image in a step.
Upvotes: 12