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

Version 1 Next »

The repository is expected to pass a JSON payload providing the path of the repository. 

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

 

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.

 

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, file:///var/svn-repositories/team-one-repo

Therefore a sample post-commit script to work on all repos would need to update the default argument before POSTing it to the plugin.

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