Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

One Strategy for Continuous Integration with Orchard, Git, Kudu, and MS Azure Websites

Tags: orchard, git, github, continuous-integration, azure, 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

  1. Clone the Orchard source.
  2. Keep your company's Orchard work in a Git repository.
  3. Exclude all build results from the repo using .gitignore
  4. 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