29

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.

4

3 回答 3

79

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
于 2018-01-07T09:19:50.870 回答
7

Finally found it:

https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_stepstep(required)

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.

于 2016-10-21T01:57:24.730 回答
2

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:

  1. Create your docker image with all utilities you need for both default and deployment.
  2. Use the branching method they show in their examples https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_branchesbranches(optional)
  3. Use shell scripts or other scripts to run specific tasks you need and

enter image description here

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 
于 2016-12-06T19:27:55.163 回答