How to deploy from Bamboo using Git?

How can I deploy from OnDemand Bamboo to an external server via a Git repo?

What I had envisioned was:

  1. Have Bamboo checkout a branch from the Git repo (on Bitbucket if that matters).
  2. Run targets from a build.xml file stored in the repo, these targets would run Unit Tests or minimize CSS and JS files. In other words, perform some actions on the files.
  3. On build success, create a zip artifact or create a new tag and commit that to the repo.
  4. Have Bamboo connect, maybe via SSH, to the web host and execute a Git pull to update the code on the server.

The problem seems to be that, because I'm using Git, I can't push back to the repo as I want to do in #3. Then, I don't have a way to connect to the web host to execute the pull because I can't seem to automate an SSH call that uses user/pass credentials.

Am I thinking about this wrong? Is this possible in a downloaded instance but not in OnDemand? Am I missing something obvious?

1 answer

0 votes

Joe, there shouldn't be any difference.

"Push tag" part

On OnDemand, the checkout will be made from HTTP url, so no credentials will be available to the agent and you need to make sure they're there.

Also, like all checkouts made against a specific revision, your checkout may be a 'detached head' checkout, meaning that you need to make sure you're repo is appropriately synced with origin so that the tag/push call suceeds.

Finally, IIRC, the repository will have no origin defined, so you need to specify the push destination.

"Pull" part

If you use HTTPs access for pull, you can inject user/pass directly into the URL - this is the simplest method.

Otherwise, you need to make sure you SSH has access to credentials you want to use.

I think I follow most of that, but what I realized is I can do almost all of it through running scripts as a task in the build. What I'm still stuck on, however, is connecting to the webhost server via SSH. The only way I could figure out to do it was to install the SSH plugin from Atlassian Labs, but of course you can't install a plugin in the OD instance.

Maybe I should put it this way: how can I run commands on a remote server from a OD Bamboo task?

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,066 views 0 5
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot