是否可以在bitbucket管道中使用多个docker镜像?

Jam*_*Lin 12 bitbucket-pipelines

我有这个管道文件来对我的项目进行单元测试:

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
Run Code Online (Sandbox Code Playgroud)

但是可以切换到另一个Docker镜像进行部署吗?

image: jameslin/python-deploy

    pipelines:
      default:
        - step:
            script: 
              - ansible-playbook deploy
Run Code Online (Sandbox Code Playgroud)

我似乎无法找到任何说明是或否的文件.

Dmi*_*sev 31

您可以为每个步骤指定图像.像那样:

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
Run Code Online (Sandbox Code Playgroud)

  • 我可以在一个步骤中获得多个图像吗? (2认同)
  • 在一个步骤中利用多个图像的一种方法可能是使用服务?https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/ (2认同)

Jam*_*Lin 7

终于找到了:

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

step(必需)定义构建执行单元.步骤按它们在管道中出现的顺序执行.目前,每个管道只能有一个步骤(一个用于默认管道,一个用于每个分支).您可以通过在步骤中指定图像来覆盖主Docker镜像.