This script is meant to run as a service in SFM as receiver for git commit POSTs. On each commit, a call is made to the GUS partner API. This call will generate a "change_list" object used to associate a code check with a GUS story or bug.
The service needs to run on a host where it can access your git server. This was developed in SFM against the git.soma server.
Add dependent python modules need to be installed on the host. I recommend using python's "virtualenv" for this.
Setup and start the service
- git clone https://git.soma.salesforce.com/pchristian/AgileAcceleratorGitWebHook.git
- cd AgileAcceleratorGitWebHook
- Modify the properties.json file as necessary
- python changelist_service.py
- Ping it to make sure it's up; From a separate terminal > wget http://localhost:8080
Configure the Git repository
- From the Git HTTP UI, navigate to your repo.
- Click 'Settings' -> 'Webhooks & Services' and click 'Add webhook'
- Fill in the Payload URL with the location of the service from previous steps
- Set the content type to 'application/json'
- Leave secret empty for now
- Select 'Just the push event'
- Make sure the Activate check box is selected
Assuming everything is configured appropriately you should be ready to test is out
- Check out a git repo and make a simple edit to a file. I.e. a README.md
- Add it. I.e. git add README.md
- Commit it, but when you do add a work item ID to it. I.e. "Checking in a fix for whatever W-2572989 ".
- Push the commit.
- Wait a little bit then navigate to the GUS work item. You should see an entry in the Change List section at the bottom of the page.
- W00t! You're done!
Apache's native to SSL support ( mod_ssl ) was used to support SSL and a rewrite rule was to foward the port.
I.e.
RewriteEngine on
RewriteRule ^(.*) http://127.0.0.1:8080$1 [proxy]
Add in secrete key bits