Skip to content

This is the ch.baloise.bitbucket:codefreeze plugin for Atlassian Bitbucket Server.

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE.md
Apache-2.0
LICENSE.txt
Notifications You must be signed in to change notification settings

baloise/codefreeze

Codefreeze

Winterflake

DepShield Badge

Documentation

Codefreeze is a basic plugin for Atlassian Bitbucket that allows you ahead of time set date from which pushing directly to specified branches is no longer possible.

In order to enable the Codefreeze settings page one of two hooks should be enabled on project or repository level:

  • MergeCheck:
    • CodeFreezeMergeCheck: allows merges of pull requests only after admin review of the change
    • IsIssueKeyCorrect: executes a groovy script for every Jira ticket contained inside the pull request
  • Hooks:
    • CodeFreezePrePushHook: blocks pushing to specified branches after specified date
    • IsIssueKeyCorrect: executes groovy script to evaluate the correctness of a Jira Issue, checks across all available fields

The branch name in the settings will be checked against ref name by "contains" function, which means that the master will apply restriction to branches such as /8/1/0/master, /master/test and so on.

An example for a groovy script can be found in the file scr/test/resources/groovy/ParseScript.groovy.

Configuration

Settings can be found either on the left side panel of the repository page or inside repository settings.

Pull Request Side Panel

The merge checks page looks like: MergeChecks

The issue checker is configured as follows: Issue Cheker Config

A code freeze can be configured the following way: Code Freeze Configuration

The authorization needs to be defined in JIRA: Jira Authorization

Open Issues

Hints for Developing Plugins

Here are the SDK commands you'll use immediately:

  • atlas-run: installs this plugin into the product and starts it on localhost
  • atlas-debug: same as atlas-run, but allows a debugger to attach at port 5005
  • atlas-cli: after atlas-run or atlas-debug, opens a Maven command line window: pi re-installs the plugin into the running product instance
  • atlas-help: prints description for all commands in the SDK

The full documentation is available at Introduction to the Atlassian Plugin SDK

An example plugin can be found at https://bitbucket.org/atlassian/bitbucket-server-example-plugins.

For locating web elements suffix address with ?web.items&web.panels&web.sections.

Follow the link Best practices for active objects to obtain further best practices.

The DB access must be configured using the following JDBC URL:

jdbc:h2:file:[pluginfolderpath]\target\bitbucket\home\shared\data\db;AUTO_SERVER=TRUE

You can find an AUI soy template at:

The API is used with the following URL structure:

{host}/{app}/rest/{pathOfRest}/{versionOfRest}/{pathDefinedInClass)

Example:

localhost:7990/bitbucket/rest/codefreeze/1.0/projects/PROJECT_1/repos/rep_1/branchfreeze

Open Source

This project is open source and follows the Baloise Open Source Guidelines.

References