Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

The repository is expected to pass a JSON payload providing the path (or substring) of the repository URL configured in a Bamboo linked repository. 

{"path":"protocol://path/to/repo"}

The plugin will then trigger all active plans using that repository

Be careful when using post-commit script in subversion

The first argument $1 provided to post-commit represents the repository path as seen by the server side's process. In most configurations this is usually the file path.

 

The server's Repository path provided by default '$1' does not equal the URL configured in bamboo. You must alter the value before passing it to bamboo to be a substring of the configured path.

Alternately, you can simply hard-code the top-level URL path on each repository once. (even automated jobs should know the repo name/path at provisioning time)

 

Example

Users and bamboo plan are using an endpoint like https://svn.mycompany/team-one-repo/project-path/trunk 

But the server's svn process sees the path to the directory on the server, /var/svn-repositories/team-one-repo

Therefore a post-commit script to work on all repos would need to update the default argument before POSTing it to the plugin. This assumes a standard config on many servers/repositories. Otherwise simply hard code it (even automated jobs should know the repo name/path at provisioning time)!

post-commit (to work agnostically on many repos)
#!/bin/bash

repoPath=$1 # remember this is the FS path as seen by the SVN tool, NOT the FQDN seen by the user. You may need to append to the proper host/protocol
 
#repoPath = "/var/svn-repositories/team-one-repo"
 
$repoContext=${repoPath#/var/svn-repostories} #strips off the front
 
#repoContext = "/team-one-repo"

curl -X POST "http://localhost:6990/bamboo/rest/linkedrepositorytrigger/1.0/commit" -d '{"path":"'$repoContext'"}' -H "Content-type: text/json" 

 

 

  • No labels