Commiting a file back to VCS after successful build

Is there a way to commit a file back to a VCS root, after labeling, via a plugin?

Previous to TeamCity, a version file was used as a canoical source for build version information.  This file doesn't need to remain as canoical source of the current build, TeamCity can manage this, but the way various parts of software look to the information that is provided by the file, it may be easier for me to modify what TeamCity does, rather then modifying each and every project that uses this convertion.

Ideally I'd like to reverse map the checkout rules from the base of the directory, back to the location in VCS.  If this can be done, at worst case I can then invoke the VCS (SVN in this case) directly in my plugin to do the dirty work.

-Scott

0
3 comments

So it appears that the VCS checkoutRules can be easily obtained after the build is finished, but I don't see a convient way to convert a relative system path on the checkout directory, back to the server path.   Anyone have a suggestion of where to look?

    @Override
    public void buildFinished(SRunningBuild build)
    {
        System.out.println("build finished, listing VCS Roots");
        for(VcsRootEntry vcs : build.getVcsRootEntries())
        {
            System.out.println(vcs.toString());
           
            CheckoutRules cor = vcs.getCheckoutRules();
           
            System.out.println("Checkout rule: " +  cor.getAsString());
           
        }
        super.buildFinished(build);
    }
0

So if I understand you right you need to checkin a file to the root directory of the VCS root? You probably do not need to use checkout rules for that. You can obtain VCS root details right from the VCS root properties.

0

You are right, I solved this in two stages.

An agent plugin updates the file to the correct information if present on the agent, then after the build, and on successful label, a server extention commits other changes back to the source control system (Subversion over WebDav and autoversioning).

0

Please sign in to leave a comment.