Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » RE: Subversion - Repository Structure - Web Application(s)

This thread is locked; no one can reply to it. rss feed Print
RE: Subversion - Repository Structure - Web Application(s)
bamccaig
Member #7,536
July 2006
avatar

I've been asked to write hook scripts to automatically update Web sites (development, testing, and pre-production) with their corresponding branch of a subversion repository whenever changes are committed. The planned repository structure is...

/
|---branches/
|   |---a.b.c.d/
|   |---a.b.c.d/
|   |---a.b.c.d/
|   |---a.b.c.d/
|   |---(etc...)
|---tags/          # ???
|---trunk/         # Production/Stable.

As you can see, the branches will be given a version number. I can't see any way for my hook script to automatically know which branch goes where (aside from pre-production, which will essentially be the trunk). The idea I've come up with is using a small text file with configuration options to indicate which branches go where, which will be updated when a particular version matures. For example,...

development_root=N:\development
testing_root=N:\testing
preproduction_root=N:\preproduction

development_branch=3.0.26.12
testing_branch=3.0.25.11
preproduction_branch=2.5.24.3

Which would then be parsed by the hook script (or a called script), resulting in each branch of the subversion repository being exported to the corresponding directory.

I have two questions that I face at this point. Firstly, from a Windows batch file what is the best way to parse such a configuration file? I have only done limited scripting and generally avoid Windows because without the help of UNIX-like tools its largely limited... Would it be better to just store the configuration within variables in the hook script itself?

Secondly, how will my hook script be authenticated for svn access? For example, to call svn export will I need to authenticate from within the hook script or will the hook script just automatically be granted access? :-/ I'm assuming I will need to authenticate, since the repository has been granted no anonymous access. What is recommended? Storing a username/password for the hook script within itself and then limiting access to that file or is there some better approach?

MiquelFire
Member #3,110
January 2003
avatar

I would just have a better script get called from the batch file:
@python path\post-commit.py "%1" %2

This is my post-commit.bat file (well I removed some things to make it easier to understand)

How are you accessing the repository? You might have a open hole you can use if the hook script needs to authenticate.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

bamccaig
Member #7,536
July 2006
avatar

Well the server probably won't have any extra scripting environments installed and it would probably be a challenge to convince the higher ups that it is necessary or worthwhile. In theory though, I could use WSH or anything else that would likely be installed already... :-/ If I need to.

MiquelFire said:

How are you accessing the repository? You might have a open hole you can use if the hook script needs to authenticate.

The repository is accessed through apache over SSL. :-/ What do you mean open hole?! :o

BAF
Member #2,981
December 2002
avatar

You could always waive authentication to provide read-only access to the IPs of the server(s).

bamccaig
Member #7,536
July 2006
avatar

BAF said:

You could always waive authentication to provide read-only access to the IPs of the server(s).

That sounds like it might be an option... :-/ How would I do that? :P

BAF
Member #2,981
December 2002
avatar

You should be able to do it with Apache, depending on how your auth is setup, by putting the IPs in Allow From or something.

Crazy Photon
Member #2,588
July 2002
avatar

Look it from the other way around, instead of having Subversion do it, this task is better suited to a Continuous Integration server*.

  • = Just wrote a related article in my blog about it...

-----
Resistance is NEVER futile...

Go to: