从 Gitlab 问题创建新分支时不触发构建

Fit*_*iti 5 gitlab gitlab-ci

我在 gitlab.com 和问题跟踪器上使用 Gitlab。每次遇到问题时,我都会在问题内的按钮上创建一个新分支,但这会触发 CI 中的新构建(管道)。我不想要这个,因为这个分支来自 master 并且不需要构建。

我怎样才能做到这一点?这是 gitlab-ci.yml 修改还是存储库相关配置?

小智 0

根据 Commit 消息,我们可以避免在 GitLab CI/CD 管道上构建新创建的分支

Build Branch(master):
  stage: build
  only:
    refs:
      - master
    variables:
      - $CI_COMMIT_MESSAGE =~ /^\[master\].*$/
  script:
    - echo "master branch"
  #  - sleep 60 | echo "hello master"
  # when: delayed
  # start_in: 3 minutes
  interruptible: true

Build Branch(release):
  stage: build
  only:
    refs:
      - /^build_.*$/
    variables:
      - $CI_COMMIT_MESSAGE =~ /^\[build\].*$/
  script:
    - echo "release branch"
  #  - sleep 60 | echo "hello release"
  # when: delayed
  # start_in: 3 minutes
  interruptible: true
Run Code Online (Sandbox Code Playgroud)

当提交消息以 [master] 或 [build] 开头时,分支将触发