1 |
misc |
795 |
class git { |
2 |
|
|
class common { |
3 |
|
|
package { 'git-core': |
4 |
|
|
} |
5 |
|
|
} |
6 |
|
|
|
7 |
|
|
class server inherits common { |
8 |
misc |
796 |
$git_base_path = '/git/' |
9 |
|
|
|
10 |
|
|
xinetd::service { "git": |
11 |
|
|
content => template('git/xinetd') |
12 |
|
|
} |
13 |
|
|
|
14 |
|
|
file { "$git_base_path": |
15 |
|
|
ensure => directory |
16 |
|
|
} |
17 |
|
|
|
18 |
misc |
795 |
# TODO |
19 |
|
|
# define common syntax check, see svn |
20 |
|
|
# proper policy : no-fast-forward |
21 |
|
|
# no branch ? |
22 |
|
|
# no binary |
23 |
|
|
# no big file |
24 |
|
|
# no empty commit message, no root |
25 |
|
|
# automated push to another git repo ( see http://noone.org/blog/English/Computer/VCS/Thoughts%20on%20Gitorious%20and%20GitHub%20plus%20a%20useful%20git%20hook.futile |
26 |
|
|
# |
27 |
|
|
# how do we handle commit permission ? |
28 |
|
|
} |
29 |
|
|
|
30 |
misc |
799 |
define repository($description = '') { |
31 |
misc |
797 |
exec { "git init --bare $name": |
32 |
|
|
creates => $name, |
33 |
|
|
} |
34 |
misc |
795 |
|
35 |
misc |
798 |
file { "$name/git-daemon-export-ok": |
36 |
|
|
ensure => present, |
37 |
|
|
requires => Exec["git init --bare $name"] |
38 |
|
|
} |
39 |
misc |
799 |
|
40 |
|
|
file { "$name/description": |
41 |
|
|
ensure => present, |
42 |
|
|
content => $description |
43 |
|
|
} |
44 |
misc |
795 |
} |
45 |
|
|
|
46 |
|
|
class client inherits common { |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
define snapshot($source, $refresh ='*/5', $user = 'root') { |
52 |
|
|
include git::client |
53 |
|
|
#TODO |
54 |
|
|
# should handle branch -> clone -n + branch + checkout |
55 |
|
|
# create a script |
56 |
|
|
# Idealy, should be handled by vcsrepo https://github.com/bruce/puppet-vcsrepo |
57 |
|
|
# once it is merged in puppet |
58 |
|
|
exec { "/usr/bin/git clone $source $name": |
59 |
|
|
creates => $name, |
60 |
|
|
user => $user |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
cron { "update $name": |
64 |
|
|
# FIXME no -q ? |
65 |
|
|
command => "cd $name && /usr/bin/git pull", |
66 |
|
|
user => $user, |
67 |
|
|
minute => $refresh |
68 |
|
|
} |
69 |
|
|
} |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|