automating deployment between orgs using git & continuous integration

35
Automating Deployments Between Orgs Using Git and Continuous Integration Sebastian Wagner Freelance Certified Technical Architect www.linkedin/in/se6wagner

Upload: sebastian-wagner

Post on 11-May-2015

2.143 views

Category:

Technology


0 download

DESCRIPTION

Updated with the deck from DF14 As a fully certified TA, I offer expert consulting services around continuous integration, practice development and governance to help customers leveraging the advantages of SFDC. https://uk.linkedin.com/in/se6wagner/ Abstract: Automating the deployment between environments (dev, test, prod, etc.) gives consistency, visibility, and validation to the process.This greatly speeds up deployment and provides early detection of defects. Join us as we cover the theory and best practices of this approach. You'll discover how to design your own automated processes using Continuous Integration (CI) tools and Git version control.

TRANSCRIPT

Page 1: Automating Deployment Between Orgs Using Git & Continuous Integration

Automating DeploymentsBetween Orgs UsingGit and Continuous IntegrationSebastian Wagner

Freelance Certified Technical Architect

www.linkedin/in/se6wagner

Page 2: Automating Deployment Between Orgs Using Git & Continuous Integration

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.

Page 3: Automating Deployment Between Orgs Using Git & Continuous Integration

Sebastian WagnerCertified Technical Architect

Page 4: Automating Deployment Between Orgs Using Git & Continuous Integration

“I cannot teach anybody anything,I can only make them think”

Socrates

Page 5: Automating Deployment Between Orgs Using Git & Continuous Integration

Agenda• Challenges and Issues• Multi-Org Scenarios• Approach• Benefits• Best Practices• Q&A

Page 6: Automating Deployment Between Orgs Using Git & Continuous Integration

deploying to production on a Friday afternoon

Page 7: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 8: Automating Deployment Between Orgs Using Git & Continuous Integration

Scenarios - SDLC

development QAuser

acceptance tests

deployment

Page 9: Automating Deployment Between Orgs Using Git & Continuous Integration

Scenarios – Single Sandbox

Page 10: Automating Deployment Between Orgs Using Git & Continuous Integration

Scenarios – SDLC Environments

Page 11: Automating Deployment Between Orgs Using Git & Continuous Integration

Approach – Before The Silver Bullet

Page 12: Automating Deployment Between Orgs Using Git & Continuous Integration

Approach – (Not) The Silver Bullet

Page 13: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 14: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 15: Automating Deployment Between Orgs Using Git & Continuous Integration

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,

Page 16: Automating Deployment Between Orgs Using Git & Continuous Integration

Approach – git (commands)• git clone• git commit• git push• git pull• force deploy

Page 17: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 18: Automating Deployment Between Orgs Using Git & Continuous Integration

Approach - CI

Page 19: Automating Deployment Between Orgs Using Git & Continuous Integration

when a build has no errors

http://thecodinglove.com/post/86204416476/when-a-build-has-no-errors

Page 20: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 21: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 22: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Ticketing Integration

Page 23: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Ticketing Integration

Page 24: Automating Deployment Between Orgs Using Git & Continuous 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

Page 25: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Gitflow Orgs

www.atlassian.com/git/workflows

Page 26: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 27: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Pull Requests

www.atlassian.com/git/workflows#!pull-request

Page 28: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Pull Requests

www.atlassian.com/git/workflows#!pull-request

Page 29: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Pull Requests

www.atlassian.com/git/workflows#!pull-request

Page 30: Automating Deployment Between Orgs Using Git & Continuous Integration

BP – Pull Requests

www.atlassian.com/git/workflows#!pull-request

Page 31: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 32: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 33: Automating Deployment Between Orgs Using Git & Continuous Integration

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

Page 34: Automating Deployment Between Orgs Using Git & Continuous Integration
Page 35: Automating Deployment Between Orgs Using Git & Continuous Integration

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