Teamcity 6.5, easier way to use templates from a different project?

Hi,

We are attempting to use the template feature in 6.5, and our workflow is as follows:

We have a base-project that contains a bunch of template configurations. (Maven, CMake, Ant, Debian) that contains the generic rules for building a certain type of project. We then copy this base project to the actual project name, and choose 'Re-use templates from the original project'. This does the right thing, but from the created project, there is no easy way to create a new configuration based of the template. Instead we have to create a dummy configuration, then choose 'associate from template'.

My question is, am I trying to cheat teamcity to do something it wasn't intended to do, as the (manual) workflow seems a bit awkward? I can live with the manual workflow being a bit icky, as we are planning on doing this automatically from a TC plugin. (to automatically create projects for each git-repository)

Also, is there any ETA when the REST API will support creating projects etc? It would be much easier to use that instead of writing our own plugin.

Thanks in advance
/Johan


8 comments
Comment actions Permalink

Administration > Your Project > Your Template > Create Build Configuration From Template (shown on the right side below the numbers)

0
Comment actions Permalink

Hi,

This is only possible if i *copy* the templates, not if I choose to reference the ones from the parent project. If I choose to reference from the copied-project, no templates are visible in the project view.

/Johan

0
Comment actions Permalink

Hmm you're right.

I guess the assumed use case was for each project to contain its templates, rather than pulling them a template container project.

Another approach would be go to to the parent project, make a build config from a template, then moving it.
Just as clunky, but it might work out better.

0
Comment actions Permalink

Calvin,

Your suggestions are absolutely right.

Johan,

We also have an issue to allow creating build configurations from template on Project's page: TW-15680.

> Also, is there any ETA when the REST API will support creating projects  etc? It would be much easier to use that instead of writing our own  plugin.

Sorry we did not manage to address it in 6.5 release (while I had hopes on this). There will be some movement in the issue when we start with the task.

As to your original use case, this might be related:
TW-7869 Automatically create build configurations for every new git branch
TW-16052 Feature branch support for DVCS

0
Comment actions Permalink

Thanks for the suggestions.

Yegor, is the 6.5 release pretty much closed? Are there any changes from the latest EAP?


TW-7869 Automatically create build configurations for every new git branch
TW-16052 Feature branch support for DVCS

Are things we probably will want to do, but that's just bonuses, being able to create projects automatically is crucial for us.

We have ~200 projects (in seperate git repositories) that we want to be able to build and show under TC. Importing these to TC manually would be a really mundane and error prone task, so we are hoping to do it automatically.

Another related question; to be able to support my generic templates, I am using a VCS root with variables to create a common VCS root.
I made my VCS root url something like this:
Fetch URL: ssh://git.company.net/%PROJECT_NAME%.


Is there any problems with above? Sometimes I get an error on the projects page (Don't have the exact error message here, will see if I can reproduce it tomorrow) from our gitosis backend "Arguments to command look dangerous". I assume this means TC attempted to pull without replacing the %PROJECT_NAME%, but will have to verify that. Builds etc works fine even with this error though...

0
Comment actions Permalink

Johan,

> is the 6.5 release pretty much closed?

Yes. We are going to release it in several weeks.

> Are there any changes from the latest EAP?

Yes, but mostly in terms of polishing and stabilizing.

We will probably release one more EAP/RC early next week and I would deeply recommend playgin with it and trying different scenarios so that we can address issues if they uncover.

> I assume this means TC attempted to pull without replacing the %PROJECT_NAME%, but will have to verify that

I would appreciate if you can get details on this. Probably teamcity-server.log + teamcity-vcs.log covering the erorr appearing moment.


As to automating projects creation - for now you can generate xmls on disk under .BuildServer/config/<project name>
ANother approach would be to implement the missing support inside the REST API open-source plugin and contribute it back to us :)

0
Comment actions Permalink

Hi,


Creating those XML files seems to be easiest approach for now. Thank you so much for really great support, I look forward to work with you guys more :)
I wasn't able to trigger the error again, but the teamcity-vcs.log contains the following info:

.......

[2011-05-03 11:20:04,751]   WARN [cutor 5 {id=10}] -      jetbrains.buildServer.VCS - Error while loading current vcs revision for root 'ssh://git.company.net/# {instance id=10, parent id=1}', id=10: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:20:04,755]   WARN [cutor 5 {id=10}] -      jetbrains.buildServer.VCS - Error while loading changes for root ssh://git.company.net/# {instance id=10, parent id=1}, cause: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:21:09,674]   WARN [cutor 1 {id=10}] -      jetbrains.buildServer.VCS - Error while loading current vcs revision for root 'ssh://git.company.net/# {instance id=10, parent id=1}', id=10: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:21:09,676]   WARN [cutor 1 {id=10}] -      jetbrains.buildServer.VCS - Error while loading changes for root ssh://git.company.net/# {instance id=10, parent id=1}, cause: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:22:14,687]   WARN [cutor 4 {id=10}] -      jetbrains.buildServer.VCS - Error while loading current vcs revision for root 'ssh://git.company.net/# {instance id=10, parent id=1}', id=10: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:22:14,690]   WARN [cutor 4 {id=10}] -      jetbrains.buildServer.VCS - Error while loading changes for root ssh://git.company.net/# {instance id=10, parent id=1}, cause: 'git fetch' command failed.
stderr: ssh://git@git.company.net/: ERROR:gitosis.serve.main:Arguments to command look dangerous
[2011-05-03 11:22:29,113]   INFO [cutor 1 {id=12}] -      jetbrains.buildServer.VCS - Finish collecting changes from root ssh://git.company.net/client.git#testing-desktop {instance id=11, parent id=1}, version f9790432c5bca2c225e7befd9f78a712f83f4ce3@12fb589ddd0to root ssh://git.sp
otify.net/client.git#master {instance id=12, parent id=1}, version 0012966469d0befc837a14509f81ed88dfa4e1ad@12fb597d020; 88 changes collected 1 changes reported, time spent: 6s,272ms



attempting from terminal without a repository name,
Johan-Bjorks-MacBook-Pro-2:~ phb$ git clone ssh://git@git.company.net/
Cloning into git@git.company.net...
ERROR:gitosis.serve.main:Arguments to command look dangerous
fatal: The remote end hung up unexpectedly


I have since modified my VCS root to be
ssh://git.copmany.net/%PROJECT_NAME%.git instead, which should cause a different failbehaviour if %PROJECT_NAME% is unspecified.

Thanks
/Johan
0
Comment actions Permalink

We just upgrade to 6.5.3 and this really is a problem.  I have 200 configurations in different projects
that would share templates that are company wide.  It would be nice for a user to assosiate a build configuration with a template from the create build configuration page. It is weird I have to get project admin rights to all developers because they have to go into the edit template settings just to assossiate a build configuration with a template.

0

Please sign in to leave a comment.