Release Notes v8.7
We released DevSensei | Code Owners for Bitbucket 8.7 on 🎉
Download on the Atlassian Marketplace for Data Center
Features
🆕 DevSensei Workflow Attribute: commits
We introduced a new DevSensei Workflow Attribute for information about the commits of a pull request. The attribute allows to inspect the commits titles, messages and authors
Why? This attribute lets you implement actions and checks that apply to commits
Check that commit titles follow a specific pattern
Check rules about the author: For example ensure the commit author matches the pull request author
Check that there are references to Jira issues in commits
Can you show me an example?
Here is an example devsensei.yaml
file that checks that commit titles start if a set of prefixes and are not too long.
workflows:
- name: Ensure Commit Title follow our guide line
conditions:
- destination=develop
merge-checks:
- title: Please follow our Commit Title guidlines
checks:
- forall(commits.titles, $1 < 100)
- forall(commits.titles, $1 ~= regex('^(FIX|FEATURE|INTERNAL).*')
🆕 DevSensei Workflow Attribute: jira-keys
Along the commits
attribute we also added a jira-keys
attribute for convenient checks on Jira keys.
Why? It allows to you write rules around references to Jira work items:
Check that the pull request references a Jira work item
Check that the Jira keys belong to a certain project
Can you show me an example?
Here is an example devsensei.yaml
file that adds a special comment when the CORE Jira project is referenced.
workflows:
- name: Reminder checklist for CORE project changes
conditions:
- jira-keys ~= 'CORE-*'
actions:
- add-comment:
content: | Double check these things for core project changes:
1. Is the documentation updated
2. Is this change backwards compatible. If not, announce it.
3. Kick off the Stress test on the CI system for this branch
🆕 DevSensei Workflow Attribute: watchers
We added the watchers
attribute. Watchers are people who interact with a pull request.
Why? It allows to act on people who interacted with the pull request, like ensuring there are some people participating it, either as active reviewers or adding comments.
Can you show me an example?
Here is an example devsensei.yaml
file that checks that enough people did notice the pull request. Either by actively commenting on it, or being assign as reviewer.
workflows:
- name: Ensure enough people participated
conditions:
merge-checks:
- title: Expect at least 4 active watchers. Either as active reviewers or implicitly by commeting.
check:
- count(watchers) >= 4
🆕 DevSensei Matching With Regex
We added support to match attributes with a regex. Examples:
conditions:
- commits.messages ~= regex('.*category:.*') # expect category in the message
- title ~= regex('^(FIX|FEATURE|ETC).*')
🆕 DevSensei contains Function
We added support to check if a set attribute contains a certain item. Examples:
- contains(reviewers, 'lee')
🆕 DevSensei forall & exists function
By default DevSensei conditions on a set or list match when a single item matches. For example:
- changed-files ~= '*.js' # Matches when a single or more JavaScript file is changed
- commits.titles ~= '{FIX,FEATURE,ETC}*' # Matches when a single commit title matches
Sometimes you want check that all items do match.
- forall(changed-files, $1 ~= '*.js') # Matches when all files changed as Javascript
- forall(commits.titles, $1 ~= '{FIX,FEATURE,ETC}*' # Matches when all titles match the pattern
- forall(commits, count($1.jira-keys) > 0) # Matches when all commits have a Jira key
The general pattern is:
forall(<the-items>, <condition where the item is $1>)
This also a companion that only checks if a single or more matches exist:
- exists(changed-files, $1 ~= '*.js') # Matches when a single or more JavaScript file is changed
Changelog
🐛 Bugfixes 8.7.0
Fixed a rare race condition where Reviewers didn’t get added to a pull request
Previous: Release Notes v8.5
Do you have any questions, suggestions, or problems?
Let us know. We’re glad to help!