简体   繁体   English

如何排除 gitlab.ci 中的分支?

[英]How to except the branch in gitlab.ci?

Ran into a problem in gitlab.ci.在 gitlab.ci 中遇到问题。 I have a main branch and a test branch.我有一个主分支和一个测试分支。 The remaining branches are release branches and serve as a workspace for developers.其余的分支是发布分支,作为开发人员的工作空间。 What needs to be written in gitlab.ci so that the build-to-dev and deploy-to-dev stages run on all branches except the test branch?需要在 gitlab.ci 中写什么,以便 build-to-dev 和 deploy-to-dev 阶段在除测试分支之外的所有分支上运行?

The " .gitlab-ci.yml keyword reference " includes a only / except keyword which should help. .gitlab-ci.yml关键字参考” 包含一个only / except关键字,应该会有所帮助。

job2:
  script: echo
  except:
    - test 

Besides the only/except Keyword, the rules keyword can also be used and offers additional functionality than only/except .除了only/except关键字之外,还可以使用rules关键字,并提供比only/except更多的功能。

jobs:
  rules:
    - if: '$CI_COMMIT_BRANCH == main'
      when: never
  script:
    - echo hello

But only/expect cant be combined with rules on one jobonly/expect不能与一项工作的rules相结合

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM