You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by San Martino <sa...@gmail.com> on 2011/04/06 00:08:47 UTC

Build project in pre-commit

Hello everyone,

we absolutely need to validate a project in the pre-commit trigger
with a build of the whole project being committed.

Is this possible? Are there any tools allowing this?

Thanks you very much.

RE: Build project in pre-commit

Posted by Bob Archer <Bo...@amsi.com>.
> > Thanks for your answer. Our commits to /trunk are supposed to be
> > done rarely.
> > Basically we want to exclude source code of projects that for
> some
> > reasons cannot be built centrally (on the server where the
> > repository
> > is).
> > A project consists of java files in a directory and an ant
> script.
> > Unfortunately I have not found any well-known software to help
> with
> > this kind of buildings.
> 
> Team City supports pre-tested commits. from their web site:
> 
> "With TeamCity you can build, check and run automated tests on the
> server even before committing your changes - keeping your code base
> clean at all times. Optionally, you can set up TeamCity to
> automatically commit changes to your version control each time they
> pass all checks."
> 

Another option would be to do all your development on a branch. Have you build scripts build from that branch. IF the build is successful perform a merge to trunk. If the build fails, don't do the merge. Since branch is never checked into there shouldn't be merge conflicts. (well, tree conflicts would still be possible.)

BOb


RE: Build project in pre-commit

Posted by Bob Archer <Bo...@amsi.com>.
> Thanks for your answer. Our commits to /trunk are supposed to be
> done rarely.
> Basically we want to exclude source code of projects that for some
> reasons cannot be built centrally (on the server where the
> repository
> is).
> A project consists of java files in a directory and an ant script.
> Unfortunately I have not found any well-known software to help with
> this kind of buildings.

Team City supports pre-tested commits. from their web site:

"With TeamCity you can build, check and run automated tests on the server even before committing your changes - keeping your code base clean at all times. Optionally, you can set up TeamCity to automatically commit changes to your version control each time they pass all checks."

BOb


Re: Build project in pre-commit

Posted by San Martino <sa...@gmail.com>.
Thanks for your answer. Our commits to /trunk are supposed to be done rarely.
Basically we want to exclude source code of projects that for some
reasons cannot be built centrally (on the server where the repository
is).
A project consists of java files in a directory and an ant script.
Unfortunately I have not found any well-known software to help with
this kind of buildings.

2011/4/6 Ryan Schmidt <su...@ryandesign.com>:
> On Apr 5, 2011, at 17:08, San Martino wrote:
>
>> we absolutely need to validate a project in the pre-commit trigger
>> with a build of the whole project being committed.
>>
>> Is this possible? Are there any tools allowing this?
>
> Yes, you could write a script to do this. There might be existing scripts to do this.
>
> However, if your project takes more than a few seconds to compile, this will likely annoy committers.
>
>
>

RE: Build project in pre-commit

Posted by Thomas Loy <Th...@cbeyond.net>.
No, if your project takes more than a few seconds to compile, it WILL annoy committers.  I have a pre-commit that validates a Change Request Number in their comment against a database.  It is a quick query, but it takes about 15 seconds to do the connect, query, and then disconnect.  My committers are annoyed by that short a time.

Cheers,

Tom


-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2011a@ryandesign.com] 
Sent: Tuesday, April 05, 2011 6:37 PM
To: San Martino
Cc: users@subversion.apache.org
Subject: Re: Build project in pre-commit

On Apr 5, 2011, at 17:08, San Martino wrote:

> we absolutely need to validate a project in the pre-commit trigger 
> with a build of the whole project being committed.
> 
> Is this possible? Are there any tools allowing this?

Yes, you could write a script to do this. There might be existing scripts to do this.

However, if your project takes more than a few seconds to compile, this will likely annoy committers.



Re: Build project in pre-commit

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 5, 2011, at 17:08, San Martino wrote:

> we absolutely need to validate a project in the pre-commit trigger
> with a build of the whole project being committed.
> 
> Is this possible? Are there any tools allowing this?

Yes, you could write a script to do this. There might be existing scripts to do this.

However, if your project takes more than a few seconds to compile, this will likely annoy committers.



Re: Build project in pre-commit

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Johan Corveleyn wrote on Wed, Apr 06, 2011 at 15:29:05 +0200:
> OTOH, the same problem would probably come up if you'd try to do this
> in a pre-commit hook (unless someone decides to synchronize those
> pre-commit-hook-builds, but wow, then it would be even more blocking
> :)).

True.  As to synchronizing them, one could ensure that no other commit
has snuck in behind his back if one required every commit to append
a line to a well-known file.

I should warn, though: by now I'm talking more as a mathematician
("What's possible") than as an admin ("What's recommended").

Re: Build project in pre-commit

Posted by Johan Corveleyn <jc...@gmail.com>.
On Wed, Apr 6, 2011 at 2:53 PM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Johan Corveleyn wrote on Wed, Apr 06, 2011 at 13:57:43 +0200:
>> Another suggestion: we use IntelliJ IDEA (Java IDE) and TeamCity
>> (continuous build system). With this setup, there is a Teamcity
>> feature (which we can use from within the IDE) called "Pre-tested
>> commit". It allows you to perform a "remote build" on TeamCity with
>> your local changes integrated. If the build is successful, you can let
>> those changes be committed automatically (optionally, you can let it
>> ask you for confirmation first).
>
> The procedure you just described embeds a race condition.  (someone
> else's commit getting started after you started your remote building and
> finishing before you commit)  What does TeamCity about it?

Hm, you're right. That must be the reason why I never used it ;-).

But you're right, just after I sent my mail I was thinking the same
(what would happen if someone else did a "pre-tested commit" (or just
a regular commit) at around the same time as my "remote build" is
running?). I guess TeamCity would just start my "remote build" with
the latest sources it has (checked out from version control (which
should be updated after every commit) at the time.

OTOH, the same problem would probably come up if you'd try to do this
in a pre-commit hook (unless someone decides to synchronize those
pre-commit-hook-builds, but wow, then it would be even more blocking
:)). And the same problem is also there if you ask your developers to
perform a private local build and set of unit tests before they
commit.

If I were to use this feature in my organisation, I guess I would
handle this pragmatically: there should still be an automatic
build+tests running on TeamCity (or whatever continuous build system)
running builds after every commit. This can catch any problems with
concurrent-commits after the fact ...

Cheers,
-- 
Johan

Re: Build project in pre-commit

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Johan Corveleyn wrote on Wed, Apr 06, 2011 at 13:57:43 +0200:
> Another suggestion: we use IntelliJ IDEA (Java IDE) and TeamCity
> (continuous build system). With this setup, there is a Teamcity
> feature (which we can use from within the IDE) called "Pre-tested
> commit". It allows you to perform a "remote build" on TeamCity with
> your local changes integrated. If the build is successful, you can let
> those changes be committed automatically (optionally, you can let it
> ask you for confirmation first).

The procedure you just described embeds a race condition.  (someone
else's commit getting started after you started your remote building and
finishing before you commit)  What does TeamCity about it?

Re: Build project in pre-commit

Posted by Johan Corveleyn <jc...@gmail.com>.
On Wed, Apr 6, 2011 at 1:05 AM, David Weintraub <qa...@gmail.com> wrote:
> On Tue, Apr 5, 2011 at 6:08 PM, San Martino <sa...@gmail.com> wrote:
>> we absolutely need to validate a project in the pre-commit trigger
>> with a build of the whole project being committed.
>>
>> Is this possible? Are there any tools allowing this?
>
> You can't really do it with a pre-commit script since the changes
> aren't part of the repository. (well, you can but it's a lot of work).
>
> The big problem is that your developers are sitting there twiddling
> their thumbs staring at a blank screen and unable to do any work while
> your application builds. Even a fast build takes a couple of minutes
> to complete.
>
> Your developers will hate Subversion, hate you, and hate their job.
> Well, they actually already may hate Subversion, you and their job,
> but this will make it even worse.
>
> May I recommend something like Jenkins? (http://jenkins-ci.org).
> Jenkins is a continuous build system that will do the build right
> after the developer does a commit. On a bad build, Jenkins can then
> mail the build results to the developer who did the commit and to the
> development team responsible for the project.
>
> Jenkins has a ton of plugins and can run unit tests, do deployments,
> run code check styles, coverage reports, you name it. It integrates
> with over 2 dozen defect tracking systems including Jira, and
> integrates with web-based version control browsers like Sventon,
> Fisheye, and ViewVC.
>
> Jenkins is webbased, but doesn't need Apache to run. It comes with its
> own application server built into the warfile. All you need is a JRE,
> and the Windows MSI file comes with that.

I also highly discourage performing builds in the pre-commit hook. It
will definitely take too long.

Another suggestion: we use IntelliJ IDEA (Java IDE) and TeamCity
(continuous build system). With this setup, there is a Teamcity
feature (which we can use from within the IDE) called "Pre-tested
commit". It allows you to perform a "remote build" on TeamCity with
your local changes integrated. If the build is successful, you can let
those changes be committed automatically (optionally, you can let it
ask you for confirmation first).

You can do this directly from a changed file or a changelist, or from
within the commit dialog. I have never used it myself, but I know it's
there :-). See here for more info:

http://confluence.jetbrains.net/display/TCD6/Pre-Tested+%28Delayed%29+Commit

I'm not sure if there is a way to enforce this centrally (as far as I
can see, it's up to the developer whether or not to perform a remote
build upon commit). But maybe it's good enough to have this as a
policy, and educate the developers to use this feature as standard
procedure ...

Cheers,
-- 
Johan

RE: Build project in pre-commit

Posted by SUMNER Andrew <An...@customs.govt.nz>.
I totally agree.  I have just started using it for a PowerBuilder
project and it has worked very well.

-----Original Message-----
From: David Weintraub [mailto:qazwart@gmail.com] 
Sent: Wednesday, 6 April 2011 11:05
To: San Martino
Cc: users@subversion.apache.org
Subject: Re: Build project in pre-commit

On Tue, Apr 5, 2011 at 6:08 PM, San Martino <sa...@gmail.com> wrote:
> we absolutely need to validate a project in the pre-commit trigger
> with a build of the whole project being committed.
>
> Is this possible? Are there any tools allowing this?

You can't really do it with a pre-commit script since the changes
aren't part of the repository. (well, you can but it's a lot of work).

The big problem is that your developers are sitting there twiddling
their thumbs staring at a blank screen and unable to do any work while
your application builds. Even a fast build takes a couple of minutes
to complete.

Your developers will hate Subversion, hate you, and hate their job.
Well, they actually already may hate Subversion, you and their job,
but this will make it even worse.

May I recommend something like Jenkins? (http://jenkins-ci.org).
Jenkins is a continuous build system that will do the build right
after the developer does a commit. On a bad build, Jenkins can then
mail the build results to the developer who did the commit and to the
development team responsible for the project.

Jenkins has a ton of plugins and can run unit tests, do deployments,
run code check styles, coverage reports, you name it. It integrates
with over 2 dozen defect tracking systems including Jira, and
integrates with web-based version control browsers like Sventon,
Fisheye, and ViewVC.

Jenkins is webbased, but doesn't need Apache to run. It comes with its
own application server built into the warfile. All you need is a JRE,
and the Windows MSI file comes with that.


-- 
David Weintraub
qazwart@gmail.com
The information contained in this e-mail may be privileged and/or sensitive. It is intended for the addressee only and is not necessarily the official view or communication of the New Zealand Customs Service. If you are not the intended recipient you are asked to not disclose, copy, or make use of its contents. If received in error you are asked to destroy this e-mail and contact the sender immediately. Your assistance is appreciated.

Re: Build project in pre-commit

Posted by David Weintraub <qa...@gmail.com>.
On Tue, Apr 5, 2011 at 6:08 PM, San Martino <sa...@gmail.com> wrote:
> we absolutely need to validate a project in the pre-commit trigger
> with a build of the whole project being committed.
>
> Is this possible? Are there any tools allowing this?

You can't really do it with a pre-commit script since the changes
aren't part of the repository. (well, you can but it's a lot of work).

The big problem is that your developers are sitting there twiddling
their thumbs staring at a blank screen and unable to do any work while
your application builds. Even a fast build takes a couple of minutes
to complete.

Your developers will hate Subversion, hate you, and hate their job.
Well, they actually already may hate Subversion, you and their job,
but this will make it even worse.

May I recommend something like Jenkins? (http://jenkins-ci.org).
Jenkins is a continuous build system that will do the build right
after the developer does a commit. On a bad build, Jenkins can then
mail the build results to the developer who did the commit and to the
development team responsible for the project.

Jenkins has a ton of plugins and can run unit tests, do deployments,
run code check styles, coverage reports, you name it. It integrates
with over 2 dozen defect tracking systems including Jira, and
integrates with web-based version control browsers like Sventon,
Fisheye, and ViewVC.

Jenkins is webbased, but doesn't need Apache to run. It comes with its
own application server built into the warfile. All you need is a JRE,
and the Windows MSI file comes with that.


-- 
David Weintraub
qazwart@gmail.com