Run Shell Script Before Build For SVN Auto-Merge

I am using SVN so unfortunately I can't take advantage of the automatic merge mentioned in this blog post.
http://blog.jetbrains.com/teamcity/2013/10/automatic-merge/

I have a shell script that works reasonable well instead.
How can I run this before my build?

The script deletes the integration branch, recreates it from trunk then merges in the list of branch names passed into it.

I would do this nightly so that all my feature branches are in the integration branch before TeamCity builds the code to an environment ready for developers to test in the next morning.

However, I can't see how to do this.
There is a Command Line build runner but TeamCity is installed on Windows.
My script makes heavy use of grep and sed and the like to parse everything and changing it to windows batch would be hard.

Also, since this is updating svn, how would that affect TeamCity?
Is the check for changes done before any build steps?

3 comments
Comment actions Permalink

If I install git on the build server I can put unix files on the PATH.
That means that I can run bash scripts like this.

sh test.sh JIRA1234 JIRA3456


How do I do that from TeamCity?

In the command line runner would Command executable be "sh test.sh" and the Command parameters be "JIRA1234 JIRA3456"?

What about the VCS root? THis needs to update AFTER my command line runner step.

0
Comment actions Permalink

1) Concerning build runner - for command line runner, you can use whatever command line that works for you in windows cmd. For instance, "C:\Program Files (x86)\Git\bin\sh.exe" param1 param2.

2) To run the script before collecting changes, you can create another build configuration that contains a command line runner with #1 and then setup a finish build trigger in main BT to start when script BT finishes.

0
Comment actions Permalink

That worked really well!
The only difference I had to make was how I called the Command Line
Command executable = cmd.exe
Command parameters = /c ""C:\tools\msysgit\msysgit\bin\sh.exe" --login -i -- E:\development\development.sh %branches%"

Where %branches% is a build parameter that contains a list of the branch names to merge.

0

Please sign in to leave a comment.