Saturday, April 27, 2013

Publishing to Azure Web Sites from any git/hg repo

Windows Azure Web Sites provide a nice selection of ways to deploy a site from source code. You can deploy from:

  • a local git repository
  • a TFS project
  • a git project on GitHub
  • a git or Mercurial project on Bitbucket
  • a git or Mercurial project on CodePlex
  • code in a Dropbox folder

One thing that all these approaches have in common is that you own the code. e.g. in the GitHub case, you must be an admin on the project. The reason is that Azure needs to set up a hook in the project to enable continuous deployment, and only project owners can do that.

 

Deploying ‘external’ repositories you don’t own

In some scenarios, it can be interesting to deploy a site based on sources that you don’t own. For example, you might want to deploy your own instance of the NuGet gallery, but you have no intention to modify the source. You’re happy with it as is, and you just want to deploy it.

To cater to this scenario, we added a new ‘External repository’ entry in the Azure portal:

image

Note: the ‘External repository’ entry is using the git icon, which is technically incorrect since it supports both git and Mercurial. We just didn’t have time to come up with a better icon for it for this initial release! We’ll probably change that later.

Once you pick that, the next page in the wizard is pretty simple: you just paste any http(s) git or Mercurial URL and you’re good to go!

image

And as soon as you Ok the dialog, a deployment from that repository gets triggered.

 

What about updates?

One important point about this mode is that it doesn’t support continuous deployment. This is because Azure cannot possibly register for change notifications on an arbitrary repo that you don’t own.

Concretely, that means that your site will not be automatically deployed when the repo is updated. Instead, you need to tell it when you want to pick up changes, by clicking the Sync button in the Deployments page:

image

While this feature may not see the same kind of usage as the full continuous deployment workflows, it has its uses and nicely completes the overall source deployment story in Azure Web Sites.

11 comments:

  1. I use a local Stash server for my git repo. How do I add authentication needed for this external repo?

    ReplyDelete
  2. This External repo workflow is only for public repos. Private repos are supported for Github/Bitbucket.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. So does that mean that a GIT repository in TFS Cloud will not work with continuous deployment for Azure Websites?

    ReplyDelete
  5. @Gabe: TFS git only supports private repos, and the workflow described here is only for public repos.

    ReplyDelete
  6. @Gabe: correct, as of today, that does not work. However, this is being worked on and will be supported later.

    ReplyDelete
  7. Is there future plan to allow private git from TFS in the cloud?

    ReplyDelete
  8. Ok thanks for the fast reply. Is there any kind of eta for that?

    ReplyDelete
  9. I don't have a clear ETA, but I'd be surprised if it's more than a couple months out.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete