Access Revision / Build History From Another Build Configuration?

Hi,

We have a project in TeamCity (currently using v3.1) with the following build configurations:

Branch - Build & Unit Test (Triggered on VCS commit)
Branch - Deploy To System Test (Triggered Manually)
Branch - Deploy To UAT (Triggered Manually)
Trunk - Deploy To System Test (Triggered Manually)
Trunk - Deploy To UAT (Triggered Manually)
Trunk - Deploy To Live (Triggered Manually)

I have two questions

1. Is there anyway to be able to access the build history from the "Branch - Build & Unit Test" configuration? I'd like to be able to do this so that we can deploy specific build revisions to our testing environment. Having just looked in to this a little I can see that dependencies may be the way forward, perhaps using the last pinned build which leads me to the second part of my question though:

2. We've set the above up as a starting point, can anyone offer any advice on whether we're making problems for ourselves using this approach and as such suggest a different approach.

Any advice would be greatly received.

Cheers, Dan.

10 comments
Comment actions Permalink

Dan,

Your approach is fine. You can pin the build to deploy and configure the deployment to get last pinned build via artifact dependencies.
Upcoming TeamCity 4.0 has a "Run Custom Build" feature with which you can pass additional parameters to the build triggered manually - e.g. the build number to deploy.

--
Best regards,

Yegor Yarko
Project Manager (TeamCity)
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks for your help Yegor.

0
Comment actions Permalink

Hey,

So we've made good progress now getting one build to create an artifact that we want to use in another build configuration through pinned builds.

I've got a question that will help us with the next step.

Our Build and Unit Test configuration now creates a zip artifact and outputs it to a known folder using a naming convention based on system properties so that it ends in the form: "C:\TeamCityBuilds\BuildOutputs\SevenDigital.Web.Com\%system.teamcity.projectName%-%system.build.number%.zip".

I'd like to be able to use attributes from the pinned build configuration in another build configuration so that I can get that artifact, is this possible and if so can anyone let me know how. If it isn't possible can you suggest an alternative approach? This seems as though it is something that most people would want to be able to do and having looked through the documentation I'm struggling to see how.

On another (but slightly related point), are there any really good resources for how to set up build projects / configurations? It would be great if the demo build site at http://teamcity.jetbrains.com/overview.html could be set up so that the guest user could inspect the build configurations but not alter them, something that would appear to be possible using the roles based permission scheme.

Thanks, Dan.

0
Comment actions Permalink

I wonder why do you use custom path for artifacts (I mean C:\TeamCityBuilds\BuildOutputs\SevenDigital.Web.Com)? Why not publish artifact to the TeamCity itself?

--
Pavel Sher

0
Comment actions Permalink

I'm not sure I understand what you mean Pavel, could you give an example please?

0
Comment actions Permalink

Well, if I understood you right you are using some directory for storing artifacts produced by builds. So your build copies artifacts to this directory itself. Am I right?

--
Pavel Sher

0
Comment actions Permalink

I mean that you can ask TeamCity to publish files produced by builds to its internal storage (on the server). Usually there is no need to use custom place for artifacts. Then in Artifact dependencies you can use wildcards to download these artifacts to another build.

--
Pavel Sher

0
Comment actions Permalink

That is correct. There is a step in the build file that creates a zip file of all the assets for the web site that we are building as part of the configuration.

I can provide a copy of the build file if that would help.

I'm still a little unclear about what we're doing here that is unconventional, to me it seems utterly reasonable that you would want a build configuration (in our case "Build, Unit Test and Package") that other configurations then access the artifacts of. In this instance we're wanting to be able to provide a mechanism so that our Tester can pin a build number and then use the artifact from that build to deploy to the test environment.

Let me know if you need further information from me, it would be really good to get this sorted, if you or anyone else can provide some insight it would be really appreciated.

Thanks, Dan.

0
Comment actions Permalink

Hello Dan,

  The typical setup for your task could be as follows:

  - your build produces an artifact, say, dist/folder/distribution.zip
  - in the build configuration settings, for artifacts path, you specify dist/folder/distribution.zip
    As a result,  distribution.zip will be published to internal TeamCity repository and will be accessible via TeamCity UI
  - Your tester downloads artifact from TeamCity UI and pins the build, if appropriate

  - for another build configuration, you add an artifact dependency (see Dependencies section in the right - column navigation
    in administration area). You specify that you want artifact named distribution.zip (without path, because this file is published to
    the root directory of the first build configuration). You also specify target folder and that only pinned builds can be used as
    artifact sources.

  - To verify Dependency settings, you can use "Check artifact dependencies" button at the bottom of the page.

  The point is, TeamCity cannot provide a way to send artifact of one build to another if you use absolute paths as target
  artifact directory. So you should use internal TeamCity storage for your build artifacts.

  You may also take a look at our docs: http://www.jetbrains.net/confluence/display/TCD4/Build+Artifact

  Hope, this helps

  KIR

0
Comment actions Permalink

OK Kirill,

I think I follow what Pravel and yourself were suggesting a little more now. I've updated my build script (MSBuild) so that it creates the zip file containing the web site build in the working directory by using a hard coded file name distribution.zip and I've also updated my "Build and Unit Test" build configuration so that it registers the artifact using distribution.zip. All working fine, I think the point that I was missing before was that the artifacts are registered in TeamCity itself and therefore I didn't need to worry about them being overwritten.

Thanks to both you and Pravel for your help. (You possibly haven't heard the last from me... ;-))

Dan

0

Please sign in to leave a comment.