git - 为 bitbucket 上的一个存储库创建多个管道?

标签 git bitbucket bitbucket-pipelines

对于我推送的任何分支,我的代码都被部署到 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

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

测试 分支到 测试/路径 , 和 部署 分支到 部署/路径 .

最佳答案

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

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 pattern .因此,您将在匹配正确的分支方面获得不错的自由。

关于git - 为 bitbucket 上的一个存储库创建多个管道?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43849436/

相关文章:

Git .git/info/refs 无效 : is this a git repository?

yaml - 序列条目位桶管道的错误缩进

git - 如何让 git 在 hook 输出期间显示彩色输出?

node.js - 如何为我的 master 设置不同的 NODE_ENV 并在我的 Google App Engine app.yaml 文件中开发 Git 分支?

git - "Merged in"是由 bitbucket 还是 git 创建的提交消息?

eclipse - 如何使用 EGIT 将现有的 Eclipse 项目推送到 Bitbucket?

使用 docker 和 bitbucket 管道的 android 环境

git - 在 Bitbucket 管道中增加一个数字

git - 有了 CI 服务器就一定要在本地跑测试吗?

git - 保护 git 服务器