Puppet Class: git

Defined in:
puppet/modules/git/manifests/init.pp

Overview

Class: git

Base class for using Puppet to clone and manage Git repositories.

Parameters

urlformat

When a 'git::clone'' resource does not define a 'remote' parameter, the remote repository URL is constructed by interpolating the title of the resource into the format string below. This provides a convenient syntactic sugar for cloning Gerrit repositories. Default: 'gerrit.wikimedia.org/r/p/%s.git'.

default_depth

Default depth for git clones. If specified, creates a shallow clone with history truncated to the specified number of revisions. Default undef.

Examples

# Use GitHub as the default remote for repositories.
class { 'git':
  urlformat => 'https://github.com/%s.git',
}

Parameters:

  • urlformat (Any) (defaults to: 'https://gerrit.wikimedia.org/r/%s.git')
  • default_depth (Any) (defaults to: undef)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'puppet/modules/git/manifests/init.pp', line 25

class git(
    $urlformat = 'https://gerrit.wikimedia.org/r/%s.git',
    $default_depth = undef,
) {
    include ::git::gerrit

    $packages = [
        'git',
        'git-man',
    ]

    package { $packages:
        ensure  => 'present',
    }

    package { 'git-review':
        ensure   => 'latest',
        provider => 'pip',
    }

    exec { 'configure_git_user':
        command     => "git config --global user.name '${::git_user}'; git config --global user.email vagrant@localhost",
        unless      => 'git config --get user.name',
        user        => 'vagrant',
        environment => [ 'HOME=/home/vagrant' ],
        require     => Package['git'],
    }
}