跳过工作流关键字中的分支的管道

发布于 2025-01-27 09:21:43 字数 431 浏览 2 评论 0原文

在开发gitlab ci-cd管道时,我想手动为特定分支机构运行管道,例如分支名称是“开发工具”。我想要的是该分支上完成的任何操作都不应自动触发管道。应该手动。我尝试过的是:

workflow:
  rules:
    - when: manual    # Error: workflow:rules:rule when unknown value: manual

然后我尝试这样做:

- if: '$CI_PIPELINE_SOURCE == "web" &&  $CI_COMMIT_REF_NAME !~ /^.*-$develop-tool/'
    - when: always

它将作业带到了一些无限的循环,直到并将其取消并再次运行工作,它一直在运行。有人有其他方法可以实现这一目标吗?

While developing gitlab ci-cd pipeline i want to run pipeline manually for a particular branch for example branch name is "develop-tool". what i want is anything done on this branch should not trigger pipeline automatically. it should be manually. what i have tried is:

workflow:
  rules:
    - when: manual    # Error: workflow:rules:rule when unknown value: manual

then i tried to do this:

- if: '$CI_PIPELINE_SOURCE == "web" &&  $CI_COMMIT_REF_NAME !~ /^.*-$develop-tool/'
    - when: always

its taking job to some infinite loop and it keeps running until and unless you cancel it and run the job again. does anyone have any other way to achieve this goal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

櫻之舞 2025-02-03 09:21:44

当源不是该分支的Web时,具有配置跳过管道。因此,可以在该分支上触发的唯一方法是通过Web UI触发。

workflow:
  rules:
  - if: '$CI_COMMIT_BRANCH == "develop-tool" && $CI_PIPELINE_SOURCE != "web"'
    when: never
  - when: always

Have the configuration skip pipelines when the source is not the web for that branch. So the only way it can be triggered on that branch is through the web UI.

workflow:
  rules:
  - if: '$CI_COMMIT_BRANCH == "develop-tool" && $CI_PIPELINE_SOURCE != "web"'
    when: never
  - when: always
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文