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:
57 * [Bazaar (bzr)](#bazaar)
59 * [Mercurial (hg)](#mercurial)
60 * [Subversion (svn)](#subversion)
62 **Note:* Git is the only VCS provider officially [supported](https://forge.puppetlabs.com/supported) by Puppet Labs.
67 #####To create a blank repository
69 To create a blank repository suitable for use as a central repository,
70 define `vcsrepo` without `source` or `revision`.
72 vcsrepo { "/path/to/repo":
77 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'.
79 vcsrepo { "/path/to/repo":
84 #####To clone/pull a repository
86 To get the current HEAD on the master branch,
88 vcsrepo { "/path/to/repo":
91 source => "git://example.com/repo.git",
94 To get a specific revision or branch (can be a commit SHA, tag, or branch name),
98 vcsrepo { "/path/to/repo":
101 source => 'git://example.com/repo.git',
102 revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',
107 vcsrepo { "/path/to/repo":
110 source => 'git://example.com/repo.git',
111 revision => '1.1.2rc1',
116 vcsrepo { "/path/to/repo":
119 source => 'git://example.com/repo.git',
120 revision => 'development',
123 To check out a branch as a specific user,
125 vcsrepo { "/path/to/repo":
128 source => 'git://example.com/repo.git',
129 revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',
133 To keep the repository at the latest revision (**WARNING:** this will always overwrite local changes to the repository),
135 vcsrepo { "/path/to/repo":
138 source => 'git://example.com/repo.git',
139 revision => 'master',
142 #####Sources that use SSH
144 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.
146 For SSH keys associated with a user, enter the username in the `user` parameter. Doing so will use that user's keys.
148 user => 'toto' # will use toto's $HOME/.ssh setup
150 #####Further Examples
152 For more examples using Git, see `examples/git/`.
156 #####Create a blank repository
158 To create a blank repository suitable for use as a central repository,
159 define `vcsrepo` without `source` or `revision`.
161 vcsrepo { "/path/to/repo":
166 #####Branch from an existing repository
168 Provide the `source` location to branch from an existing repository.
170 vcsrepo { "/path/to/repo":
173 source => 'lp:myproj',
176 For a specific revision, use `revision` with a valid revisionspec
177 (see `bzr help revisionspec` for more information on formatting a revision).
179 vcsrepo { "/path/to/repo":
182 source => 'lp:myproj',
183 revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x',
186 #####Sources that use SSH
188 When your source uses SSH, for instance 'bzr+ssh://...' or 'sftp://...,'
189 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.
191 #####Further examples
193 For more examples using Bazaar, see `examples/bzr/`.
197 #####To create a blank repository
199 To create a blank repository suitable for use as a central repository,
200 define `vcsrepo` without `source` or `revision`.
202 vcsrepo { "/path/to/repo":
207 #####To checkout/update from a repository
209 To get the current mainline,
211 vcsrepo { "/path/to/workspace":
214 source => ":pserver:anonymous@example.com:/sources/myproj",
217 To get a specific module on the current mainline,
219 vcsrepo {"/vagrant/lockss-daemon-source":
222 source => ":pserver:anonymous@lockss.cvs.sourceforge.net:/cvsroot/lockss",
223 module => "lockss-daemon",
227 You can use the `compression` parameter to set the GZIP compression levels for your repository history.
229 vcsrepo { "/path/to/workspace":
233 source => ":pserver:anonymous@example.com:/sources/myproj",
236 For a specific tag, use `revision`.
238 vcsrepo { "/path/to/workspace":
242 source => ":pserver:anonymous@example.com:/sources/myproj",
243 revision => "SOMETAG",
246 #####Sources that use SSH
248 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.
250 #####Further examples
252 For for more examples using CVS, see `examples/cvs/`.
256 #####To create a blank repository
258 To create a blank repository suitable for use as a central repository,
259 define `vcsrepo` without `source` or `revision`.
261 vcsrepo { "/path/to/repo":
266 #####To clone/pull & update a repository
268 To get the default branch tip,
270 vcsrepo { "/path/to/repo":
273 source => "http://hg.example.com/myrepo",
276 For a specific changeset, use `revision`.
278 vcsrepo { "/path/to/repo":
281 source => "http://hg.example.com/myrepo",
282 revision => '21ea4598c962',
285 You can also set `revision` to a tag.
287 vcsrepo { "/path/to/repo":
290 source => "http://hg.example.com/myrepo",
294 To check out as a specific user,
296 vcsrepo { "/path/to/repo":
299 source => "http://hg.example.com/myrepo",
303 To specify an SSH identity key,
305 vcsrepo { "/path/to/repo":
308 source => "ssh://hg@hg.example.com/myrepo",
309 identity => "/home/user/.ssh/id_dsa,
312 To specify a username and password for HTTP Basic authentication,
314 vcsrepo { "/path/to/repo":
317 source => 'http://hg.example.com/myrepo',
318 basic_auth_username => 'hgusername',
319 basic_auth_password => 'hgpassword',
322 #####Sources that use SSH
324 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.
326 #####Further Examples
328 For more examples using Mercurial, see `examples/hg/`.
332 #####To create a blank repository
334 To create a blank repository suitable for use as a central repository,
335 define `vcsrepo` without `source` or `revision`.
337 vcsrepo { "/path/to/repo":
342 #####To check out from a repository
344 Provide a `source` pointing to the branch/tag you want to check out from a repository.
346 vcsrepo { "/path/to/repo":
349 source => "svn://svnrepo/hello/branches/foo",
352 You can also provide a specific revision.
354 vcsrepo { "/path/to/repo":
357 source => "svn://svnrepo/hello/branches/foo",
361 #####Using a specific Subversion configuration directory
363 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'.
365 vcsrepo { "/path/to/repo":
368 source => "svn://svnrepo/hello/branches/foo",
369 configuration => "/path/to/.subversion",
372 #####Sources that use SSH
374 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.
378 For more examples using Subversion, see `examples/svn/`.
384 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.
388 **Note**: Not all features are available with all providers.
390 * `git` - Supports the Git VCS. (Contains features: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user`.)
391 * `bar` - Supports the Bazaar VCS. (Contains features: `reference_tracking`.)
392 * `cvs` - Supports the CVS VCS. (Contains features: `cvs_rsh`, `gzip_compression`, `modules`,`reference_tracking`.)
394 * `hg` - Supports the Mercurial VCS. (Contains features: `reference_tracking`, `ssh_identity`, `user`.)
395 * `svn` - Supports the Subversion VCS. (Contains features: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`.)
399 **Note**: Not all features are available with all providers.
401 * `bare_repositories` - The provider differentiates between bare repositories and those with working copies. (Available with `git`.)
402 * `basic_auth` - The provider supports HTTP Basic Authentication. (Available with `svn`.)
403 * `configuration` - The provider supports setting the configuration path.(Available with `svn`.)
404 * `cvs_rsh` - The provider understands the CVS_RSH environment variable. (Available with `cvs`.)
405 * `depth` - The provider can do shallow clones. (Available with `git`.)
406 * `filesystem_types` - The provider supports different filesystem types. (Available with `svn`.)
407 * `gzip_compression` - The provider supports explicit GZip compression levels. (Available with `cvs`.)
408 * `modules` - The provider allows specific repository modules to be chosen. (Available with `cvs`.)
409 * `multiple_remotes` - The repository tracks multiple remote repositories. (Available with `git`.)
410 * `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`.)
411 * `ssh_identity` - The provider supports a configurable SSH identity file. (Available with `git` and `hg`.)
412 * `user` - The provider can run as a different user. (Available with `git` and `hg`.)
416 * `basic_auth_password` - Specifies the HTTP Basic Authentication password. (Requires the `basic_auth` feature.)
417 * `basic_auth_username` - Specifies the HTTP Basic Authentication username. (Requires the `basic_auth` feature.)
418 * `compression` - Set the GZIP compression levels for your repository history. (Requires the `gzip_compression` feature.)
419 * `configuration` - Sets the configuration directory to use. (Requires the `configuration` feature.)
420 * `cvs_rsh` - The value to be used for the CVS_RSH environment variable. (Requires the `cvs_rsh` feature.)
421 * `depth` - The value to be used to do a shallow clone. (Requires the `depth` feature.)
422 * `ensure` - Determines the state of the repository. Valid values are 'present', 'bare', 'absent', 'latest'.
423 * `excludes` - Lists any files to be excluded from the repository.
424 * `force` - Forces repository creation. Valid values are 'true' and 'false'. **WARNING** Forcing will destroy any files in the path.
425 * `fstype` - Sets the filesystem type. (Requires the `filesystem_types` feature.)
426 * `group` - Determines the group/gid that owns the repository files.
427 * `identity` - Specifies the SSH identity file. (Requires the `ssh_identity` feature.)
428 * `module` - Specifies the repository module to manage. (Requires the `modules` feature.)
429 * `owner` - Specifies the user/uid that owns the repository files.
430 * `path` - Specifies the absolute path to the repository. If omitted, the value defaults to the resource's title.
431 * `provider` - Specifies the backend to use for this vcsrepo resource.
432 * `remote` - Specifies the remote repository to track. (Requires the `multiple_remotes` feature.)
433 * `revision` - Sets the revision of the repository. Values can match /^\S+$/.
434 * `source` - Specifies the source URI for the repository.
435 * `user` - Specifies the user to run as for repository operations.
437 ####Features and Parameters by Provider
440 **Features**: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user`
442 **Parameters**: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user`
445 **Features**: `reference_tracking`
447 **Parameters**: `ensure`, `excludes`, `force`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `user`
450 **Features**: `cvs_rsh`, `gzip_compression`, `modules`, `reference_tracking`, `revision`
452 **Parameters**: `compression`, `cvs_rsh`, `ensure`, `excludes`, `force`, `group`, `module`, `owner`, `path`, `provider`, `revision`, `source`, `user`
455 **Features**: `reference_tracking`, `ssh_identity`, `user`
457 **Parameters**: `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `revision`, `source`, `user`
460 **Features**: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`
462 **Parameters**: `basic_auth_password`, `basic_auth_username`, `configuration`, `ensure`, `excludes`, `force`, `fstype`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `user`
466 Git is the only VCS provider officially [supported](https://forge.puppetlabs.com/supported) by Puppet Labs.
468 This module has been built on and tested against Puppet 2.7 and higher.
470 The module has been tested on:
472 RedHat Enterprise Linux 5/6
480 Testing on other platforms has been light and cannot be guaranteed.
484 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.
486 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.
488 You can read the complete module contribution guide on the Puppet Labs wiki.