/[adm]/puppet/modules/git/manifests/init.pp
ViewVC logotype

Annotation of /puppet/modules/git/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 806 - (hide annotations) (download)
Sun Jan 16 13:15:29 2011 UTC (13 years, 3 months ago) by misc
File size: 2784 byte(s)
use newly commited script to create shared git repository
1 misc 795 class git {
2     class common {
3     package { 'git-core':
4     }
5     }
6    
7     class server inherits common {
8 misc 800 # http://www.kernel.org/pub/software/scm/git/docs/everyday.html#Repository%20Administration
9 misc 796 $git_base_path = '/git/'
10    
11     xinetd::service { "git":
12     content => template('git/xinetd')
13     }
14    
15     file { "$git_base_path":
16     ensure => directory
17     }
18 misc 805
19     file { "/usr/local/bin/create_git_repo.sh":
20     ensure => present,
21     owner => root,
22     group => root,
23     mode => 755,
24     content => template('git/create_git_repo.sh')
25     }
26 misc 796
27 misc 805
28 misc 795 # TODO
29     # define common syntax check, see svn
30 misc 800 # http://stackoverflow.com/questions/3719883/git-hook-syntax-check
31     # proper policy : fast-forward-only
32     # ( http://progit.org/book/ch7-4.html )
33 misc 795 # no branch ?
34     # no binary
35     # no big file
36 misc 800 # no empty commit message
37     # no commit from root
38     # see http://www.itk.org/Wiki/Git/Hooks
39 misc 795 # 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
40     #
41     # how do we handle commit permission ?
42 misc 800 # mail sending
43     #
44 misc 795 }
45    
46 misc 806 define repository($description = '',
47     $group ) {
48    
49     include git::server
50 misc 800 # http://eagleas.livejournal.com/18907.html
51 misc 806 # TODO group permission should be handled here too
52     exec { "/usr/local/bin/create_git_repo.sh $name":
53     user => root,
54     group => $group
55 misc 797 creates => $name,
56     }
57 misc 795
58 misc 798 file { "$name/git-daemon-export-ok":
59     ensure => present,
60 misc 806 requires => Exec["/usr/local/bin/create_git_repo.sh $name"]
61 misc 798 }
62 misc 799
63     file { "$name/description":
64     ensure => present,
65     content => $description
66     }
67 misc 795 }
68    
69     class client inherits common {
70    
71    
72     }
73    
74     define snapshot($source, $refresh ='*/5', $user = 'root') {
75     include git::client
76     #TODO
77     # should handle branch -> clone -n + branch + checkout
78     # create a script
79     # Idealy, should be handled by vcsrepo https://github.com/bruce/puppet-vcsrepo
80     # once it is merged in puppet
81     exec { "/usr/bin/git clone $source $name":
82     creates => $name,
83     user => $user
84     }
85    
86     cron { "update $name":
87     # FIXME no -q ?
88     command => "cd $name && /usr/bin/git pull",
89     user => $user,
90     minute => $refresh
91     }
92     }
93     }
94    
95    
96    

  ViewVC Help
Powered by ViewVC 1.1.30