SlideShare a Scribd company logo
SuperchargeYour
Continuous
Integration
Deployments
Nikola Gotsev
April 26, 2016
What isContinuous Integration ?
Isn’t that the same asContinuous
Deployment ?
Or is it related to the source control
system I use ?
Or maybe it is a tool ?
NO !
Continuous Integration is a process
and a development practice.
CI -The Practice
• Maintain a single source repository
• Automate the build
• Make your build self-testing
• Every commit should build on an integration machine
• Make it easy for anyone to get the latest executable
• Everyone can see what’s happening
CI -The Process
• Developers check out code into their private workspaces.
• When done, commit the changes to the repository.
• The CI server monitors the repository and checks out changes when they
occur.
• The CI server builds the system and runs unit and integration tests.
• The CI server releases deployable artefacts for testing.
• If the build or tests fail, the CI server alerts the team.
• Continue to continually integrate and test throughout the project.
CI -The Process
https://insights.sei.cmu.edu/devops/2015/01/continuous-integration-in-devops-1.html
CI -The ProcessSitecore Nightly Build
https://insights.sei.cmu.edu/devops/2015/01/continuous-integration-in-devops-1.html
The most common problem?
“It is cheaper to find bugs in lower environments. It is really
cheap on a Dev Box and really expensive on Production.”
- CharlesTurano, CTO, Hedgehog Development
“Continuous Integration doesn’t get rid of bugs, but it does
make them dramatically easier to find and remove.”
- Martin Fowler, Chief Scientist,ThoughtWorks
How do I supercharge myCI Process?
Rule #1
Always have a continuous integration build in place!
Scheduled builds count!
Rule #1.1
Have an award for whoever broke the build last!
Rule #2 Branches
Rule #2 Branches
Make sure to …
• … have a master branch
• … have a development branch
• … create tags for production releaases
• … have feature branches for long running features
• … use hotfix branches as necessary
Rule #2SampleGit Branching Model
https://backlogtool.com/git-guide/en/stepup/stepup1_5.html
Rule #3
Always manage your project dependencies!
Yes the front-end ones as well!
Rule #3 Nugget
Rule #3 Nugget
Rule #3
Or just your custom code !
Rule #3 Front-end Dependencies
Bower
Rule #3 Front-end Dependencies
Never version compiled front-end resources (css, javascipt
etc.) into source control. Let the build compile them the
same way it does with your C# code!
Rule #4 Tests,Tests,Tests
Rule #4 Make yourSitecore code testable
• Use MVC 
• Always depend on abstractions not on implementations
• Consider using Dependency Injection frameworks
• Use ORMs – Glass, Fortis, Synthesis
• Make sure to try Sitecore.FakeDb
Super chargeyourcontiniousintegrationdeployments
Rule #4UnitTests
Rule #4 IntegrationTests -Selenium
Takeaway
Rule #5 Keep your content up to date
Sitecore PowerShell Extensions
Rule #6Continuous Deployments
Continuously Deploying Items
Usually a 3 step process:
1. Find a way to serialize your items and bring them to
source control
2. Build a package out of your serialized items
3. Deploy the package to the environment
Continuously Deploying Items-Serialization
Or your custom solution !
Continuously Deploying Items – Building a Package
Sitecore Courier
ContinuouslyDeployingItems – Installingthe Package
• Sitecore.Ship – Automatically installs packages posted
via HTTP
• Sitecore Package Deployer – Automatically installs
packages from deployed on the file system
Continuously Deploying Items- Notes
• TDS can deploy items directly(without a need for
packaging), if the build server has access to the
webserver file system
• Unicorn can deserialize deployed serialized items
without the need for packaging
Continuously Deploying Items–SomeAdvices
1. Keep a minimum amount of content versioned in source
control
2. Never deploy content and media to higher
environments, use tools or packages to move them
3. Always backup the databases before deploying items
Continuous Deployments -Scripting
• Embrace the scripting !!!!
• Invest some time to learn PowerShell
• Script common tasks as DB andWebsite Backups
• Script common SitecoreTasks with Sitecore PowerShell
Extensions
Production-To Deploy or NotTo Deploy?
My perfect production build scenario
1. Clean Code Checkout
2. Restoring NuGet Packages
3. Restoring and Recompiling Frontend Assets
4. Running UnitTests (Integration – lower environments)
5. Automated PowerShell backups (Remote Execution)
6. Building CM and CD Packages
7. Deploy and install the packages (install can be manual)
Questions?
44
Thank you!
ngotsev@hhogdev.com
@nsgocev
http://sitecorecorner.com

More Related Content

Super chargeyourcontiniousintegrationdeployments

Editor's Notes

  1. Hi I am Nikola Gotsev Senior Solutions Developer at Hedgehog Development and a Sitecore MVP. There are tons of blog posts out there – explaining how to set continuous integration with Tool X using technology Y. But non of these answers the most important question
  2. I
  3. Maintain a single source repository Automate the build Make your build self-testing Every commit should build on an integration machine Make it easy for anyone to get the latest executable Everyone can see what’s happening
  4. Developers check out code into their private workspaces. When done, commit the changes to the repository. The CI server monitors the repository and checks out changes when they occur. The CI server builds the system and runs unit and integration tests. The CI server releases deployable artefacts for testing. If the build or tests fail, the CI server alerts the team. Continue to continually integrate and test throughout the project.
  5. Sitecore – a bit different. We also need to deploy items
  6. How many of you have actually had to deploy on Friday ? Story about 3k emails.
  7. I see many people just setting up automated builds – NO CI.
  8. We have the hedgehogs of shame 
  9. Really depends on your own process, but here are some recommendations for successful branching model. GIT Shines – can be achieved with other source controls too ! … have a master branch … have a development branch … create tags for production releases … have feature branches for long running features … use hotfix branches as necessary I also use release branches for staging – makes it more secure.
  10. We at hedgehog use NuGet a lot ! Sean H talked about this yesterday, so I am not going to dig into it. Make sure to check it out.
  11. Frontend Development improved a lot ! No longer just slicing designs. Embrace your frontend guys needs. Gulp and grunt are not just frontend. You can use them to automate some parts of your development – watchers (before auto content sync). Habitat uses gulp a lot
  12. Use MVC  Always depend on abstractions not on implementations Consider using Dependency Injection frameworks Use ORMs – Glass, Fortis, Synthesis Make sure to try Sitecore.FakeDb
  13. I see you ordering the book on amazon.
  14. Mostly Quality Assurance Engineers job. My GF is amazing at that 
  15. For the guys who ordered the book on amazon.
  16. Usually a 3 step process: Find a way to serialize your items and bring them to source control Build a package out of your serialized items Deploy the package to the environment
  17. Keep a minimum amount of content versioned in source control Never deploy content and media to higher environments, use tools or packages to move them Always backup the databases before deploying items
  18. Clean Code Checkout Restoring NuGet Packages Restoring and Recompiling Frontend Assets Running Unit Tests (Integration – lower environments) Automated PowerShell backups (Remote Execution) Building CM and CD Packages Deploy and install the packages (install can be manual) – just a single manual step.