UPDATE September 2014: I have now updated the tool to generate the HTML to place in your README file for more information please see this blog entry, so you can have a button that looks like this on your README.
At Dreamforce 2011, I had the pleasure of meeting Reid Carlberg, Jeff Douglas, Eric Magnuson and Richard Vanhook for the first time face to face, this alone was very exciting! I was co-presenting with them in a session entitled, ‘The New Frontier: PaaS and Open Source‘. In that session we talked about our thoughts on building an open source community on the platform. While this idea had not fully formed then, I was observing the barrier to entry for anyone getting a cool bit of open source Apex into their org was quite high compared to other platforms. Especially given both are in the cloud. Sure packages helped, but that put the overhead on the author to update them as well as the repository. As well as leaving a potentially unwanted package definition in the developers org. New developers on the platform also often struggle with Ant and Eclipse, leaving them copy and pasting to get the code in, yuk!
Inspired by the GitHub Clone in Desktop button you see on Github. I’ve created a tool that will deploy directly from Github into a Salesforce org. Its been deployed in the cloud, using Heroku, so there is nothing to install. Simply click a custom link pointing to the desired repo, login to your org and the tool scans the repository for Salesforce files (or packages) and after a brief confirmation page, your one click away from having the code in your org! To include such links in your README file, take the base URL of the following…
https://githubsfdeploy.herokuapp.com/app/githubdeploy
Then apply the owner and repository name, e.g.
https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/apex-mdapi
When visitors to your GitHub repo click such a link, they will be taken through an Salesforce oAuth login flow to their desired org, or if they are already logged in an initial prompt to confirm the app access needs are acceptable. Then they will see something like this… Clicking Deploy starts the deployment giving feedback as Salesforce processes…
Having reviewed a number of GitHub repositories containing Apex code and various other Salesforce files. Some utilise the documented Metadata API folder structure with a package.xml committed. Others include only the Apex class files, without the metadata xml files that accompany them. The tool attempts to resolve these differences via the following.
- If a package.xml is found, it will include everything in that folder exclusively and utilise the package.xml when deploying.
- If no package.xml is found, it will attempt to dynamically generate one.
- If no metadata file for an Apex class, it will create one for it.
I’ve tested the tool with a number of other repositories I found Salesforce code in and this seems to cover the majority of use cases. However I’m sure there will be some others I’ve not discovered. Right now I would recommend using a package.xml for now with the correct structure. Though you can experiment with the auto package.xml creation feature, if this works for you, it saves you a job keeping that in sync as well! NOTE: The tool does not run tests during the deployment, so will not deploy into production orgs, I may add a checkbox with a big disclaimer around it if there is demand. Bottom line this is a developer tool. Try it out! I hope this helps make our open source Salesforce projects even more accessible. I’ve now updated all the repositories I hang out in most often, check out Deploy to Salesforce links in the README files now. In the Apex Enterprise Patterns and its sample application repository (work in progress for upcoming Dreamforce 2013 session) and Apex Metadata API. Finally I’ve published the full source code for the tool here, feedback and ideas welcome! Update: Added Sandbox Support see additional blog here.
September 24, 2013 at 10:04 am
Reblogged this on Sutoprise Avenue, A SutoCom Source.
September 24, 2013 at 12:16 pm
I can see a tool like this directly helping the Salesforce Open Source community. It will make setting up an environment with some open source code exceptionally simple. Very nice addition Andy!
In the future I could see the addition of the checkbox you mentioned being useful, but I agree for now there shouldn’t be a way to force a github repo into prod so easily considering it may be difficult to get it back out if it isn’t something they absolutely want.
September 24, 2013 at 9:34 pm
Thanks, that is indeed the aim! Thinking about adding a ‘checkonly’ box, i’m finding the tool already useful for checking in an empty org the Github repo, of course once a deployment is made subsequent ones may give false positives or negatives. So a ‘checkonly’ would a be a good ‘Is my repo valid?’ facility. What do you think?
September 24, 2013 at 9:24 pm
Can I do this from the command line? Oh, please say yes!!!!
September 25, 2013 at 8:20 pm
In short no, but since I hate to leave you disappointed for to long, leave it with me for a bit… 😉
October 17, 2013 at 2:17 pm
The Leap project does command line push of Github files. https://github.com/cubiccompass/leap
October 17, 2013 at 2:26 pm
Nice!
September 25, 2013 at 8:17 pm
This is fantastic Andrew. Well done.
September 25, 2013 at 8:22 pm
Thanks Steven!
September 28, 2013 at 3:25 pm
This is so cool. Nice job.
September 28, 2013 at 5:47 pm
Thanks Scott! Let me know how you get in with it, all feedback welcome!
October 1, 2013 at 11:58 am
Awesome work! Can’t wait to try it out.
October 2, 2013 at 12:43 am
This is fantastic! As an open source supporter, I’ve been bummed by the barriers to entry that I found in the SFDC world. This tool sounds like it significantly hops over those barriers, and can really create a great new on-ramp for sharing open source code more easily in the SFDC world. Many thanks for this great contributon!
October 2, 2013 at 11:05 am
That’s the key use case I wanted to address here, I feel exactly the same way! Very pleased it’s hit the spot! 🙂
October 29, 2013 at 7:27 am
Hey Andy,
Could you tell me if I need to copy all the code or zip files of projects directly into salesforce org from github. How can we do that…??
October 29, 2013 at 3:21 pm
You don’t need to do that. Just create the URL to the tool as shown and it will do the rest. If you want me to test, let me know the Github repo you have in mind and i will check it for compatibility as per the requirements in the blog.
October 30, 2013 at 7:17 am
Can please check for me , I just need to either connect or add some salesforce projects into my eclipse or into salesforce instance. Can you please give me the steps..?
Thanks in advance for giving me time.
October 30, 2013 at 8:55 am
I will help. But I am not sure what you want to do now? This is a blog post on deploying directly from an existing public github repository to Salesforce. Can you give more detail on what it is you are trying to do?
October 30, 2013 at 9:26 am
I need the source of some projects in my eclipse or in my salesforce instance. What are the steps for this… How can I do that…?
October 30, 2013 at 10:09 am
And also can show me the tool which you had mentioned above…
October 30, 2013 at 12:24 pm
Where is the source currently located? If it is on a public GitHub you can use this tool. Again if your unsure how tell me the public GitHub and I will give you the URL. If the source is not in GitHub I cannot help if you don’t give me more information.
October 21, 2014 at 1:02 pm
Hey Andrew,
If my repo is private, the deploy will work?
Thanks
October 22, 2014 at 8:05 pm
Currently it does not support private repos. I’ve logged an enhancemnet request for this though, https://github.com/afawcett/githubsfdeploy/issues/4
November 13, 2013 at 2:29 am
Howdy! I’ve been trying to use this tool to install a project in GitHub into my sandbox, but no luck so far.
Just to clarify, when you say the tool won’t deploy in production orgs, what do you mean exactly? I’m curious why the tool redirects me to login.salesforce.com (instead of test.salesforce.com) if that’s the case–I suspect that’s where I’m going wrong.
Thanks in advance!
November 13, 2013 at 3:27 pm
The deployment won’t run any tests included in the repository, this is something hard coded at present, as such production org deployments cannot be done as they need tests to run as part of the deployment. This is somewhat deliberate at this stage as you can imagine don’t want any accidental deployments! It could provide an override and/or option to tick in the future perhaps. As far as sandbox goes it should support this, as this does not require tests to be run during deployments. Can you raise this as a potential issue on the GitHub issues page for the project. In the meantime, what happens if you are already logged into your sandbox and you try it?
November 27, 2013 at 10:08 am
while copying the code from github to salesforce in direct way only classes are being copied . i want to copy the whole code with classes , pages and objects .can anyone help me
November 30, 2013 at 8:14 pm
Yes I can help you, can you send me a link to the github repository your trying to deploy and I’ll try to reproduce your problem.
December 4, 2013 at 10:11 am
i want to deploy code from github to salesforce (test.salesforce.com) that is sanbox account while using the above mentioned deploy link i am getting following error
Authentication Failed: OAuth login invalid or expired access token
Be sure your Salesforce organization does not have IP restrictions. Logout and try with another user or organization.
i also tried to login by entering password along with security token but it is not working
can you help me with this issue
December 4, 2013 at 1:50 pm
This issue has been raised before, please add your details and other related details on your version of the problem https://github.com/afawcett/githubsfdeploy/issues?page=1&state=open, I’ll take a look at the weekend hopefuly! Sorry in the meantime.
December 7, 2013 at 8:13 pm
I’ve raised this as an issue here, https://github.com/afawcett/githubsfdeploy/issues/3
December 7, 2013 at 11:40 pm
I’ve added Sandbox support now, please see here, https://andyinthecloud.com/2013/12/07/updated-github-deploy-tool-sandbox-support/
Pingback: New Declarative Rollup Tool Release – Community Powered! | Andy in the Cloud
Pingback: The new GitHub Deploy to Salesforce Button! | Andy in the Cloud
Pingback: Salesforce: Lead Conversion and Record Types | Doug Ayers
Pingback: Salesforce: Chatter Org Chart | Doug Ayers
February 3, 2015 at 7:34 am
Hi Andy,
Great tool! Wondering if I could have some assistance. I just tried deploying visualforce-table-grid (https://github.com/Up2Go/visualforce-table-grid) to my sandbox, and I can’t find any of the deployed files.
The deployment log shows the following, and then lists the files which were uploaded (e.g. src/classes/AdvancedLookupCtrl.cls), but when I navigate to Clasess in Salesforce I can’t find the files.
Deployment Started
Status: Queued
Status: InProgress
…..
Status: InProgress
Status: Completed
Deployment Complete
Any guidance would be appreciated!
February 3, 2015 at 6:22 pm
Have you got a Listview filter set on your Apex Classes page?
February 3, 2015 at 10:37 pm
I have selected the “All Classes” view and verified that the view has not filtered out any classes by editing the view (i.e there is no filter criteria for the view).
Head scratching moment.
I guess I could manually create each file, but I may be there for a while 😦
February 7, 2015 at 6:15 pm
That is most odd, stupid question, but do you see other aspects from the repo in the org? Its not as if by accident its deployed to another org you happened to be logged into at the time? Also if you go to Monitor Deployments on the setup menu what does it show for the deployment?
February 8, 2015 at 10:11 pm
Not a stupid question at all! We only have one org in our Salesforce environment. I checked the Production instance just in case I didn’t select “Sandbox”, but no signs of a deployment in there either.
However, I may have sent you on a wild goose chase because I just realised I forgot to show you add one extra key line from the
log output in my post above, which is: “Unknown user permission: AllowUniversalSearch”
Deployment Started
Status: Queued
Status: InProgress
……
Status: Completed
Deployment Complete
Failures:
profiles/U2G_TestUserProfile.profile(U2G_TestUserProfile):Unknown user permission: AllowUniversalSearch
It’s the same error as described in the original post of https://github.com/Up2Go/visualforce-table-grid/issues/4
They mention that in order to get it working they “.. removed the Profile and installed all files.”
How do you explicitly remove one of the files from the deployment when using your “Deploy to Salesforce” tool?
Thanks again
February 9, 2015 at 12:52 pm
You cannot unfortunately, you have to download the source code to your local disc, edit the file then use Ant to deploy using Salesforce Migration Toolkit. Or ask the repo author to remove these entires from the profile or permission sets files, often they are not required and are only present due to the way they where originally extracted from their development org.
February 9, 2015 at 9:59 pm
That solves the great mystery. Thanks Andrew, much appreciated.
Pingback: How to Integrate github and Ant migration tool? | DL-UAT
June 18, 2015 at 10:59 am
1. If a package.xml is found, it will include everything in that folder exclusively and utilise the package.xml when deploying.
2. If no package.xml is found, it will attempt to dynamically generate one.
3. If no metadata file for an Apex class, it will create one for it.
Hi, not able to deploy without having a proper package.xml, however in point 2 you have mentioned that this will automatically generate the one. Got error – for deploying a custom object – BULK API error with version 29.0.
However i was able to do the same for a apex classes. Please suggest.
June 19, 2015 at 8:02 am
Can you open a GitHub issue for this please, and give a link to the repo your attempting to deploy. Thanks.
July 10, 2015 at 2:57 pm
Hey Andy – I just setup my repo with this tool (AWESOME! Thanks for developing it). I’m trying to identify the best way to setup our repo for deployments and in general (we will most likely move to Jenkins for automation), which made me start thinking about this tool. Will this allow us to deploy a specific branch (i.e. Staging or Develop) or will it only deploy what is in Master? I’m assuming that later. If it is that later, is this button viable for managing your internal deployments and releases and if so how would you suggest deploying to a Staging/Test server and a Development server?
Thanks again
-Garrett
July 11, 2015 at 8:41 am
Thanks glad you like it. Currently it doesn’t support branches, please check but I think there is a registered enhancement for branch support, if not please add in on the GitHub repo issues list. I have not checked, but doubt it’s a lot of work, so can take a look soon if you like. It also supports private repos so can be used for deployments as you propose.
December 16, 2020 at 9:30 pm
Hey Andy, Is it currently possible to use this for branches? I’m trying to do so but it’s not letting me. This would be a huge help!
December 31, 2020 at 8:37 pm
Yeah you can use branches – got to this page to generate a URL https://githubsfdeploy.herokuapp.com/
October 21, 2015 at 9:54 am
Hi Andy
I get following exception when I try to move my Github code to a developer organisation.
Unhandled Exception : com.sforce.ws.SoapFaultException: INSUFFICIENT_ACCESS: use of the Metadata API requires a user with the ModifyAllData permission
Thanks
Mudmayee
October 22, 2015 at 6:04 pm
Your Salesforce user needs to be an admin or have the permission stated in the error message.
March 2, 2016 at 12:03 pm
While deploying the repository financialforcedev/apex-mdapi to salesforce getting the following error:
Deployment Complete
Failures:
classes/MetadataServicePatcher.cls(522,18):Illegal assignment from List to List
March 2, 2016 at 3:29 pm
This maybe a bug in the code or the platform, please can you raise on GitHub an issue thanks
Pingback: GitHub Salesforce Deploy Tool Lightning Edition | Andy in the Cloud
August 23, 2016 at 1:10 am
Hi Andy,
I’m getting the following while deploying “https://github.com/davidhabib/Auctions-for-Salesforce”
Deployment Started
Status: Queued
Status: Completed
Deployment Complete
Failures:
package.xml:The specified package namespace: GW_Auctions does not match the namespace for the server:
Could you please help me!
August 23, 2016 at 9:27 am
This is a problem only the owner of the repo can resolve. Suggest you raise an issue on their GitHub repo to ask that it is resolved.
August 31, 2016 at 9:43 pm
Thanks for your reply Andrew. This tool is great! worked like a charm with the repositories. Thanks a lot! You are awesome!
October 7, 2016 at 4:09 pm
Hi Andy, yesterday when trying to use the tool I received
“Oops, something went wrong…
Authentication Failed: OAuth login invalid or expired access token
Be sure your Salesforce organization does not have IP restrictions. Logout and try with another user or organization.”
Then I deactivated the update “Require TLS 1.1 or higher for HTTPS connections” and started to work.
But today I got the same problem and the update is deactivated, any suggestions?
Regards, Leo
October 19, 2016 at 12:00 am
There is some issue here i need to get into. Meanwhile if you fully exit your browser and make sure your not logged in to any org. Click the Deploy to Salesforce button again and it should prompt you to login and all should be well. Sorry about this in the meantime.
October 25, 2016 at 10:55 am
This is cool.
I have tried to deploy from Git ‘master branch’ to Salesforce Dev edition, which is worked!!!
Can you please let me know, how I can deploy from Git ‘branch’ to Salesforce. I have tried with branch URL(Ex:https://githubsfdeploy.herokuapp.com/app/githubdeploy/Jansi-A/MyOwnRep/tree/Branch1/), but getting error ‘Oops, something went wrong…’.
Regards
Jansi
October 25, 2016 at 4:58 pm
Branch deploys is on the futures list sorry
October 28, 2016 at 1:56 pm
Thank you, Andy for the update. Sure, will wait for the same :).
Regards
Jansi
October 2, 2017 at 11:01 pm
Hi Andy,
Does it works for branches now?
October 3, 2017 at 3:02 pm
It does indeed! 👍🏻
November 7, 2016 at 7:53 pm
Hello Andrew…This is a great tool. I want to use it but when I open the following URL: https://githubsfdeploy.herokuapp.com/app/githubdeploy/financialforcedev/apex-mdapi
but I am redirected to login.salesforce.com. I want to use this tool for my sandbox. Please suggest.
November 8, 2016 at 1:41 pm
Yes you need to backup a bit, there is a different URL or landing page that lets you choose. https://githubsfdeploy.herokuapp.com
November 9, 2016 at 10:10 pm
Thanks much Andrew…I am getting the sandbox option now. If I select that and click on ‘Login To Salesforce’, give my credentials I get following message: ‘oops, something went wrong’. Also what are the owner and repository fields on the page. Please suggest.
November 10, 2016 at 12:59 am
This is a known issue, please make sure you are logged out all orgs and if needed restart your browser
December 7, 2016 at 9:56 pm
Hi Andrew,
I wanted to install Declarative Lookup Rollup Summaries in Salesforce and I wasn’t sure how to do it. I saw this post and so I went to:
https://githubsfdeploy.herokuapp.com/app/githubdeploy/afawcett/declarative-lookup-rollup-summaries
Everything seemed to be going well:
Deployment Started
Status: Queued
…
Status: InProgress
…
Status: Completed
Deployment Complete
But I don’t see Declarative Lookup Rollup Summaries under my “Getting Started” dropdown in Salesforce. I tried logging out and back in.
Please help.
(Loving your DLRS tool, by the way… where someone else had installed it. Thanks)
December 8, 2016 at 1:39 am
Using the package install links on the readme. That deployment method is for developers wanting to change the code or contribute.
February 15, 2017 at 12:59 am
This is a great tool but seems only intended to work with public open repositories, cool for open source. I wanted to also simplify deployments from the private repo but that does not seem to work. Do I need to set up my own Heroku app to handle private github repo?
February 16, 2017 at 1:43 am
Thank you. This requirement is in the GitHub enhancement list in the tools repo. Sadly simply deploying to your own Heroku won’t cut it, without code changes to add authentication to GitHub. It’s something I am keen to add, but current commitments prevent me investing the time. If you want to have a go I would be happy to review a pull request with the code changes in.
February 16, 2017 at 2:28 am
I just responded to this question elsewhere on my blog for you, sorry not sure where.
May 23, 2017 at 12:02 am
looks to me that deployment now can be done to PROD orgs so you might want to update the text in the main blog post. Tests appear to be executing when one looks at Setup | Deploy | Deployment Status. The ‘Deploy to Salesforce’ log will show ‘In Progress’ lines over-and-over again as a visual indicator (sort of) that tests are in flight.
Pingback: Deploy to Salesforce from GitHub - ABHISHEK SUBBU
August 29, 2017 at 1:51 pm
Any option for the tool to execute an Apex method after deployment. Trying to support a scenario where I want to load data (ex: from static resource) to a custom object after deployment is done.
August 29, 2017 at 2:00 pm
None at present, but that’s a great idea!
October 2, 2017 at 10:59 pm
Does this work with bitbucket?
October 3, 2017 at 3:01 pm
No, though it’s on the good ideas list! 👍🏻
October 16, 2017 at 2:19 am
While deploy to sandbox they ask Owner,Repository and Branch, what we give there?
October 18, 2017 at 6:50 am
Owner is your GitHub user name. Repository is the name of your GitHub Repository (place for the code). Branch is optional, but allows you to point to an alternative copy of the code. It is best to understand Git and GitHub a bit more before trying it out. You will also find these fields are defaulted if you add the button to your readme file and press it. Good luck! 👍🏻
November 24, 2019 at 11:01 pm
Thanks for sharing this valuable information
April 10, 2020 at 11:28 pm
Hi,
I am deploying the github repo:- https://githubsfdeploy.herokuapp.com/app/githubdeploy/apex-enterprise-patterns/fflib-apex-mocks.git
but unable to do it. Getting the below error:-
Deployment Started
Status: Queued
Status: Completed
Deployment Complete
Failures:
deploy/classes/fflib_Answer.cls(67,10):Dependent class is invalid and needs recompilation:
Class fflib_InvocationOnMock : Dependent class is invalid and needs recompilation:
Class fflib_ApexMocks : Type is not visible: test
April 11, 2020 at 10:11 am
You need to deploy the apex mocks library first.
August 5, 2020 at 10:04 am
Hi Andrew, Does this now also work with Bitbucket please?
December 31, 2020 at 9:19 pm
Sorry thats still in the backlog
Pingback: Apex Mocks github deployment to Production stuck in Status: Queued – GrindSkills