【问题标题】:Creating a single bitbucket-pipelines.yml file for multiple projects为多个项目创建单个 bitbucket-pipelines.yml 文件
【发布时间】:2020-06-12 15:29:02
【问题描述】:

我有大量具有相同管道要求的微服务(40 多个)(目前非常简单:构建、测试、部署)。他们每个人都生活在自己的存储库中。显然,随着我们改进管道,我希望避免在 40 个位置更改我的 bitbucket-pipelines.yml 文件。我知道 travis 和 gitlab 都提供了一个导入/包含功能,允许您包含一个“主”yml 文件。 Bitbucket Pipelines 有类似的东西吗?如果没有,有哪些可行的替代方案?

谢谢!

【问题讨论】:

    标签: bitbucket-pipelines


    【解决方案1】:

    您应该能够通过使用自定义 Bitbucket Pipe 来做到这一点。例如,您可以构建一个自定义管道来部署您的代码并将其添加到您的bitbucket-pipelines.yml。这是一个例子:

    pipelines:
      default:
        - step:
            name: "Deployment step"
            script:
              - pipe: your-bitbucket-account/deploy-pipe:1.0.0
                variables:
                  KEY: 'value'
    

    这是一篇文章的链接,该文章解释了如何编写自定义管道https://bitbucket.org/blog/practice-devops-with-custom-pipes-reusing-ci-cd-logic

    【讨论】:

      【解决方案2】:

      这对我有用,我必须为包含多个项目的解决方案设置 bitbucket 管道。

      您必须在管道名称之前添加 custom: after pipeline: 属性

      pipelines:
       custom:
       deployAdminAPI:
           - step:
               name: Build and Push AdminAPI
               script: enter your script
       deployParentsAPI:
           - step:
               name: Build and Push ParentsAPI
               script: enter your script
      

      这里是 Bitbucket 解决方案的Link

      【讨论】:

        猜你喜欢
        • 2020-08-21
        • 2021-08-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-01
        • 1970-01-01
        • 2023-01-26
        • 2016-03-30
        • 1970-01-01
        相关资源
        最近更新 更多