Continuous Delivery with Sitecore, TDS, Git, Team City, Octopus and Sitecore Ship Part 1

There have been many posts on this topic around the Sitecore community and I’ve used bits from a few different posts that I’ve added under the references heading below.

This post details the process I’ve used recently  for deployments with Sitecore, Team Deployment for Sitecore (TDS), Git, TeamCity, Octopus Deploy and Sitecore Ship.

What is Continuous Delivery?

Continuous Delivery is a software development discipline where you build software in such a way that the software can be released to production at any time.

Martin Fowler

Software Used

I’ll assume you have TeamCity and the TeamCity Plugin for Octopus deploy but the guides are Install Team City and Install the Octopus Plugin for TeamCity.

Configure TeamCity

1. Setup the Version Control Software

Here I have used Git adding the project Url, branch and credentials.

TC-VCS

Key Settings

  • Fetch Url – Url to the source control repository
  • Authentication method – If you choose Password you will need an account with access to the source control repository.

2. The TeamCity Build Steps look like this:-

  • Restore NuGet Packages

RestoreNugetPacakages

Key Settings

  • Runner Type – Choose Nuget Installer
  • Path to Solution File – Click the Tree List Icon to browse to the sln file.
  • Update Mode – Choose Update via packages.config file

3. Build the Solution and Run OctoPack

BuildSolution

Key Settings

  • Runner Type -MSBuild
  • Build File Path- Click the Tree List Icon to browse to the sln file.
  • MSBuild Version – Same as your solution.
  • Command line parameters – Passing Configuration = Release as a parameter to MSBuild with /P:Configuration=Release
  • Run OctoPack – Enable to create a package to use in Ocotpus
  • OctoPack package version – Use the build number from the team City build with the %build.number% parameter

4. Run Unit Tests

RunUnitTests-1

Key Settings

  • Runner Type -NUnit
  • Run Tests from- Path to your test project dll relative to your project root.

5. Package up the TDS .update file using NuGet

Nuget-Pack-TDS-Content-Update-Package-1

Key Settings

  • Runner Type -NuGet Pack
  • Specification Files- Use the Tree List Icon to browse to the nuspec file for the update package to create a NuGet package.
  • Version – Use the build number from the team City build with the %build.number% parameter

6.Create a release in Octopus Deploy

Octopus-Create-Release

Key Settings

  • Runner Type -Octopus Deploy: Create Release
  • Octopus Url – Url for the Octopus Server
  • API Key – Generate yours from the Octopus server follow these instructions

7. Deploy to required environment from Octopus.

  • Deploy the newly created release in Octopus.

Octopus-Deploy-Release

Key Settings

  • Runner Type -Octopus Deploy: Deploy Release
  • Octopus Url – Url for the Octopus Server
  • API Key – Use previously generated key.
  • Release number – Use Team City Parameter – %latest%
  • Deploy to – Required Environment from Octopus.

Part 2 will Cover the Octopus Deploy process, variables and the PowerShell scripts to install the update packages created here.

References