4

我推送我的代码的任何分支都被部署到 FTP。

image: samueldebruyn/debian-git

pipelines:
  default:
    - step:
        script:
          - apt-get update
          - apt-get -qq install git-ftp
          - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://ftp.example.com/path/to/website

如何为不同的分支创建多个管道?

就像测试分支到testing/path,并将分支部署deploy/path

4

1 回答 1

3

如果我理解正确,您希望根据您正在处理的分支触发管道。我一直这样做如下:

image: maven:3.3.9-jdk-8

pipelines:
  default: # It define rules for all branches that don't have any specific pipeline assigned in 'branches'.
    - step:
        script:
          - mvn -U clean test
  branches:
    master: # It runs only on commit to the master branch.
      - step:
          script:
            - mvn -U clean test
    feature/*: # It runs only on commit to branches with names that match the feature/* pattern.
      - step:
          script:
            - mvn -U clean verify
    live: # It runs only on commit to the live branch
      - step:
          image: python:2.7
          script:
            - chmod +x deploy.bash
            - ./deploy.bash

其中分支名称是glob 模式。因此,您将在匹配正确的分支方面获得不错的自由。

于 2017-05-09T09:50:40.277 回答