Jenkins Deployment – Automating ASP.NET Applications

asp.netdeploymentJenkins

Is there any possibility to automate/semi-automate deployments of ASP.NET web applications using Jenkins. It can be under controlled or uncontrolled environments, for uncontrolled user needs to enter userid and password. I am looking out for ways to copy the files from target to destination and run sql scripts in web farm scenario.

Edit
Currently we are using bat files to xcopy/configure app pool/sql cmd, etc to deploy the application. But for this to work, production support team needs to download the source code, build the project and run the bat files to deploy the application.

Now, we want to automate the deployment without user downloading the source code and end user just needs to visit a url and fill userid and password parameters and select svn tag and it should get deployed. But Jenkins is running under anonymous login, so the existing bat file will not work since it doesn't have permissions to run the script.

So, I would like to know if there exists any alternatives for this kind of situation. It will be good if user context is impersonated by using entered userid and password allowing existing batch file to run without further changes. If it is not possible, we would like to explore other ideas too but we don't have flexibility to choose a automated tool like puppet, etc, we should stick around with these batch files.

Best Answer

I'll share what we've been using, and where we're planning on going, maybe it'll help give you a better idea.

  • We currently use Jenkins and Github together-- once something is merged into master, Github tells Jenkins and it kicks off a build.
  • We use a Nant script on Jenkins to build the project, run unit tests, and if everything looks good, it kicks off another Jenkins project. The Nant script also spits out a directory with fully compiled code/minimized CSS/JS, etc.
  • The secondary Jenkins project takes the output from the build, and sends it back up to Github, on a separate repository.
  • A .BAT file runs every 5 minutes on the staging web server, and it basically checks for updates to that repository. If an update is found, we download the latest build, backup our staging files, then deploy the newest build over to staging folder.
  • To go live, we have a .BAT file that handles backing up the live files, and copying the repository files over the live files. It's run manually. It doesn't handle SQL updates (we do those by hand).

Now, obviously this isn't totally ideal but it's working for us. We want to expand this in the future to:

  • Use Web Deploy to push the files from Jenkins straight to IIS, and do any other commands we need to run.
  • Use automatic migrations (a feature of Entity Framework) to handle all SQL updates, as part of the go live.
Related Topic