DevSensei | Code Owners for Bitbucket

Custom Attributes

  • πŸ”° fundamental topics for beginners getting started with DevSensei

  • πŸ”¬ advanced topics for once you have your first workflows automated

The custom-attributes attribute of a Workflow object declares a dictionary of various attributes that are provided to the workflow by the configuration file. For example used as part of the configuration of an action or a merge check.

Example

YAML
workflows:
  - name: Example
    custom-attributes:
      key-1: # ...
      key-2: # ...

Supported custom attribute keys are:

  • custom-groups

  • codeowners

Custom Groups since 8.8

Custom groups define a set of users grouped together as a single entity. There are similar to Bitbucket or Reviewer user groups, but they are only defined within a workflow.

A group is defined by a name and a list of identifiers. An identifier can be

  • a reference to a user (as individual via email or username) (e.g., @alice or alice@domain.com), or

  • a reference to another group (custom group, Bitbucket group or reviewers group) using @@<group-name>.

Syntax

Custom groups are defined as a yaml mapping from the name of the group to the list of identifiers within that group.

Example:

YAML
custom-groups:
  frontend-devs:
    - alice
    - bobby@domain.com
    - @@admins
  backend-devs:
    - bobby@domain.com
    - charly

Code Owners since 8.8

The codeowners custom attribute is defined by a rules member, configuring what files are owned by which people.

Syntax

The rules are defined using a multi-line string where each line follows one of the two following patterns:

  • <file pattern> <code owners>: to assign files to some code owners

  • !<file pattern>: to exclude files from being assigned.

(Rule line order matters: the last matching line wins.)

See our complete reference for more context and information.

Example:

YAML
codeowners:
  rules: |
    *                   @alice bobby@domain.com
    frontend/           @@frontend-devs
    backend/            @@backend-devs
    devsensei.yaml      @@admins
    !ci/playgrounds.yml