MySQL - Repository Polling - Periodically (v5.7-)

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Product

Version

Database

Documentation reference

Bamboo

V5.7.X

MySQL

Polling the repository for changes

Lets find out how to get Bamboo's repository polling values from MySQL database along with updating those values.

Solution

Get repository polling

/** * Bamboo version: 5.7- * Database: MySQL * Triggers: 'Repository polling' > 'Polling strategy' > 'Periodically' */ select B.FULL_KEY as PLAN_KEY, B.TITLE as TITLE, VL.PLUGIN_KEY as REPOSITORY_TYPE, ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) as FREQUENCY, BD.BUILD_DEFINITION_ID as BUILD_DEFINITION_ID from VCS_LOCATION as VL join PLAN_VCS_LOCATION as PVL on PVL.VCS_LOCATION_ID = VL.VCS_LOCATION_ID join BUILD as B on PVL.PLAN_ID = B.BUILD_ID join BUILD_DEFINITION as BD on B.BUILD_ID = BD.BUILD_ID where B.SUSPENDED_FROM_BUILDING = false and ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) != '' order by FREQUENCY desc, PLAN_KEY, TITLE;

What expect from query above:

PLAN_KEY

TITLE

REPOSITORY_TYPE

FREQUENCY

BUILD_DEFINITION_ID

REP-SVN

Subversion

com.atlassian.bamboo.plugin.system.repository:svn

190

2654213

REP-GIT

Git

com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-git:git

180

2654209

Get repository polling lower than 190 seconds

/** * Bamboo version: 5.7- * Database: MySQL * Triggers: 'Repository polling' > 'Polling strategy' > 'Periodically' * Condition: lower than 190 seconds */ select B.FULL_KEY as PLAN_KEY, B.TITLE as TITLE, VL.PLUGIN_KEY as REPOSITORY_TYPE, ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) as FREQUENCY, BD.BUILD_DEFINITION_ID as BUILD_DEFINITION_ID from VCS_LOCATION as VL join PLAN_VCS_LOCATION as PVL on PVL.VCS_LOCATION_ID = VL.VCS_LOCATION_ID join BUILD as B on PVL.PLAN_ID = B.BUILD_ID join BUILD_DEFINITION as BD on B.BUILD_ID = BD.BUILD_ID where B.SUSPENDED_FROM_BUILDING = false and ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) != '' and ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) < 190 order by FREQUENCY desc, PLAN_KEY, TITLE;

What expect from query above:

PLAN_KEY

TITLE

REPOSITORY_TYPE

FREQUENCY

BUILD_DEFINITION_ID

REP-GIT

Git

com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-git:git

180

2654209

Get repository polling when using Git as Repository Host

/** * Bamboo version: 5.7- * Database: MySQL * Triggers: 'Repository polling' > 'Polling strategy' > 'Periodically' * Condition: 'Repository host' as Git */ select B.FULL_KEY as PLAN_KEY, B.TITLE as TITLE, VL.PLUGIN_KEY as REPOSITORY_TYPE, ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) as FREQUENCY, BD.BUILD_DEFINITION_ID as BUILD_DEFINITION_ID from VCS_LOCATION as VL join PLAN_VCS_LOCATION as PVL on PVL.VCS_LOCATION_ID = VL.VCS_LOCATION_ID join BUILD as B on PVL.PLAN_ID = B.BUILD_ID join BUILD_DEFINITION as BD on B.BUILD_ID = BD.BUILD_ID where B.SUSPENDED_FROM_BUILDING = false and ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) != '' and VL.PLUGIN_KEY = 'com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-git:git' order by FREQUENCY desc, PLAN_KEY, TITLE;

What expect from query above:

PLAN_KEY

TITLE

REPOSITORY_TYPE

FREQUENCY

BUILD_DEFINITION_ID

REP-GIT

Git

com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-git:git

180

2654209

Get repository polling when using Subversion as Repository Host

/** * Bamboo version: 5.7- * Database: MySQL * Triggers: 'Repository polling' > 'Polling strategy' > 'Periodically' * Condition: 'Repository host' as Git */ select B.FULL_KEY as PLAN_KEY, B.TITLE as TITLE, VL.PLUGIN_KEY as REPOSITORY_TYPE, ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) as FREQUENCY, BD.BUILD_DEFINITION_ID as BUILD_DEFINITION_ID from VCS_LOCATION as VL join PLAN_VCS_LOCATION as PVL on PVL.VCS_LOCATION_ID = VL.VCS_LOCATION_ID join BUILD as B on PVL.PLAN_ID = B.BUILD_ID join BUILD_DEFINITION as BD on B.BUILD_ID = BD.BUILD_ID where B.SUSPENDED_FROM_BUILDING = false and ExtractValue(BD.XML_DEFINITION_DATA, '//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value' ) != '' and VL.PLUGIN_KEY = 'com.atlassian.bamboo.plugin.system.repository:svn' order by FREQUENCY desc, PLAN_KEY, TITLE;

What expect from query above:

PLAN_KEY

TITLE

REPOSITORY_TYPE

FREQUENCY

BUILD_DEFINITION_ID

REP-SVN

Subversion

com.atlassian.bamboo.plugin.system.repository:svn

190

2654213

Update Repository polling to 600 seconds

In order to run the updates, you will be required to:

  1. stop Bamboo (bring the instance down)

  2. run the UPDATE statement against Bamboo's database:

    Update repository polling to 600 seconds

    /** * Bamboo version: 5.7- * Database: MySQL * Triggers: 'Repository polling' > 'Polling strategy' > 'Periodically' * Condition: update Repository polling to 600 seconds in a given Plan */ update BUILD_DEFINITION as BD set BD.XML_DEFINITION_DATA = UpdateXML(BD.XML_DEFINITION_DATA,'//buildStrategies/buildStrategy/key[text()="poll"]/../config/item/key[text()="repository.change.poll.type"]/../value[text()="PERIOD"]/../../item/key[text()="repository.change.poll.pollingPeriod"]/../value', '<value>600</value>') where BD.BUILD_DEFINITION_ID = 2654209;
  3. start Bamboo

Updated on May 22, 2025

Still need help?

The Atlassian Community is here for you.