Best way to pull source from Stash using Ant


We are listing our options to migrate from SVN to Stash. One of the biggest challenges is to cover all the ways that we are using the SVN repository and make sure that they are still possible after the migration.

One of these potentially problematic usages is a set of Ant scripts which dont run on our CI server (Bamboo) and thus need to obtain the sources 'manually'.

We where wondering what the best practice would be here, is there some API available to facilitate this or would we be needing to execute the git commands by means of the Ant 'exec' task.

All thoughts are very welcome.

1 answer

1 accepted

0 votes
Seb Ruiz Atlassian Team Mar 07, 2013

I guess it depends on what your ant tasks do. If you want to retrieve "information" about your Git repositories, then you can use the Stash REST apis to retrieve changeset history etc. You will only be able to use the Stash Java APIs in the process of a Stash instance (as a plugin in the app), but I don't think this would be useful to you if you are in an Ant task.

Alternatively, you can of course use Ant's exec task to run arbitrary git commands, but you will need to first clone the repository which may not be necessary, depending on your requirements.

If you could provide more information on what your Ant tasks do or what they are used for, we might be able to provide a more relevant set of suggestions!

Sure, I ran trough the scripts and we would basically need a replacement for the following SVN operations available used as Ant task today:

  • checkout
  • revert
  • export
  • switch
  • info
  • update

It looks like my best bet would be invoking the git command directly, I assume that the Bamboo Git integration does someting similar?

Seb Ruiz Atlassian Team Mar 08, 2013

Bamboo's git integration only clones repositories so that it can run tests against the source. If you need to perform repository modifications, then you'd need to execute your own git commands.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

678 views 0 4
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