0

I work for a fairly new web development company and we are currently testing subversion installations to implement a versioning system. One of the features we need the versioning system to perform is to update the development server with an edited file once it has been committed.

We would like to maintain one server for all of our SVN repositories, even though, due to system requirements, we need to maintain several separate development servers. I understand that the updates are fairly simple when the development server resides in the same location as SVN, but that is just not possible for us. So, we need to map separate network drives to the SVN server for each development server.

However, this errors on commit. Here is my working copy test directory, as referenced in the post-commit.bat file:

SET WORKING_COPY=Z:\testweb

This, however, results in an error...

post-commit hook failed (exit code 1) with output: svn: Error resolving case of 'Z:\testweb'

I'm sure this is because the server is not the same user as me and therefore does not have the share I need mapped to "Z" - I just have no idea how to work around this. Can anyone help?

UPDATE: The more I look in to these issues it appears that the real solution to the problem is to use a CI Server to accomplish what I am attempting to accomplish. I am currently looking in to TeamCity and what it might do for us.

Carl
  • 1,246
  • 3
  • 21
  • 39

1 Answers1

0

Don't do this through a post-commit hook. If you ever manage to get the hook to succeed, you'll be causing the person who did the commit to wait until the update is complete. Instead, I recommend that you use Jenkins which is a continuous build engine.

It is possible that you don't have anything to build. After all, if you're using PHP or JavaScript, there's nothing to compile. However, you can still use Jenkins to do the update for you.

I can't get into the nitty-gritty detail hear, but one of the things you can do with Jenkins is redefine its working directory. You can do this by clicking on the Advanced button when you define a job, and it'll ask you where you want the working directory. In this case, you can specify your server's working directory.

One of the things you can do with Jenkins is have it automatically run tests, or maybe do a bit smoother update. For example, you might have to restart your web server when you change a few files, or maybe you need to make sure that if you're changing 100 files, they all get changed at once, or your server isn't in a stable state. You could use Jenkins to do this too. And, if there are any problems, you can have Jenkins email the person who is responsible for the server that the server update failed.

Jenkins is easy to setup and use. You can download it and start up Jenkins in 10 minutes. Setting up a job in Jenkins might take you another 15 minutes if you had never seen Jenkins before and had no idea how it works.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • Thanks for the input. I'm actually using uberSVN and I installed Jenkins thinking that it might do this, but I couldn't figure out how to get it to copy committed files to my working directory. I will look in to it some more. – Carl Mar 23 '12 at 11:40
  • Ok, it looks like I should set my server working copy directory in the field "Local Module Directory". However, when I do that with the network location: "Z:\testweb" it tells me that it must use a relative path. But if I'm on a network connection I don't think I have a relative path. Do I? – Carl Mar 23 '12 at 12:09
  • Ok, I did find the advanced button and filled out the working copy location there and left the other one as "." but it still wouldn't work. It failed on build saying it didn't recognize "Z:\testweb" – Carl Mar 23 '12 at 14:46
  • @unclesol Go to the _Job Configuration_. Under the **Advanced Project Options** section of the job you defined is a button labeled _Advanced..._. Click on this button. You'll now see some checkboxes. One is labeled **use custom workspace**. Check off this box, and you'll be given a space to write where your working directory should be. – David W. Mar 23 '12 at 15:06
  • Is that Z drive mounted on the Jenkins server? Wonder if you have to do `Z:/testweb` instead of `Z:\testweb`. – David W. Mar 23 '12 at 15:08
  • I tried Z:/testweb as well and it gives me the same error: "java.io.IOException: Failed to mkdirs: Z:/testweb" - I think that the drive is just mounted for my user - is there a way I can mount it for the Jenkins server? – Carl Mar 23 '12 at 16:13
  • I also tried including the batch command "if not exist z: (net use Z: \\servername\sharename)" where jenkins asks for a batch command and it doesn't make any difference. Still same error message – Carl Mar 23 '12 at 16:35
  • This looks like a Windows permissions issue. When Jenkins runs the first time, it might be trying to delete and recreate the `Z:/testweb` directory. It might not have permission to do this. Do you see any message saying something about creating the working directory? Try this, use the default Jenkins working directory. In you Jenkins _build_ script, do a `dir Z:` and a `dir Z:\testweb` and see if Jenkins can at least see that Z: drive. If it can, try copying a file there, and see if Jenkins can do that. – David W. Mar 26 '12 at 04:11
  • I think it is a permission issue. For some reason it says it is being started by user "anonymous" and then gives me the error: java.io.IOException: Failed to mkdirs: Z:\testweb I'm not sure how to change the user it is running as, though – Carl Mar 26 '12 at 12:47
  • How do you run Jenkins? Do you start it as a service on Windows? If you do, you can change the user that runs the service. By default, Services run under a _service account_ with complete system access, but limited permissions on particular files -- especially remote mounted shares. – David W. Mar 27 '12 at 00:34
  • I'm running Jenkins installed as a plugin to uberSVN. I've changed the user that the uberSVN service runs under, but there doesn't appear to be a specific service running for Jenkins. – Carl Mar 27 '12 at 11:46
  • Jenkins is a Java program, so there should be some Java executable running the `jenkins.war` file. Check the Task Manager and see if you can find the user running it. I'm trying to install UberSVN, but it's taking a very long time. – David W. Mar 27 '12 at 20:14
  • The more I look in to this question, it seems to me that the real solution is to use a CI server, like TeamCity. I am now exploring this option. – Carl Mar 29 '12 at 12:33
  • I can't see how TeamCity will solve this particular issue. This looks like a permission issue, and TeamCity will probably hit the same problem. Where things might help is running TeamCity as its own service which will allow you to specify the user. However, you can do the same thing with Jenkins. What you have to do is figure out what's causing the issue in the first place. It appears that whatever user is running your Subversion server is also running your Jenkins instant. Here's an idea, print out from Jenkins the environment variable `%USERNAME%`. – David W. Mar 29 '12 at 18:23
  • I've already done that. And that user has system wide permissions and the user is running both subversion and jenkins. I can log in as that user, see the mapped drive, edit files in the mapped drive and everything. But, when jenkins runs, it says it is being run by "anonymous" – Carl Mar 29 '12 at 20:48