Iliya Garakh
Iliya Garakh

Reputation: 407

Handmade continuous integration with shell script

I did a temporary solution for a small continuous integration with shell script. It updates from svn and then copies files to site's root directory. So it looks like this

cd ...

update svn

cp -R ... ...

And then put it in crontab. Well, it works fine for temp. solution, but it would want to make some improvement and to define somehow that svn was changed (new revision appeared) and only in this case to copy files (well, its connected with every-minut copying files makes server work slower).

But im a mean user of linux :(

So the question is: how to define, using bash script, that svn got new commits and only in this case to make an update and other stuff, like copying files.

Upvotes: 0

Views: 993

Answers (2)

EricMinick
EricMinick

Reputation: 1477

Stop.

Why in the world would you do this?

With eighty totally free, super easy to install, CI tools out there, why in the world would you start hacking your own together with shell scripts and cron?

Unless you're looking to work on your scripting / cron skills and want to use building your own CI as an fun little scenario to play through, you're just wasting your time here.

Upvotes: -1

Thierry
Thierry

Reputation: 1030

You can do 'svn info' in the directory (and use awk|grep|your favorite tool) to extract the revision number of what you've checked out. Do the same to the location you copy to. If the revision number in the checkout directory is higher than the one in the destination directory, then do the copy.

That's assuming that you copy everything including the .svn directories.

If you exclude them, then you should 'svn info' before you update, and again after, and compare the two revisions.

Upvotes: 2

Related Questions