This post was used for my workshop at the company. However, it might be an initiative of your own approach for the automating Sitecore deployments with TeamCity. (Note: the summary is here)
- Applying build and integration of Sitecore Helix
- Using XML Transforms to support multiple build configurations
- Using Unicorn – a Sitecore utility designed to simplify deployment of Sitecore items across environments automatically
- Dedicating to my simple development framework version 2.1
Setup Prerequisites
- Sitecore 9.0 Update 1
- TeamCity
- Gulp build runner to run gulp scripts
- TeamCity_VhLocal.zip: my TeamCity project is used for the workshop
- Node.js
How to set it up
- setup 03 new Sitecore 9.0 Update 1 instances:
- 01 sitecore instance whose host name should be viethoang.cm.local
- 01 sitecore instance whose host name should be viethoang.cd1.local
- bind another host name tekcent.local
- 01 sitecore instance whose host name should be viethoang.cd2.local
- bind another host name demo.local
- copy-paste \App_Config\ConnectionStrings.config of cm to overwrite the one of cd1 & cd2 to ensure 03 Sitecore instances using the same databases
- install Node.js
- install TeamCity
- create a new TeamCity project Viet Hoang – Simple Development Framework
- Administration -> Projects -> Create project (project type: Manually)
- create a new TeamCity build configuration CA – CD1 – CD2
- Administration -> Projects -> Viet Hoang – Simple Development Framework -> Create build configuration
- create a new Version Control Settings Vhs_Release
- Administration -> Projects -> Viet Hoang – Simple Development Framework -> CA – CD1 – CD2
- left navigation: select Version Control Settings -> Attach VCS root
- fulfill the fields below:
- Type of VCS: Git
- VCS root name: Vhs_Release
- Fetch URL: https://gitlab.com/viet.hoang/my-simple-framework.git
- Default branch: refs/heads/%vhs.gitBranch%
- Authentication method: Anonymous
- click Test connection to ensure Connection successful!
- click Save
- create Build Steps
- Administration -> Projects -> Viet Hoang – Simple Development Framework -> CA – CD1 – CD2
- left navigation: select Build Steps -> Add build step
- add build step Create gulp-config.js file local
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Create gulp-config.js file local
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Create VietHoang.Sc.DevSettings.config
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Create VietHoang.Sc.DevSettings.config
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Create publishsettings.targets
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Create publishsettings.targets
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Deploy All Serialization Folders To Sitecore Server
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Deploy All Serialization Folders To Sitecore Server
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Create GlobalAssemblyInfo.cs file
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Create GlobalAssemblyInfo.cs file
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- install Gulp build runner to run gulp scripts
- Upload Gulp build runner to TeamCity
- Administration -> Plugins List -> Upload plugin zip
- note: if the link above does not work, select latest successful build here https://teamcity.jetbrains.com/viewType.html?buildTypeId=bt434
- make sure downloaded
.zip
file is not corrupted - put the downloaded plugin
.zip
file into<TeamCity Data Directory>/plugins
folder (normally it’s C:\ProgramData\JetBrains\TeamCity\plugins)
- make sure downloaded
- restart TeamCity Server via Window Services
- Upload Gulp build runner to TeamCity
- repeat #8 to add build step Restore Node modules
- fulfill the fields below:
- Runner type: Node.js NPM
- Step name: Restore Node modules
- npm commands: install
- click Save
- fulfill the fields below:
- repeat #8 to add build step Build Test Projects
- fulfill the fields below:
- Runner type: Gulp
- Step name: Build Test Projects
- Gulp File: gulpfileForTest.js
- click Save
- fulfill the fields below:
- repeat #8 to add build step Get Test Results
- fulfill the fields below:
- Runner type: Visual Studio Tests
- Step name: Get Test Results
- Test engine type: MSTest
- Test engine version: MSTest 2017
- Test file names: **/bin/%vhs.configuration%/*.Tests.dll
- click Save
- fulfill the fields below:
- repeat #8 to add build step Build and publish the solution to CA
- fulfill the fields below:
- Runner type: Gulp
- Step name: Build and publish the solution to CA
- Gulp File: gulpfile.js
- click Save
- fulfill the fields below:
- repeat #8 to add build step Update gulp-config.js and VietHoang.Sc.DevSettings.config for CD1
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Update gulp-config.js and VietHoang.Sc.DevSettings.config for CD1
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Build and publish the solution to CD1
- fulfill the fields below:
- Runner type: Gulp
- Step name: Build and publish the solution to CD1
- Gulp File: gulpfile.js
- click Save
- fulfill the fields below:
- repeat #8 to add build step Update gulp-config.js and VietHoang.Sc.DevSettings.config for CD2
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Update gulp-config.js and VietHoang.Sc.DevSettings.config for CD2
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Build and publish the solution to CD2
- fulfill the fields below:
- Runner type: Gulp
- Step name: Build and publish the solution to CD2
- Gulp File: gulpfile.js
- click Save
- fulfill the fields below:
- repeat #8 to add build step Sites Warm-up
- fulfill the fields below:
- Runner type: PowerShell
- Step name: Sites Warm-up
- Script: Source code
- Script source: copy/paste this one
- Script execution mode: Execute .ps1 from external file
- click Save
- fulfill the fields below:
- repeat #8 to add build step Sync Unicorn
- fulfill the fields below:
- Runner type: Gulp
- Step name: Sync Unicorn
- Gulp File: gulpFileForUnicorn.js
- click Save
- fulfill the fields below:
- finally we’ve just done for all the build steps
What’s next?
We will fulfill the value of all the configuration parameters so that the automating deployment will be able to run successfully in Part 2.
2 thoughts on “Workshop – Playing Sitecore 9 auto-deploy with TeamCity on your machine (Part 1)”