In one of recent project that I’ve encountered most of the team members raise the concern about having a such long production deployment time, which could span the entire normal working hours and even more if they encountered some issues.
One of the thing that I noticed can be optimized immediately is the TDS package installation process, where instead of installing the full TDS packages which can contains thousands of items (in my case it was more than 12,000 items) we can instead use the option of only deploying the delta items – which for every release cycle (2 weeks) normally amount to around 50 items or even less.
The TDS Git Delta Deploy itself is something that Sitecore MVP Sean Holmesby created to answer how to have a true “delta” of content items to be deployed to the target environment. Have a read of the full article here.
So, I know the solution of one the paint point area then I just need to install Sean’s nuget package and go on my merry way right? well.. not exactly.
In the current solution the team have multiple TDS projects per features (Helix anyone?), those TDS projects would then be bundled using TDS package bundling to create the final combined package.
To give a little bit of illustration, see below:
Given the following TDS projects
- TDS Foundation Z
- TDS Feature A
- TDS Feature B
- TDS Feature C
- TDS Project X (will bundle all content items from the above TDS projects)
So what’s the problem? the package bundling doesn’t respect the TDS Git Delta Deploy it will always include all the items instead of just the delta.
I reached out to the nice folks in the #tds slack channel in https://sitecorechat.slack.com/ for suggestions – btw if you haven’t joined then I suggest you do that first else you’re missing out 🙂
Not long after I raised the question, John Rappel replied that he has a fix for that in the latest nuget package – awesome!. I upgraded the nuget package and true enough that it now works. Read more about John’s bugfixes and feature updates here.
So now I got TDS delta packages working locally, it’s now time to integrate it in our Continuous Build process.
The setup in Team City
TDS Git Delta Deploy work by using “git diff” command in it’s core, which for this to work correctly you would need to ensure that:
- TC is configured to use the agent side checkout
- TC is doing a full “git fetch” instead of just retrieving a single branch
- If you’re using TC version 10.0.4 and above you’re in luck as apparently you can set it using the following approach
- If you’re using TC version prior 10.0.4 then your other option to have this is to do a custom build step that perform a git fetch
A quick POC confirm that the approach is solid and I see those delta packages being generated!
TDS Delta packages generated.. what now?
With the TDS delta packages generated and ready to use, all we have to do now is to include it as part of our Continuous Deployment process. We’re using Octopus Deploy so it’s quite easy to setup.
You can use something like Sitecore Package Deployer to automate the package installation process and include it as part of Octopus deploy step. In our case, since we already have an existing custom web service that does the same job so we leverage that instead.
Enable TDS “publish package after deploy” to streamline the deployment process by automatically publishing only the deployed items
here’s the reference on how to do just that https://hedgehogdevelopment.github.io/tds/chapter4.html
What’s the outcome?
Having all this in place really helped streamlined the way we do a Sitecore deployment and cut massive time which in turns faster deployment => more time to work on something else => productivity++