3 [](https://travis-ci.org/puppetlabs/puppetlabs-vcsrepo)
7 1. [Overview](#overview)
8 2. [Module Description - What the module does and why it is useful](#module-description)
9 3. [Setup - The basics of getting started with vcsrepo](#setup)
10 * [Beginning with vcsrepo](#beginning-with-vcsrepo)
11 4. [Usage - Configuration options and additional functionality](#usage)
15 * [Mercurial](#mercurial)
16 * [Subversion](#subversion)
17 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
18 * [Type: vcsrepo](#type-vcsrepo)
19 * [Providers](#providers)
20 * [Features](#features)
21 * [Parameters](#parameters)
22 * [Features and Parameters by Provider](#features-and-parameters-by-provider)
23 5. [Limitations - OS compatibility, etc.](#limitations)
24 6. [Development - Guide for contributing to the module](#development)
28 The vcsrepo module allows you to use Puppet to easily deploy content from your version control system (VCS).
32 This module provides a single type with providers for each VCS, which can be used to describe:
34 * A working copy checked out from a (remote or local) source, at an
36 * A blank working copy not associated with a source (when it makes
37 sense for the VCS being used)
38 * A blank central repository (when the distinction makes sense for the VCS
43 ###Beginning with vcsrepo
45 To get started with the vcsrepo module, you must simply define the type `vcsrepo` with a path to your repository and the [type of VCS](#Usage) you're using in `provider` (in the below example, Git).
47 vcsrepo { "/path/to/repo":
54 The vcsrepo module works with the following VCSs:
56 * [Bazaar (bzr)](#bazaar)
59 * [Mercurial (hg)](#mercurial)
60 * [Subversion (svn)](#subversion)
64 #####Create a blank repository
66 To create a blank repository suitable for use as a central repository,
67 define `vcsrepo` without `source` or `revision`.
69 vcsrepo { "/path/to/repo":
74 #####Branch from an existing repository
76 Provide the `source` location to branch from an existing repository.
78 vcsrepo { "/path/to/repo":
81 source => 'lp:myproj',
84 For a specific revision, use `revision` with a valid revisionspec
85 (see `bzr help revisionspec` for more information on formatting a revision).
87 vcsrepo { "/path/to/repo":
90 source => 'lp:myproj',
91 revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x',
94 #####Sources that use SSH
96 When your source uses SSH, for instance 'bzr+ssh://...' or 'sftp://...,'
97 you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present.
101 For more examples using Bazaar, see `examples/bzr/`.
105 #####To create a blank repository
107 To create a blank repository suitable for use as a central repository,
108 define `vcsrepo` without `source` or `revision`.
110 vcsrepo { "/path/to/repo":
115 #####To checkout/update from a repository
117 To get the current mainline,
119 vcsrepo { "/path/to/workspace":
122 source => ":pserver:anonymous@example.com:/sources/myproj",
125 To get a specific module on the current mainline,
127 vcsrepo {"/vagrant/lockss-daemon-source":
130 source => ":pserver:anonymous@lockss.cvs.sourceforge.net:/cvsroot/lockss",
131 module => "lockss-daemon",
135 You can use the `compression` parameter to set the GZIP compression levels for your repository history.
137 vcsrepo { "/path/to/workspace":
141 source => ":pserver:anonymous@example.com:/sources/myproj",
144 For a specific tag, use `revision`.
146 vcsrepo { "/path/to/workspace":
150 source => ":pserver:anonymous@example.com:/sources/myproj",
151 revision => "SOMETAG",
154 #####Sources that use SSH
156 When your source uses SSH, you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present.
158 #####Further examples
160 For for more examples using CVS, see `examples/cvs/`.
164 #####To create a blank repository
166 To create a blank repository suitable for use as a central repository,
167 define `vcsrepo` without `source` or `revision`.
169 vcsrepo { "/path/to/repo":
174 If you're defining `vcsrepo` for a central or official repository, you may want to make it a bare repository. You do this by setting `ensure` to 'bare' rather than 'present'.
176 vcsrepo { "/path/to/repo":
181 #####To clone/pull a repository
183 To get the current HEAD on the master branch,
185 vcsrepo { "/path/to/repo":
188 source => "git://example.com/repo.git",
191 To get a specific revision or branch (can be a commit SHA, tag, or branch name),
195 vcsrepo { "/path/to/repo":
198 source => 'git://example.com/repo.git',
199 revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',
204 vcsrepo { "/path/to/repo":
207 source => 'git://example.com/repo.git',
208 revision => '1.1.2rc1',
213 vcsrepo { "/path/to/repo":
216 source => 'git://example.com/repo.git',
217 revision => 'development',
220 To check out a branch as a specific user,
222 vcsrepo { "/path/to/repo":
225 source => 'git://example.com/repo.git',
226 revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',
230 To keep the repository at the latest revision (**WARNING:** this will always overwrite local changes to the repository),
232 vcsrepo { "/path/to/repo":
235 source => 'git://example.com/repo.git',
236 revision => 'master',
239 #####Sources that use SSH
241 When your source uses SSH, such as 'username@server:…', you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present.
243 For SSH keys associated with a user, enter the username in the `user` parameter. Doing so will use that user's keys.
245 user => 'toto' # will use toto's $HOME/.ssh setup
247 #####Further Examples
249 For more examples using Git, see `examples/git/`.
253 #####To create a blank repository
255 To create a blank repository suitable for use as a central repository,
256 define `vcsrepo` without `source` or `revision`.
258 vcsrepo { "/path/to/repo":
263 #####To clone/pull & update a repository
265 To get the default branch tip,
267 vcsrepo { "/path/to/repo":
270 source => "http://hg.example.com/myrepo",
273 For a specific changeset, use `revision`.
275 vcsrepo { "/path/to/repo":
278 source => "http://hg.example.com/myrepo",
279 revision => '21ea4598c962',
282 You can also set `revision` to a tag.
284 vcsrepo { "/path/to/repo":
287 source => "http://hg.example.com/myrepo",
291 To check out as a specific user,
293 vcsrepo { "/path/to/repo":
296 source => "http://hg.example.com/myrepo",
300 To specify an SSH identity key,
302 vcsrepo { "/path/to/repo":
305 source => "ssh://hg@hg.example.com/myrepo",
306 identity => "/home/user/.ssh/id_dsa,
309 To specify a username and password for HTTP Basic authentication,
311 vcsrepo { "/path/to/repo":
314 source => 'http://hg.example.com/myrepo',
315 basic_auth_username => 'hgusername',
316 basic_auth_password => 'hgpassword',
319 #####Sources that use SSH
321 When your source uses SSH, such as 'ssh://...', you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present.
323 #####Further Examples
325 For more examples using Mercurial, see `examples/hg/`.
329 #####To create a blank repository
331 To create a blank repository suitable for use as a central repository,
332 define `vcsrepo` without `source` or `revision`.
334 vcsrepo { "/path/to/repo":
339 #####To check out from a repository
341 Provide a `source` pointing to the branch/tag you want to check out from a repository.
343 vcsrepo { "/path/to/repo":
346 source => "svn://svnrepo/hello/branches/foo",
349 You can also provide a specific revision.
351 vcsrepo { "/path/to/repo":
354 source => "svn://svnrepo/hello/branches/foo",
358 #####Using a specific Subversion configuration directory
360 To use a specific configuration directory, provide a `configuration` parameter which should be a directory path on the local system where your svn configuration files are. Typically, it is '/path/to/.subversion'.
362 vcsrepo { "/path/to/repo":
365 source => "svn://svnrepo/hello/branches/foo",
366 configuration => "/path/to/.subversion",
369 #####Sources that use SSH
371 When your source uses SSH, such as 'svn+ssh://...', you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present.
375 For more examples using Subversion, see `examples/svn/`.
381 The vcsrepo module is slightly unusual in that it is simply a type and providers. Each provider abstracts a different VCS, and a series of features are available to each provider based on its specific needs.
385 **Note**: Not all features are available with all providers.
387 * `bar` - Supports the Bazaar VCS. (Contains features: `reference_tracking`.)
388 * `cvs` - Supports the CVS VCS. (Contains features: `cvs_rsh`, `gzip_compression`, `modules`,`reference_tracking`.)
390 * `git` - Supports the Git VCS. (Contains features: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user`.)
391 * `hg` - Supports the Mercurial VCS. (Contains features: `reference_tracking`, `ssh_identity`, `user`.)
392 * `svn` - Supports the Subversion VCS. (Contains features: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`.)
396 **Note**: Not all features are available with all providers.
398 * `bare_repositories` - The provider differentiates between bare repositories and those with working copies. (Available with `git`.)
399 * `basic_auth` - The provider supports HTTP Basic Authentication. (Available with `svn`.)
400 * `configuration` - The provider supports setting the configuration path.(Available with `svn`.)
401 * `cvs_rsh` - The provider understands the CVS_RSH environment variable. (Available with `cvs`.)
402 * `depth` - The provider can do shallow clones. (Available with `git`.)
403 * `filesystem_types` - The provider supports different filesystem types. (Available with `svn`.)
404 * `gzip_compression` - The provider supports explicit GZip compression levels. (Available with `cvs`.)
405 * `modules` - The provider allows specific repository modules to be chosen. (Available with `cvs`.)
406 * `multiple_remotes` - The repository tracks multiple remote repositories. (Available with `git`.)
407 * `reference_tracking` - The provider supports tracking revision references that can change over time (e.g. some VCS tags and branch names). (Available with `bar`, `cvs`, `git`, `hg`, `svn`.)
408 * `ssh_identity` - The provider supports a configurable SSH identity file. (Available with `git` and `hg`.)
409 * `user` - The provider can run as a different user. (Available with `git` and `hg`.)
413 * `basic_auth_password` - Specifies the HTTP Basic Authentication password. (Requires the `basic_auth` feature.)
414 * `basic_auth_username` - Specifies the HTTP Basic Authentication username. (Requires the `basic_auth` feature.)
415 * `compression` - Set the GZIP compression levels for your repository history. (Requires the `gzip_compression` feature.)
416 * `configuration` - Sets the configuration directory to use. (Requires the `configuration` feature.)
417 * `cvs_rsh` - The value to be used for the CVS_RSH environment variable. (Requires the `cvs_rsh` feature.)
418 * `depth` - The value to be used to do a shallow clone. (Requires the `depth` feature.)
419 * `ensure` - Determines the state of the repository. Valid values are 'present', 'bare', 'absent', 'latest'.
420 * `excludes` - Lists any files to be excluded from the repository.
421 * `force` - Forces repository creation. Valid values are 'true' and 'false'. **WARNING** Forcing will destroy any files in the path.
422 * `fstype` - Sets the filesystem type. (Requires the `filesystem_types` feature.)
423 * `group` - Determines the group/gid that owns the repository files.
424 * `identity` - Specifies the SSH identity file. (Requires the `ssh_identity` feature.)
425 * `module` - Specifies the repository module to manage. (Requires the `modules` feature.)
426 * `owner` - Specifies the user/uid that owns the repository files.
427 * `path` - Specifies the absolute path to the repository. If omitted, the value defaults to the resource's title.
428 * `provider` - Specifies the backend to use for this vcsrepo resource.
429 * `remote` - Specifies the remote repository to track. (Requires the `multiple_remotes` feature.)
430 * `revision` - Sets the revision of the repository. Values can match /^\S+$/.
431 * `source` - Specifies the source URI for the repository.
432 * `user` - Specifies the user to run as for repository operations.
434 ####Features and Parameters by Provider
437 **Features**: `reference_tracking`
439 **Parameters**: `ensure`, `excludes`, `force`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `user`
442 **Features**: `cvs_rsh`, `gzip_compression`, `modules`, `reference_tracking`, `revision`
444 **Parameters**: `compression`, `cvs_rsh`, `ensure`, `excludes`, `force`, `group`, `module`, `owner`, `path`, `provider`, `revision`, `source`, `user`
447 **Features**: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user`
449 **Parameters**: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user`
452 **Features**: `reference_tracking`, `ssh_identity`, `user`
454 **Parameters**: `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `revision`, `source`, `user`
457 **Features**: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`
459 **Parameters**: `basic_auth_password`, `basic_auth_username`, `configuration`, `ensure`, `excludes`, `force`, `fstype`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `user`
463 This module has been built on and tested against Puppet 2.7 and higher.
465 The module has been tested on:
467 RedHat Enterprise Linux 5/6
475 Testing on other platforms has been light and cannot be guaranteed.
479 Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
481 We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
483 You can read the complete module contribution guide on the Puppet Labs wiki.