May 10, 2017 | Kliment Klimentov
Our simple scenario includes 2 developers, using TDS Classic and checking-in changes to source control. The Jenkins build server takes the changes and perform the build, then deploy the created package to two Sitecore environments. The QA environment will apply the changes automatically and the Production environment will wait for manual installation of the package.
Add Items from a local Sitecore instance
First, connect TDS Classic to a Sitecore instance and get the needed items. In this scenario, I'll connect to a local Sitecore instance in my Debug build configuration and add a few items to the project.
Create a new build configuration and configure it to create a packages
1. Create a new Build Configuration
After the initial items are in our project, we need to create a new build configuration, which will be used by Jenkins to build the files and items and create .update package. I'll name the Build configuration "Create Package"
2. Configure TDS Classic to create packages
In this example setup, we will use .update packages to apply changes in the Sitecore instances. To create .update packages during build, the following settings need to be set for the CreatePackage Build configuration:
For the CreatePackage configuration leave the Sitecore web URL and the Sitecore Deploy Folder settings in the Build tab blank. This will prevent TDS Classic from deploying the items and it will only generate a package.
On the Update package tab check the Generate package during build checkbox. Leave the assembly path empty and add the Sitecore assembly files as NuGet Packages. Here's how to do that.
3. Add NuGet packages
To successfully build the TDS Classic projects on the Jenkins build server we need to have TDS Classic installed on the server, or to install the HedgehogDevelopmentTDS NuGet package to our Solution. The TDS Classic build components can be installed to the projects by right-clicking the Solution in Visual Studio -> Manage NuGet Packages for Solution. For more on how to do this, check our our blog post on the subject.
1. Connect to source control
To be able to get and build the items and files, Jenkins build server needs to be connected to the source control repository. This can be configured in Jenkins -> <Project> -> Configure -> Source control management
2. NuGet Restore step
To be able to build successfully in the Jenkins Build server, you have to Restore all NuGet Packages. The first build step will execute a Windows batch command and will restore all NuGet packages in the packages directory of the solution. The command is:
<path to nuget.exe> restore <path to solution file on the build server>
The nuget.exe can be downloaded from the official NuGet website.
3. MS Build step
The second build step will build the solution using the "Create Package" configuration. To do this, you have to create another build step which builds a Visual Studio project or solution using MS build. In this step you need to specify the MSBuild version, the name of the Solution file and the command line arguments. Our arguments will make MS build to use the "Create Package" configuration:
4. Deployment step
The deployment can be handled by a copy-paste script, which will copy the generated .update package to a network share.
In our QA instance the packages will be installed automatically, using the Sitecore Package Deployer.
In the Production instance, install the .update packages manually to prevent the installation of a broken package
To build successfully, TDS Classic needs to be licensed on the Jenkins build server. Since TDS Classic is not installed on the server, you need to add your license info as environment variables. The license key must be added as two environment variables with TDS Classic license info as values:
TDS_Owner: <company name>
TDS_Key: <TDS license key written in this pattern: aaaa-bbb-ccc-dddd>