system-config/modules/github/manifests/init.pp
Monty Taylor 383c023b15 Add support for initial project creation.
If replicate_local is set, this will ensure that /var/lib/git is created,
and that projects listed in the projects.config have repos there.

Additionally, it creates a new config file, projects.config which is a
yaml file listing all of the projects and various operational semantics about
them, such as whether or not they should have pull requests closed and whether
or not they track any remotes. This replaces remotes.config and github.config.

Moving forward, there is no reason to not have this script be able to
do github api calls to create the github repo if it's not there, set the
github project description, gerrit api calls to create the project in gerrit,
and initial project permissions templates.

Change-Id: I1ad803b0aa5f7386206d0c3f4cd858017242fe64
2012-08-02 15:49:02 +00:00

75 lines
1.5 KiB
Puppet

class github (
$username,
$oauth_token,
$projects = []
) {
include pip
package { "PyGithub":
ensure => latest, # okay to use latest for pip
provider => pip,
require => Class[pip]
}
group { "github":
ensure => present
}
user { "github":
ensure => present,
comment => "Github API User",
shell => "/bin/bash",
gid => "github",
require => Group["github"]
}
file { '/etc/github':
owner => 'root',
group => 'root',
mode => 755,
ensure => 'directory',
}
file { '/etc/github/github.config':
ensure => absent
}
file { '/etc/github/github.secure.config':
owner => 'root',
group => 'github',
mode => 440,
ensure => 'present',
content => template('github/github.secure.config.erb'),
replace => 'true',
require => [Group['github'], File['/etc/github']],
}
file { '/usr/local/github':
owner => 'root',
group => 'root',
mode => 755,
ensure => 'directory',
}
file { '/usr/local/github/scripts':
owner => 'root',
group => 'root',
mode => 755,
ensure => 'directory',
recurse => true,
require => File['/usr/local/github'],
source => [
"puppet:///modules/github/scripts",
],
}
cron { "githubclosepull":
user => github,
minute => "*/5",
command => 'sleep $((RANDOM\%60+90)) && python /usr/local/github/scripts/close_pull_requests.py',
require => File['/usr/local/github/scripts'],
}
}