-->

bamboo - build my pull request

2020-07-27 02:30发布

问题:

Im trying to trigger builds in bamboo when a pull request comes into git. I can send the webhook info to bamboo but instead of building the appropriate sha-labeled checkin it just builds the 'master' branch.

Does this require some custom git setup to bamboo? Im not seeing anything straightforward so far.

In my last gig we used Jenkins and it seemed to tie together pretty well. I'm passing the sha-1 to bamboo with the pull request. Now I just need to convince it to use it.

回答1:

Turns out the trick is to capture the id of the pull request from git and use this to checkout the appropriate version from git.

Inspiration from here. I ended up using php to parse the output from the git hook.

Use this to get the right bits from git (on your bamboo box):

cd ${bamboo.build.working.directory}
git fetch https://github.com/person/some_util +refs/pull/${bamboo.pull_num}/merge:
git checkout FETCH_HEAD


标签: git bamboo