3

We have a new project in which we are trying to make use of the built in continuous integration in Kentico for tracking changes to templates, page types, transformations etc.

We have managed to get this working locally between two instances of a Kentico database, making changes in one, syncing the changes through CI and then restoring them up to the second database using the Continuous integration application that sits in the bin folder in the Kentico site.

The issue we are having is when it comes to deploying our changes to our dev and live environments.

Our sites are hosted as Azure App services and we deploy to them using VSTS (Azure DevOps) build and release workflows however, as these tasks run in an agent, any powershell script we try to run to trigger the CI application fails because it is not running in the site / server context.

My question is, has anyone managed to successfully run Kentico CI in the context of an Azure app service? Alternatively, how can I trigger a powershell script on the site following a deployment?

jezzipin
  • 4,110
  • 14
  • 50
  • 94

3 Answers3

0

We do, but no CI. VSTS + GIT. We store virtual objects in the file system and using git for version control. We have our own custom library that does import export of the Kentico objects (the ones are not controlled by Git).Essentially we have a json file "publishing manifest" where we specify what objects need to be exported (i.e. moved between environments).

There is a step from Microsoft 'Powershell on Target Machines', you guess you can look into that.

P.S. Take a look also at Three Ways to Manage Data in Kentico Using PowerShell

0

Deploy your CI files to the Azure App Service, and then use a Azure Job to run "ContinuousIntegration.exe"

If you place a file called KenticoCI.bat in the directory \App_Data\jobs\triggered\ContinuousIntegration - this will automatically create a web job that you can can trigger:

KenticoCI.bat

cd D:\home\site\wwwroot
ren App_Offline.bak App_Offline.htm
rem # run Kentico CI Integraton
cd D:\home\site\wwwroot\bin
ContinuousIntegration.exe  -r

rem # Removes the 'App_Offline.htm' file to bring the site back online cd D:\home\site\wwwroot ren App_Offline.htm App_Offline.bak

Andrew Coats
  • 2,627
  • 1
  • 15
  • 5
0

Yes, I've got this running in Azure DevOps within the release pipeline itself. It's something that we're currently rolling out as a business where I work.

The key steps to getting this working for me were as follows:

  1. I don't want to deploy the ContinuousIntegration.exe or the repository folders, so I need to create a second artefact set from source control (this is only possible at the moment with Azure Repos and GitHub to my knowledge).
  2. Unzip your deployment package and copy the CMS folder to a working directory, this is where you're going to run CI. I did this because I need the built assemblies available.
  3. From the repo artefact in step 1, copy the ContinuousIntegration.exe and CI repository folders into the correct place in your unzipped working folder.
  4. Ensure that the connection string actually works for the DB in your unzipped folder, if necessary, you may want to change your VS build options in regards to how the web.config is handled.
  5. From here, you should be able to run CI in the new working folder against your target database.

In my instance, as I don't have CI running on the target site it means that everything is restored every time.

I'm in to process of writing this up in more detail, so I'll share here when I've done that.

Edit: - I finally wrote this up in more detail: https://www.ridgeway.com/blog/web-development/using-kentico-12-mvc-with-azure-devops

mnield
  • 1,859
  • 1
  • 20
  • 34