How can I stop the ".git" folder being deleted from shared artifact?

I have a build plan setup like the following:

1. Checkout Stage - Spits out a shared artifact containing everything "**/*"

2. Build Stage - Spits out a shared artifact containing everything from 1 plus compiled binaries "**/*"

3. Release Stage - Merges changes to a release branch and does a push

The problem that I am having is that the ".git" folder is not being included in the shared artifacts which then makes stage 3 impossible. It looks like bamboo is using ant to create the artifacts which by default has a list of excludes (.git being one of them). How can I stop this occuring? Is there any way that I can override the default excludes?

2 answers

This widget could not be displayed.

The easiest way would be to change your artifact to point to a zip file created in a Script Task.

If your Release Stage is not optional, be sure to have a look at the features coming in Bamboo 4, which include automated merges with relase branches.

This widget could not be displayed.

I ended up temporarily renaming it to _git but turns out it's not that simple... The "remote" wasn't what I was expecting but rather a local cache location. It's in the too hard basket for now which is a massive shame. I'm sure that I'm not the first person wanting to do this.

Hm... but what exactly are you trying to achieve? To be able to make the Bamboo commit some changes (merge) and push it back to the upstream repo?

Why do you need three stages?

Why do you need to pass the source code as artifact (between stages 1->2->3)? Why not check the code on each stage (this would make the stage 1 not necessary any more)? Otherwise why not combine all the three stages into one Bamboo Job containing multiple Bamboo Tasks?

I'm thinking that your problem you want to solve is not passing the .git folder around the stages, but rather how to merge back changes into the repository - that's why I'm asking these questions, to better understand the situation and give better response.

It was done in stages to allow both Debug and Release builds to happen in parallel in the Build Stage, after having pulled down the source once in the Checkout Stage. Regardless though, the push problem remains. Even if all done sequentially in one stage, I still can't easily push a branch or tag because the remote location is a local cache and not the location specified in the build plan as I had expected.

How do you push? By using script task containing something like

git push

?

How about using explicit

git push ssh://git@github.com/org/repo aBranch

?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 11 hours ago in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

32 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you