How to commit changes after build

Maxim Kuzmik February 22, 2016

Hello. I wiant than bamboo commit changes after build. So I add script file like this:

'git commit -a -m "${bamboo.buildKey} ${bamboo.buildNumber}"

git push origin development'

 

But iot's not do it. Error is [detached HEAD 8943e60] So. This is simply question. How can i commit changes in bamboo task script job?

4 answers

0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2016

I wrote this guide specifically for tagging a commit and pushing back to Stash (BitBucket), but it should be easily adaptable.  https://almfirst.wordpress.com/tagging-from-bamboo/

It's surprisingly not as simple as you'd think, as far as I've been able to figure out, because of the somewhat funky way that Bamboo does git and because the build may actually be running on an agent that doesn't share the SSH set up that the server itself uses.

0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2016

Ok.  In the actual source?  Usually I've seen that as just tags, but I can see the use case for wanting it to be in the source as well.

I wrote a guide to tagging a commit and pushing it back to BitBucket.  I'll page a link as an answer - I think it should be easily adaptable to your situation.

0 votes
Maxim Kuzmik February 23, 2016

It's not bad practice. Release version and build number.

0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

That sounds like generally bad practice - what changes are you making to your source within your build that you want to commit back into source control?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events