Build and deployment question.

I successfully have TC up and running, building our project on check-in. I want to take the next step and auto-deploy our web site to a dev server and I'm looking for strategies on how to do that with TC.

I have written an MS Build file that will actually do the deployment. What I want to know is how I should set this up in TC. Should I create a new build configuration for this new build file, or should it be called from our main build file at the end? If it's a separate configuration, how do I go about setting it up so that it only runs after a successful build by the other configuration and so that it can use the other configuration's build results (for example, the compiled asp.net site). There's nothing to pull from source, it's just another script that takes other files and copies them over, creates a web site instance, etc.

All of this will be on one server right now, with only one build agent. Any pointers?

Thanks,
Brian

6 comments
Comment actions Permalink

You can do the following. Say you have a configuration named Build which contains artifacts for deployment. You can create another configuration Deploy which will depend on Build by artifact dependency on the last successful build. Then in the Deploy configuration you can add dependency trigger (Build triggers section) on the Build. This trigger will start Deploy upon successful build of the Build.

--
Pavel Sher

0
Comment actions Permalink

OK, thanks. I've got this up and running just great now. One question: can I link the build numbers of the deploy configuration and the build configuration?

0
Comment actions Permalink

Brian / Pavel, I'm not trying to hijack this thread but what you're describing here is of interest to me too so hopefully this won't take this off course too much.

Brian, I wonder  if you could expand a little on how you're getting access to the build artifact from one configuration in another. I ask because the artifact that we generate in our "Build and Unit Test" build configuration takes the form %system.teamcity.projectName%-%system.build.number%.zip and in my "Deployment" configuration I want to be able to reference that artifact. I can't see an easy way of doing this and this is perhaps because I'm approaching it incorrectly.

Pavel, I'd like to know too how you can get access to the last pinned build number in another configuration, which is kind of related to Brian's point about last successful build number.

Any help from either of you would be greatly appreciated, hopefully you won't think I've intruded too much.

Thanks, Dan.

0
Comment actions Permalink

Dan,

I'll try to explain what I have. It's pretty simple. For my build and test configuration I have set up a few artifact paths that copy the needed files to several directories within TeamCity. Here's a sample:

Source\AdminSite.Deployment\Debug\ => WebDeployment\AdminSite
Source\PublicSite.Deployment\Debug\ => WebDeployment\PublicSite
Source\SharedBinaries\ => SharedBinaries
Source\Dev Deployment.msbuild => MSBuild
Source\Dev Deployment.config => Configuration



That's it for the build and test configuration. It's pretty simple. Now, for my dev deployment configuration, I have a dependency on the artifacts from the first build. This will download all artifacts copied by the first configuration to the local checkout directory for the second build.

Depend on: Core Builds and Tests
Get artifacts from: Last successful build

Artifacts paths: **
Destination path: .\

When the deployment build is started (automatically after the first build) it first copies all of the artifacts from the previous build into its checkout folder. Then I have it run the Dev Deployment.msbuild file found under the MSBuild directory. That's all there is to it. The deployment configuration doesn't use any source control at all and doesn't produce any artifacts of its own. It simply uses the artifacts of the previous configuration build. Note that the artifacts copied in the first build are copied to directories internal to TeamCity. I think I read in your other post that you were copying artifacts to your c:\ drive or something. If you just let TeamCity handle that, everything is much easier. You can even schedule cleanups. I think mine keeps the past ten good builds.

So far, it's working great, but I'm pretty new to this and I'm sure there are other ways of setting things up. I'd be happy to answer other questions if you have them.

Brian

0
Comment actions Permalink

Brian,

Thanks for your response. Sorry it's taken a while to respond, email notifications seem to have stopped working for me for some reason...

Yep, I had gone a long way down a path which was the wrong path to have taken with the artifacts stuff. It was only when I re-read my old thread that I realised the error of my ways so to speak. Thankfully it is all working now and I've been able to make good progress with the MSBuild side of things in getting it to create the web site etc.

Thanks again for your response.

Regards, Dan.

0
Comment actions Permalink

Incidentally Brain did you happen to get anywhere with getting the last successful build number from another configuration?

Thanks, Dan.

0

Please sign in to leave a comment.