简体   繁体   English

根据使用的分支触发管道

[英]Triggering pipeline depending on branch used

I'd like to trigger a pipeline depending on the branch being pushed.我想根据被推送的分支触发管道。 The code at present:目前的代码:

gitlab-ci.yml gitlab-ci.yml

variables:
  myvariables....

stages:
  - pp

rules:
  - if: '$CI_COMMIT_BRANCH == "master"'
    variables:
      VAR1: ${V_A}
      VAR2: ${VB_A}
  - if: '$CI_COMMIT_BRANCH == "develop"'
    variables:
      VAR1: ${V_B}
      VAR2: ${VB_B}

credentials:
...

The flint parsing seems fine (so syntactically seems fine), however the correct pipeline is not triggered depending on the branch (so develop/qa).燧石解析看起来不错(所以语法上看起来不错),但是不会根据分支触发正确的管道(所以开发/qa)。 Is this the correct usage of rules?这是规则的正确用法吗?

Use this syntax to apply rules to your whole pipeline (in your .gitlab-ci.yml file):使用此语法将规则应用于您的整个管道(在您的.gitlab-ci.yml文件中):

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
      variables:
        VAR1: ${V_A}
        VAR2: ${VB_A}
    - if: $CI_COMMIT_BRANCH == "develop"
      variables:
        VAR1: ${V_B}
        VAR2: ${VB_B}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache Beam Pipeline 能否用于批量编排? - Can Apache Beam Pipeline be used for batch orchestration? 如何在任何分支上的每次新推送时触发 Azure 管道? - How to trigger Azure Pipeline on every new push on any branch? Azure DevOps 发布管道 - 允许在发布时选择分支 - Azure DevOps Release Pipeline - Allowing branch selection at release time 消息批处理 Apache BEAM 管道立即触发,而不是在修复后触发 window - Message batching Apache BEAM pipeline triggering immediately instead of after fixed window 在管道事件源中使用“分支推送”方法计算“仅:更改:” - 合并请求 - Using the "branch push" method of calculate "only: changes:" in pipeline event source - merge-request Vertex AI管道中DeployModelRequest中的deployed_model应该使用什么? - What should be used for deployed_model in DeployModelRequest in Vertex AI pipeline? 根据使用的 CodePipeline 指定不同的 appspec.yml 文件 - Specify different appspec.yml file depending on the CodePipeline being used Azure Devops 构建管道:当 PR 没有附加任何工作项时,CI 触发器无法在 PR 合并到分支 - Azure Devops build pipeline: CI triggers not working on PR merge to a branch when there is no work item is attached with the PR AWS lambda 目标未触发 - AWS lambda destination not triggering onValue 多次触发 - onValue triggering multiple times
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM