Commit your Salesforce.com code base to Stash

This guide is part two of my ‘How to set up Continuous Integration for Salesforce.com’ series of posts, and will take you through committing your Salesforce.com instance into your Stash repository.

In the previous article we created a basic Eclipse Project that shared it’s folder with the SourceTree application. We also saw that when you added a file to this folder, SourceTree can see the change and commit it into Stash.

In this article we will re-use the same principle, but with our Salesforce code base.

 

Pre-requisites

This tutorial assumes that you  have the pre-requisites available from the parent article – ‘Setting up Continuous Integration for Salesforce.com with Stash, Bamboo and SourceTree‘, and have carried out the first step of this walkthrough – ‘Setting up Eclipse, and making your first commit to Stash‘.

 

1. Update your Eclipse Project to have a ‘Force.com Nature’

1.1 – In Eclipse, find your existing project (mine is called ‘ciTutorial’), then right-click on it and select ‘Force.com -> Add Force.com Nature’. This will allow us to connect to our target org, and also perform other Salesforce.com specific actions. A pop-up message will be displayed, but can be ignored.

Screen Shot 2015-04-06 at 17.21.34

1.2 – Now that the Force.com nature is added, there are a lot more options available to you when you select the ‘Force.com’ option on right-click again. The next step is to connect this project to your Salesforce environment – do this by selecting ‘Force.com -> Project Properties’.

Force.com Project Properties in Eclipse

On this screen enter your Salesforce environment’s username, password and security token. I recommend that you start with your live environment (not a development or test environment), as live is the best starting point for your repository. Newly developer code can be added later.

1.3 – Choose the metadata that will be stored in CI. The default setting is ‘Apex and Visualforce’, which is fine if you want to do basic development, but in this tutorial we want to be able to deploy a complete Salesforce instance. Therefore, choose ‘Selected metadata components:’ and select any folders that contain files.

Screen Shot 2015-04-06 at 14.44.40 

Selecting empty folders at this stage can confuse matters later when trying to configure automated deployments, so for now I recommend you only take what you are using.

1.4 – When ready, hit ‘Finish’ to download the Salesforce metadata to your machine. This will save the files to your machine in your Eclipse workspace.

1.5 – When the download is completed, your Eclipse project should be updated to contain your Salesforce files.

Screen Shot 2015-04-06 at 17.40.33

2. Commit your Salesforce code into Stash

2.1 – Navigate to SourceTree and open up your repository that the Eclipse project is using. SourceTree should have picked up on a whole load of uncommitted changes. These are all the files that you just extracted from Salesforce in step 1.

Screen Shot 2015-04-06 at 17.43.00

 

2.2 – To commit all this code, highlight all the file in the ‘working tree’ and drag them into the ‘staged’ section, then hit ‘Commit’ in the top left hand of the screen. Review the commit screen (remember to enter a description and tick ‘Push commits immediately to: origin’) and commit when ready.

Screen Shot 2015-04-06 at 17.47.51

 

2.3 – With the commit complete, your SourceTree should look something like this:

Screen Shot 2015-04-06 at 17.49.49

And your Stash repository should look something like this:

Screen Shot 2015-04-06 at 17.52.05

Now, your entire live Salesforce code base is in Stash. It can now be accessed by developers and other team members to start developing changes and committing them.

 


<– Previous: Setting up Eclipse and making your first commit to Stash

Next: Developing new features and committing them to Stash –>


 

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Seo wordpress plugin by www.seowizard.org.