Post on 11-May-2015
description
Automating DeploymentsBetween Orgs UsingGit and Continuous IntegrationSebastian Wagner
Freelance Certified Technical Architect
www.linkedin/in/se6wagner
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Sebastian WagnerCertified Technical Architect
“I cannot teach anybody anything,I can only make them think”
Socrates
Agenda• Challenges and Issues• Multi-Org Scenarios• Approach• Benefits• Best Practices• Q&A
deploying to production on a Friday afternoon
Challenges and Issues• keeping orgs in sync as a team• changes get overwritten by other developers• amount of time required for manual deployment• conflicts / errors discovered late in the process• limited traceability of changes
Scenarios - SDLC
development QAuser
acceptance tests
deployment
Scenarios – Single Sandbox
Scenarios – SDLC Environments
Approach – Before The Silver Bullet
Approach – (Not) The Silver Bullet
Approach – Components• Salesforce Orgs for Development
– Sandboxes– DE Orgs
• Git for Source Code Management– Github or bitbucket.org for hosting– Command Line / SourceTree / other as a client
• Continuous Integration for automated deployments– Jenkins or Bamboo for orchestration– Ant & Force.com Migration Toolkit for deployment
Approach – Salesforce Orgs• separate Salesforce Org per developer• dedicated CI Salesforce Org
– where all features will be integrated and compiled
• Salesforce Org for stages in SDLC– QA (with integrated QA can be done in CI)– UAT– Pre-Prod
Approach - git• store source code & metadata
– Apex and Visualforce Code– min. include referenced components required for deployment
• track changes• isolate features and stages of the SDLC
– branches for isolation of features and stages– tags for releases and versioning
• store supporting resources– reference/ config data for migration– Integration config, test scripts, etc,
Approach – git (commands)• git clone• git commit• git push• git pull• force deploy
Approach - CI• Automation
– ant based deployment from git repository– execution of supporting tasks– notifications on build errors– Reporting
• Setup– data migration (test and/or config data)– execution of setup scripts
• Testing– Unit test execution– UI test execution
Approach - CI
when a build has no errors
http://thecodinglove.com/post/86204416476/when-a-build-has-no-errors
Benefits• Source Code ‘Backup’• Automation
– automated deployment to multiple orgs– automated test execution– eliminate human error from deployment
• Visibility – The 5Ws of a change– Who What When Where Why
• Validation– issues get detected early in the process– resolve issues close to cause
Best Practices • start simple• automate as much as possible• integrate with your ticketing system• use git branching model and tags• pull requests to merge features• commit & build regularly• maintain destructive changes log
BP – Ticketing Integration
BP – Ticketing Integration
BP – Gitflow Branching• Master
– The holy grail aka Production
• Hotfix– maintenance outside of dev
• Release– ready for UAT
• Develop– main development stream
• Feature– individual feature / story
www.atlassian.com/git/workflows
BP – Gitflow Orgs
www.atlassian.com/git/workflows
BP – Pull Requests• Review Code
– natural stage gate for reviewing code– comment and refactor
• Accept and Merge– accept changes– merge to target branch
www.atlassian.com/git/workflows#!pull-request
BP – Pull Requests
www.atlassian.com/git/workflows#!pull-request
BP – Pull Requests
www.atlassian.com/git/workflows#!pull-request
BP – Pull Requests
www.atlassian.com/git/workflows#!pull-request
BP – Pull Requests
www.atlassian.com/git/workflows#!pull-request
BP – Commit & Build • Commit & Push frequently
– refresh from server frequently to incl. all metadata fields– push to remote at least daily– integrate Config orgs through change sets
• Pull frequently– pull and merge changes to sync with other developers– save against org
• Build regularly– frequency dependent on execution time– execute non Managed Package tests for performance– run with validateOnly in single sandbox scenario
Summary• Do it!• Build!• What to do next
– Know your Metadata– Learn Git (https://try.github.io)– Set up tools to match your workflow
• Search / Ask Questions– DevZone– Developer Forums– Salesforce StackExchange
Services
You are looking for help setting up or optimizing Continuous Integration?
I offer expert services for
• Solution Design• Design Authority• Platform Governance• Practice Development and Dev Ops
For more details feel free to reach out via LinkedIn
www.linkedin.com/in/se6wagner
References
Force.com Development Lifecycle Guide
http://bit.ly/sf-dlc
Force.com Migration Tool Guide
http://bit.ly/sf-ant
Developer Wiki – CI Techniques
https://developer.salesforce.com/page/Bestpractices:Continuous_Integration_Techniques
Mark Cane - CI Thoughts
http://blog.force365.com/2012/04/16/salesforce-continuous-integration/
Anup Jadhav – CI with Bamboo
http://anupjadhav.com/2013/03/11/salesforce-CI-bamboo-jira/
Jeff Douglas – CI with Jenkins
http://blog.jeffdouglas.com/2013/03/18/setting-up-continuous-integration-for-saleforce-development