Subversion Repository - Remote Trigger

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

The following will provide you with a better understanding on setting up Remote repository triggering in Bamboo when using Subversion repositories.

Please, refer to the following documentation for further information:

As per links above, you are able to delegate your Subversion repository the task to inform Bamboo when a build should run:

Solution

Requirements

  • add Subversion repository to a Project / Plan in Bamboo

  • add postCommitBuildTrigger.py to your Subversion repository (alternatively, use BASH version -postCommitBuildTrigger.sh)

  • add a Remote trigger (Repository triggers the build when changes are committed)

  • add Trigger IP Addresses (IP address from where the request will originate)

  • check Plan configuration >> Permissions tab

Plan configuration >> Permissions

  1. When Anonymous users is enabled

  2. When Anonymous users is disabled

  3. When Anonymous users is disabled but providing user's authentication

  4. Notes

1. When Anonymous users is enabled

(Auto-migrated image: description temporarily unavailable)

When running 'postCommitBuildTrigger.py', Bamboo will run builds.

2. When Anonymous users is disabled

(Auto-migrated image: description temporarily unavailable)

When running 'postCommitBuildTrigger.py', Bamboo will not run builds and the following will be thrown in <bamboo-home>/logs/atlassian-bamboo.log

<bamboo-home>/logs/atlassian-bamboo.log

2016-11-17 17:19:21,753 INFO [http-bio-8085-exec-2] [AccessLogFilter] 127.0.0.1 GET http://localhost:8085/api/rest/updateAndBuild.action?buildKey=PROJ-PLAN 56080kb 2016-11-17 17:19:21,779 WARN [http-bio-8085-exec-2] [AuthorizationLoggerListener] Authorization failed: org.acegisecurity.AccessDeniedException: Access is denied; authenticated principal: org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken@9055e4a6: Username: anonymousUser; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS; secure object: ReflectiveMethodInvocation: public abstract java.util.List com.atlassian.bamboo.plan.cache.CachedPlanManager.getBranchesForChain(com.atlassian.bamboo.plan.PlanIdentifier); target is of class [com.atlassian.bamboo.plan.cache.CachedPlanManagerImpl]; configuration attributes: [ACL_BUILD_READ]

3. When Anonymous users is disabled but providing user's authentication

(Auto-migrated image: description temporarily unavailable)

As mentioned previously, removing Anonymous users permission will prevent builds from running, unless you edit the 'postCommitBuildTrigger.py' and run the GET method authenticating against Bamboo.

Please, find below an example on how to accomplish that:

postCommitBuildTrigger.py

#!/usr/bin/python # # ./postCommitBuildTrigger.py http://bamoo.atlassian.com/bamboo/ myBuildName import sys import urllib2 import base64 baseUrl = sys.argv[1] buildKey = sys.argv[2] # the user provided MUST have access on 'Plan configuration >> Permissions' tab username = 'admin' password = 'admin' remoteCall = baseUrl + "/api/rest/updateAndBuild.action?buildKey=" + buildKey request = urllib2.Request(remoteCall) base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') request.add_header("Authorization", "Basic %s" % base64string) result = urllib2.urlopen(request) result.close()

ℹ️ Please, remember the 'postCommitBuildTrigger.py' is a Python script, so you can edit as you were writing a Python script, extending its functionality based on your use case:

  • evaluate the committer so only a particular users and/or set of users can trigger builds in Bamboo

  • only send event after X new revisions

  • allow triggering after 5PM

  • allow triggering on Thursdays

4. Notes

It is important to notice the action call (/api/rest/updateAndBuild.action?buildKey=) from 'postCommitBuildTrigger.py' above will check whether there are changes in the repository associated with the planKey provided as parameter. If so, Bamboo will:

  • trigger a build against the buildKey provided

  • will check if there are any other changes in the repository, including branches. If so, will trigger a build against branches.

In other words, when you have the following scenario and commit something against branch bar (buildKey=PROJ-PLAN1), Bamboo will attempt on running a build against all branches (PROJ-PLAN, PROJ-PLAN0, PROJ-PLAN1) if repository changes were found.

Repository/Branch

PlanKey

http://svn.example.com/repos/calc

PROJ-PLAN

http://svn.example.com/repos/calc/branches/foo

PROJ-PLAN0

http://svn.example.com/repos/calc/branches/bar

PROJ-PLAN1

When running the example above, you should find something similar to the following in <bamboo-home>/logs/atlassian-bamboo.log

<bamboo-home>/logs/atlassian-bamboo.log

2016-11-17 18:09:15,732 INFO [9-BAM::PlanExec:pool-16-thread-3] [ChangeDetectionListenerAction] No changes found for 'PROJ-PLAN0' 2016-11-17 18:09:15,732 INFO [9-BAM::PlanExec:pool-16-thread-4] [ChangeDetectionListenerAction] No changes found for 'PROJ-PLAN'
Updated on May 22, 2025

Still need help?

The Atlassian Community is here for you.