1

I have set up continuous deployment from a Visual Studio Online Git repository to an Azure Web App.

What is the best way to run acceptance/smoke tests on the website after a build is triggered and deployment has completed?

I have already tried POST_DEPLOYMENT_ACTION (How to add a custom post deployment script to azure websites?), but this seems to get ignored.

I also had a look at the Kudu PostDeployment hook (https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks), which appears overly hacky.

I am deploying a standard ASP.NET 4 MVC site by the way. Any help appreciated.

Community
  • 1
  • 1
mwrichardson
  • 1,148
  • 1
  • 8
  • 12

2 Answers2

1

What is hacky about the PostDeployment hook?

An alternative to that could be to subscribe to the PostDeployment hook from the Kudu/SCM site

POST /api/hooks
{
  "url": "http://www.callback.com/callback",
  "event": "PostDeployment",
  "insecure_ssl": false (set to true to ignore https certificate check, for test purposes only)
}

That would give you a POST like below on the specified URL when deployment is done:

{
  "id": "cd5bee7181e74ea38a3522e73253f6ebb8ed72fb",
  "status": "success", (could be pending, building, deploying, failed, success)
  "author_email": "someone@somewhere.com",
  "author": "Some One",
  "message": "My fix",
  "deployer": "Some One",
  "start_time": "2013-06-06T01:24:16.5873293Z",
  "end_time": "2013-06-06T01:24:17.63342Z"
}

More info here on kudu github wiki

jakobandersen
  • 1,399
  • 7
  • 9
-1

What I ended up doing was customizing the build process to add a RunScriptTask at the end, which invokes my tests.

You can pass build parameters to the RunScriptTask like so:

"-username user@example.org -password test123 -environment " + DeploymentSettings.GetValue(Of String)("ProviderHostedDeploymentEnvironmentName")

If you edit the build definition from Visual Studio -> Team Explorer -> Builds, there is a tab on the left called Process that breaks down the build steps. If you click Show details at the top, there is an option to download the XAML build process template. You can customize this as you wish and then create a new build process template from that file. (Note that XAML build process template file must be pushed to the remote repository beforehand)

mwrichardson
  • 1,148
  • 1
  • 8
  • 12
  • I find it amusing that you find the Kudu PostDeployment hook "hacky" but the above isn't :-) – jakobandersen Jun 03 '15 at 19:51
  • In fact Microsoft have just added a new [build preview](http://azure.microsoft.com/en-us/updates/visual-studio-online-build-system-preview/) section to Visual Studio Online - you can configure the build steps using a friendly UI in much the same way as something like TeamCity. So executing a script post-deployment is even easier this way. – mwrichardson Jun 04 '15 at 10:04