One Strategy for Continuous Integration with Orchard, Git, Kudu, and MS Azure Websites
This is a poor man's continuous integration solution, for those who don't want to pay for Team City.
TLDR; Fork me on GitHub
Be sure to read the readme on GitHub and/or the rest of this blog post for details. Here is a link to the GitHub repo:
https://github.com/bigfont/orchard-continuous-integration-demo
Prerequisites
- Clone the Orchard source.
- Keep your company's Orchard work in a Git repository.
-
Exclude all build results from the repo using
.gitignore
- Setup continuous deployment from Git to a MS Azure Website.
Lightweight Continuous Integration with Kudu
You can now setup continuous integration using Kudu. Official Kudu documentation explains this; in particular, Deployment Hooks let us generate and customize a deployment script.
Here is a high level view of the steps to setting up CI with Kudu. We're running all scripts from PowerShell with Posh-Git.
Install the Azure command line interface
npm install azure-cli -g
Create an out-of-the-box azure deployment script
azure site deploymentscript --aspWAP Orchard.proj -s src\Orchard.sln
There will now be a
.deployment
file in your root folder. That file points to a more involved
deploy.cmd
file. You must edit the
deploy.cmd
file so that Kudu uses Orchard's
build Precompiled
targets and build results. Doing so is easier said than done! I suggest using
this file
as an example.
Once you're done
If you FTP into the
/site
directory, you will see the following:
deployments (deployment logs and statuses - very useful) diagnostics locks repository (the last checkout of the appropriate repo) wwwroot (the result of the kudu deploy.cmd; in this case, the build/precompiled)
Gotchas and tips
-
If your build takes a long time, lengthen the
SCM_COMMAND_IDLE_TIMEOUT
in the Azure Website App Settings. -
When testing locally, be sure to install and to update nuget on the command line, e.g.
nuget update -self
- The integration build can take a looooong time (the above is about 20 minutes), even when changes are minor (e.g. if we change the readme file). Try to reduce this over time.
Validation from the community
This is pretty cool: poor man's CI for
#OrchardCMS
on Azure
http://t.co/4GRtvqZTqR
hi5
@dicshaunary
— Bertrand Le Roy (@bleroy)
November 25, 2014