Skip to content

Break down `only:refs` keywords

Shinya Maeda requested to merge introduce-new-only-keywords into master

What does this MR do?

This MR introduces only:branches, only:protected_branches, only:tags, only:merge_requests, only:events, only:project_paths. These keywords can be represented as only:refs, however, it's better to explicitly decouple the concepts for using only/except keywords more intuitively https://gitlab.com/gitlab-org/gitlab-ce/issues/57075.

Example) Execute a job only when merge requests which associated with a branch named (docs-) in gitlab projects

  only:
    merge_requests:
      - /(^docs[\/-].*|.*-docs$)/
    project_paths:
      - gitlab-org/gitlab-ce
      - gitlab-org/gitlab-ee
      - gitlab/gitlabhq
      - gitlab/gitlab-ee

Example) Global only/except (Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/55011)

only:
  protected-branches:
    - //
  tags:
    - //
  merge_requests:
    - //
  exactly_one_of: [protected-branches, tags, branches, merge_requests]

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Shinya Maeda

Merge request reports