{"id":15022589,"url":"https://github.com/puppetlabs/puppetlabs-vcsrepo","last_synced_at":"2025-09-30T06:31:05.774Z","repository":{"id":37651683,"uuid":"910755","full_name":"puppetlabs/puppetlabs-vcsrepo","owner":"puppetlabs","description":"Support for source control repositories","archived":false,"fork":true,"pushed_at":"2024-12-17T05:58:32.000Z","size":1301,"stargazers_count":223,"open_issues_count":20,"forks_count":285,"subscribers_count":144,"default_branch":"main","last_synced_at":"2025-01-15T04:41:53.985Z","etag":null,"topics":["hacktoberfest","module","supported"],"latest_commit_sha":null,"homepage":"http://forge.puppetlabs.com/puppetlabs/vcsrepo","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bruce/puppet-vcsrepo","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2010-09-14T19:30:52.000Z","updated_at":"2024-11-29T10:07:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/puppetlabs/puppetlabs-vcsrepo","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-vcsrepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-vcsrepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-vcsrepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-vcsrepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/puppetlabs-vcsrepo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234712600,"owners_count":18875482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","module","supported"],"created_at":"2024-09-24T19:58:09.143Z","updated_at":"2025-09-30T06:31:05.419Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vcsrepo\n\n#### Table of contents\n\n1. [Overview](#overview)\n2. [Module Description - What the module does and why it is useful](#module-description)\n3. [Setup - The basics of getting started with vcsrepo](#setup)\n    * [Setup requirements](#setup-requirements)\n    * [Beginning with vcsrepo](#beginning-with-vcsrepo)\n4. [Usage - Configuration options and additional functionality](#usage)\n    * [Git](#git)\n    * [Bazaar](#bazaar)\n    * [CVS](#cvs)\n    * [Mercurial](#mercurial)\n    * [Perforce](#perforce)\n    * [Subversion](#subversion)\n5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n    * [Type: vcsrepo](#type-vcsrepo)\n        * [Providers](#providers)\n        * [Features](#features)\n5. [Limitations - OS compatibility, etc.](#limitations)\n6. [License](#license)\n7. [Development - Guide for contributing to the module](#development)\n\n\u003ca id=\"overview\"\u003e\u003c/a\u003e\n## Overview\n\nThe vcsrepo module lets you use Puppet to easily deploy content from your version control system (VCS).\n\n\u003ca id=\"module-description\"\u003e\u003c/a\u003e\n## Module description\n\nThe vcsrepo module provides a single type with providers to support the following version control systems:\n\n* [Git](#git)\n* [Bazaar](#bazaar)\n* [CVS](#cvs)\n* [Mercurial](#mercurial)\n* [Perforce](#perforce)\n* [Subversion](#subversion)\n\n**Note**: This module does not have the functionality to purge or delete local changes on agent run.\n**Note:** `git` is the only vcs provider officially [supported by Puppet Inc.](https://forge.puppet.com/supported)\n**Note:** Release v4.0.1 has been removed from the Puppet Forge and was officially re-released as version v5.0.0 as it contained a breaking change.\nDetails available [here](https://puppetlabs.github.io/iac/team/status/developer/2021/06/04/status-update.html)\n\n\u003ca id=\"setup\"\u003e\u003c/a\u003e\n## Setup\n\n\u003ca id=\"setup-requirements\"\u003e\u003c/a\u003e\n### Setup requirements\n\nThe vcsrepo module does not install any VCS software for you. You must install a VCS before you can use this module.\n\nLike Puppet in general, the vcsrepo module does not automatically create parent directories for the files it manages. Set up any needed directory structures before you start.\n\n\u003ca id=\"beginning-with-vcsrepo\"\u003e\u003c/a\u003e\n### Beginning with vcsrepo\n\nTo create and manage a blank repository, define the type `vcsrepo` with a path to your repository and supply the `provider` parameter based on the [VCS you're using](#usage).\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n}\n~~~\n\n\u003ca id=\"usage\"\u003e\u003c/a\u003e\n## Usage\n\n**Note:** `git` is the only vcsrepo provider officially [supported by Puppet Inc.](https://forge.puppet.com/supported)\n\n\u003ca id=\"git\"\u003e\u003c/a\u003e\n### Git\n\n#### Create a blank repository\n\nTo create a blank repository suitable for use as a central repository, define `vcsrepo` without `source` or `revision`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n}\n~~~\n\nIf you're managing a central or official repository, you might want to make it a bare repository. To do this, set `ensure` to 'bare':\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e bare,\n  provider =\u003e git,\n}\n~~~\n\n#### Clone/pull a repository\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n}\n~~~\n\nTo clone your repository as bare or mirror, you can set `ensure` to 'bare' or 'mirror':\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e mirror,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n}\n~~~\n\nBy default, `vcsrepo` will use the HEAD of the source repository's main branch. To use another branch or a specific commit, set `revision` to either a branch name or a commit SHA or tag.\n\nBranch name:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e 'development',\n}\n~~~\n\nSHA:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n}\n~~~\n\nTag:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e '1.1.2rc1',\n}\n~~~\n\nTo check out a branch as a specific user, supply the `user` parameter:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n  user     =\u003e 'someUser',\n}\n~~~\n\nTo keep local changes while changing revision, use the `keep_local_changes`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure             =\u003e present,\n  provider           =\u003e git,\n  source             =\u003e 'git://example.com/repo.git',\n  revision           =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n  keep_local_changes =\u003e true,\n  user               =\u003e 'someUser',\n}\n~~~\n\nTo keep the repository at the latest revision, set `ensure` to 'latest'.\n**Note**: `keep_local_changes` works by stashing local changes, switching the repo to the assigned revision and, finally, unstashing the local changes.\nIt only comes into effect if the revision parameter is different from the local repo. This parameter DOES NOT delete/purge local changes by default on every run.\n\n**WARNING:** This overwrites any local changes to the repository.\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e 'main',\n}\n~~~\n\nTo clone the repository but skip initializing submodules, set `submodules` to 'false':\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure     =\u003e latest,\n  provider   =\u003e git,\n  source     =\u003e 'git://example.com/repo.git',\n  submodules =\u003e false,\n}\n~~~\n\nTo clone the repository and trust the server certificate (sslVerify=false), set `trust_server_cert` to 'true':\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure            =\u003e present,\n  provider          =\u003e git,\n  source            =\u003e 'git://example.com/repo.git',\n  trust_server_cert =\u003e true,\n}\n~~~\n\nTo use a specific umask, set `umask` to the desired value (expressed as a string of octal numbers); note that changes to umask do not retroactively affect repo files created earlier under a different umask. This is currently only implemented for the `git` provider. If unspecified, this will use the umask of the puppet process itself.\n\nExample to set shared group access:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  source   =\u003e 'git://example.com/repo.git',\n  revision =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n  umask    =\u003e '0002'\n}\n~~~\n\n#### Use HTTP or HTTPS proxies\n\nTo use an HTTP or HTTPS proxy, set `http_proxy` to the proxy URL. This is currently only implemented for the `git` provider.\n\n`git` uses libcurl, so proxying of HTTPS repo URLs uses the CONNECT method, which works with either an HTTP or HTTPS proxy (since libcurl 7.52.0).\n\nExample to use an HTTPS proxy:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure     =\u003e present,\n  provider   =\u003e git,\n  source     =\u003e 'https://example.com/repo.git',\n  http_proxy =\u003e 'https://proxy.example.com',\n  revision   =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n}\n~~~\n\nProxies can also be specified as a hash, keyed by remote, in which case vcsrepo will use the specified proxy for each remote that is used as a source (see the `source` parameter). For any source that does not have an `http_proxy` defined, no proxy will be used.\n\nExample to use per-remote HTTPS proxies use a proxy for github but not for other remotes:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure     =\u003e present,\n  provider   =\u003e git,\n  source     =\u003e {\n    origin =\u003e 'https://example.com/repo.git',\n    github =\u003e 'https://github.com/example/repo.git',\n  },\n  http_proxy =\u003e {\n    github =\u003e 'https://proxy2.example.com',\n  },\n  revision   =\u003e '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31',\n}\n~~~\n\nSpecification of proxies this way affects remote operations performed by vcsrepo, but does _not_ persist the proxy settings within either the per-user git configuration or the per-repo git configuration. This means that manual operations like `git fetch` and  `git pull` within vcsrepo-managed working copies will not use proxies. If you need such operations to use proxies, then you can instead configure git on a per-user or per-repository basis. Example instructions for configuring git for a user are here:\nhttps://gist.github.com/evantoli/f8c23a37eb3558ab8765\n\nFor per-repository configuration, use `--local` instead of `--global` for `git config` commands (or edit the `.git/config` file within each repo working copy).\n\n#### Use multiple remotes with a repository\n\nIn place of a single string, you can set `source` to a hash of one or more name =\u003e URL pairs:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e git,\n  remote   =\u003e 'origin'\n  source   =\u003e {\n    'origin'       =\u003e 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git',\n    'other_remote' =\u003e 'https://github.com/other_user/puppetlabs-vcsrepo.git'\n  },\n}\n~~~\n\n**Note:** If you set `source` to a hash, one of the names you specify must match the value of the `remote` parameter. That remote serves as the upstream of your managed repository.\n\n#### Connect via SSH\n\nTo connect to your source repository via SSH (such as 'username@server:…'), we recommend managing your SSH keys with Puppet and using the [`require`](http://docs.puppet.com/references/stable/metaparameter.html#require) metaparameter to make sure they are present before the `vcsrepo` resource is applied.\n\nTo use SSH keys associated with a user, specify the username in the `user` parameter:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e git,\n  source   =\u003e 'ssh://username@example.com/repo.git',\n  user     =\u003e 'toto', #uses toto's $HOME/.ssh setup\n  require  =\u003e File['/home/toto/.ssh/id_rsa'],\n}\n~~~\n\nTo use SSH over a nonstandard port, use the full SSH scheme and include the port number:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e git,\n  source   =\u003e 'ssh://username@example.com:7999/repo.git',\n}\n~~~\n\n#### Important changes in version 5\n\nPrior to version 5.0.0 `StrictHostKeyChecking` was implicitly disabled when using the `identity` parameter. This meant that ssh would automatically add new hosts to `~/.ssh/known_hosts`, letting most connections succeed.\n\n`StrictHostKeyChecking` has now been removed from the options passed to ssh which will result in ssh falling back to it's default, `ask`. **This could cause puppet runs to fail**.\n\nTo ensure a run completes successfully, you should add the hosts public key to the `known_hosts` before the `vcsrepo` resource is applied.\n\nYou can usually get the public key of an ssh host by running `ssh-keyscan`. Adding the result to your `known_hosts` file may look similar to this:\n\n~~~ bash\nssh-keyscan -t rsa github.com \u003e\u003e /home/me/.ssh/known_hosts\n~~~\n\nOnce everything is configured, you can continue to manage your repositories with ssh.\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e git,\n  source   =\u003e 'git@github.com:user/repo.git',\n  identity =\u003e '/home/me/.ssh/id_rsa',\n}\n~~~\n\n\u003ca id=\"bazaar\"\u003e\u003c/a\u003e\n### Bazaar\n\n#### Create a blank repository\n\nTo create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e bzr,\n}\n~~~\n\n#### Branch from an existing repository\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e bzr,\n  source   =\u003e '/some/path',\n}\n~~~\n\nTo branch from a specific revision, set `revision` to a valid [Bazaar revision spec](http://wiki.bazaar.canonical.com/BzrRevisionSpec):\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e bzr,\n  source   =\u003e '/some/path',\n  revision =\u003e 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x',\n}\n~~~\n\n#### Connect via SSH\n\nTo connect to your source repository via SSH (such as `'bzr+ssh://...'` or `'sftp://...,'`), we recommend using the [`require`](http://docs.puppet.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e bzr,\n  source   =\u003e 'bzr+ssh://bzr.example.com/some/path',\n  user     =\u003e 'toto', #uses toto's $HOME/.ssh setup\n  require  =\u003e File['/home/toto/.ssh/id_rsa'],\n}\n~~~\n\n\u003ca id=\"cvs\"\u003e\u003c/a\u003e\n### CVS\n\n#### Create a blank repository\n\nTo create a blank repository suitable for use as a central repository, define `vcsrepo` without `source` or `revision`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e cvs,\n}\n~~~\n\n#### Checkout/update from a repository\n\n~~~ puppet\nvcsrepo { '/path/to/workspace':\n  ensure   =\u003e present,\n  provider =\u003e cvs,\n  source   =\u003e ':pserver:anonymous@example.com:/sources/myproj',\n}\n~~~\n\nTo get a specific module on the current mainline, supply the `module` parameter:\n\n~~~ puppet\nvcsrepo { '/vagrant/lockss-daemon-source':\n  ensure   =\u003e present,\n  provider =\u003e cvs,\n  source   =\u003e ':pserver:anonymous@lockss.cvs.sourceforge.net:/cvsroot/lockss',\n  module   =\u003e 'lockss-daemon',\n}\n~~~\n\nTo set the GZIP compression levels for your repository history, use the `compression` parameter:\n\n~~~ puppet\nvcsrepo { '/path/to/workspace':\n  ensure      =\u003e present,\n  provider    =\u003e cvs,\n  compression =\u003e 3,\n  source      =\u003e ':pserver:anonymous@example.com:/sources/myproj',\n}\n~~~\n\nTo get a specific revision, set `revision` to the revision number.\n\n~~~ puppet\nvcsrepo { '/path/to/workspace':\n  ensure      =\u003e present,\n  provider    =\u003e cvs,\n  compression =\u003e 3,\n  source      =\u003e ':pserver:anonymous@example.com:/sources/myproj',\n  revision    =\u003e '1.2',\n}\n~~~\n\nYou can also set `revision` to a tag:\n\n~~~ puppet\nvcsrepo { '/path/to/workspace':\n  ensure      =\u003e present,\n  provider    =\u003e cvs,\n  compression =\u003e 3,\n  source      =\u003e ':pserver:anonymous@example.com:/sources/myproj',\n  revision    =\u003e 'SOMETAG',\n}\n~~~\n\n#### Connect via SSH\n\nTo connect to your source repository via SSH, we recommend using the [`require`](http://docs.puppet.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e cvs,\n  source   =\u003e ':pserver:anonymous@example.com:/sources/myproj',\n  user     =\u003e 'toto', #uses toto's $HOME/.ssh setup\n  require  =\u003e File['/home/toto/.ssh/id_rsa'],\n}\n~~~\n\n\u003ca id=\"mercurial\"\u003e\u003c/a\u003e\n### Mercurial\n\n#### Create a blank repository\n\nTo create a blank repository suitable for use as a central repository, define `vcsrepo` without `source` or `revision`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n}\n~~~\n\n#### Clone/pull and update a repository\n\nTo get the default branch tip:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n  source   =\u003e 'http://hg.example.com/myrepo',\n}\n~~~\n\nFor a specific changeset, use `revision`:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n  source   =\u003e 'http://hg.example.com/myrepo',\n  revision =\u003e '21ea4598c962',\n}\n~~~\n\nYou can also set `revision` to a tag:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n  source   =\u003e 'http://hg.example.com/myrepo',\n  revision =\u003e '1.1.2',\n}\n~~~\n\nTo check out as a specific user:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n  source   =\u003e 'http://hg.example.com/myrepo',\n  user     =\u003e 'user',\n}\n~~~\n\nTo specify an SSH identity key:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e hg,\n  source   =\u003e 'ssh://hg@hg.example.com/myrepo',\n  identity =\u003e '/home/user/.ssh/id_dsa1',\n}\n~~~\n\nTo specify a username and password for HTTP Basic authentication:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure              =\u003e latest,\n  provider            =\u003e hg,\n  source              =\u003e 'http://hg.example.com/myrepo',\n  basic_auth_username =\u003e 'hgusername',\n  basic_auth_password =\u003e 'hgpassword',\n}\n~~~\n\n**NOTE:** The sensitive `basic_auth_password` can be deferred using the [Deferred](https://www.puppet.com/docs/puppet/7/template_with_deferred_values.html) function on Puppet Master and enable to execute on agent.\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure              =\u003e latest,\n  provider            =\u003e hg,\n  source              =\u003e 'http://hg.example.com/myrepo',\n  basic_auth_username =\u003e 'hgusername',\n  basic_auth_password =\u003e Deferred('sprintf', ['hgpassword']),\n}\n~~~\n\n#### Connect via SSH\n\nTo connect to your source repository via SSH (such as `'ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppet.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e hg,\n  source   =\u003e 'ssh://hg.example.com//path/to/myrepo',\n  user     =\u003e 'toto', #uses toto's $HOME/.ssh setup\n  require  =\u003e File['/home/toto/.ssh/id_rsa'],\n}\n~~~\n\n\u003ca id=\"perforce\"\u003e\u003c/a\u003e\n### Perforce\n\n#### Create an empty workspace\n\nTo set up the connection to your Perforce service, set `p4config` to the location of a valid Perforce [config file](http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html#configuration.process.configfiles) stored on the node:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e p4,\n  p4config =\u003e '/root/.p4config'\n}\n~~~\n\n**Note:** If you don't include the `P4CLIENT` setting in your config file, the provider generates a workspace name based on the digest of `path` and the node's hostname (such as `puppet-91bc00640c4e5a17787286acbe2c021c`).\n\n#### Create/update and sync a Perforce workspace\n\nTo sync a depot path to head, set `ensure` to 'latest':\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e p4,\n  source   =\u003e '//depot/branch/...'\n}\n~~~\n\nTo sync to a specific changelist, specify its revision number with the `revision` parameter:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e p4,\n  source   =\u003e '//depot/branch/...',\n  revision =\u003e '2341'\n}\n~~~\n\nYou can also set `revision` to a label:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e p4,\n  source   =\u003e '//depot/branch/...',\n  revision =\u003e 'my_label'\n}\n~~~\n\n\u003ca id=\"subversion\"\u003e\u003c/a\u003e\n### Subversion\n\n#### Create a blank repository\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e svn,\n}\n~~~\n\n#### Check out from an existing repository\n\nProvide a `source` pointing to the branch or tag you want to check out:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e svn,\n  source   =\u003e 'svn://svnrepo/hello/branches/foo',\n}\n~~~\n\nYou can also designate a specific revision:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e svn,\n  source   =\u003e 'svn://svnrepo/hello/branches/foo',\n  revision =\u003e '1234',\n}\n~~~\n\n####Checking out only specific paths\n\n**Note:** The `includes` param is only supported when subversion client version is \u003e= 1.6.\n\nYou can check out only specific paths in a particular repository by providing their relative paths to the `includes` parameter, like so:\n\n~~~\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e present,\n  provider =\u003e svn,\n  source   =\u003e 'http://svnrepo/hello/trunk',\n  includes =\u003e [\n    'root-file.txt',\n    'checkout-folder',\n    'file/this-file.txt',\n    'folder/this-folder/',\n  ]\n}\n~~~\n\nThis will create files `/path/to/repo/file-at-root-path.txt` and `/path/to/repo/file/nested/within/repo.jmx`, with folders `/path/to/repo/some-folder` and `/path/to/repo/nested/folder/to/checkout` completely recreating their corresponding working tree path.\n\nWhen specified, the `depth` parameter will also be applied to the `includes` -- the root directory will be checked out using an `empty` depth, and the `includes` you specify will be checked out using the `depth` you provide.\n\nTo illustrate this point, using the above snippet (with the specified `includes`) and a remote repository layout like this:\n\n~~~\n.\n├── checkout-folder\n│   ├── file1\n│   └── nested-1\n│       ├── nested-2\n│       │   └── nested-file-2\n│       └── nested-file-1\n├── file\n│   ├── NOT-this-file.txt\n│   └── this-file.txt\n├── folder\n│   ├── never-checked-out\n│   └── this-folder\n│       ├── deep-nested-1\n│       │   ├── deep-nested-2\n│       │   │   └── deep-nested-file-2\n│       │   └── deep-nested-file-1\n│       └── this-file.txt\n├── NOT-this-file.txt\n├── NOT-this-folder\n│   ├── NOT-this-file.txt\n│   └── NOT-this-one-either.txt\n└── root-file.txt\n~~~\n\nWith no `depth` given, your local folder `/path/to/repo` will look like this:\n\n~~~\n.\n├── checkout-folder\n│   ├── file1\n│   └── nested-1\n│       ├── nested-2\n│       │   └── nested-file-2\n│       └── nested-file-1\n├── file\n│   └── this-file.txt\n├── folder\n│   └── this-folder\n│       ├── deep-nested-1\n│       │   ├── deep-nested-2\n│       │   │   └── deep-nested-file-2\n│       │   └── deep-nested-file-1\n│       └── this-file.txt\n└── root-file.txt\n~~~\n\nAnd with a `depth` of `files` will look like this:\n\n~~~\n.\n├── checkout-folder\n│   └── file1\n├── file\n│   └── this-file.txt\n├── folder\n│   └── this-folder\n│       └── this-file.txt\n└── root-file.txt\n~~~\n\n\n####Use a specific Subversion configuration directory \n\nUse the `configuration` parameter to designate the directory that contains your Subversion configuration files (typically, '/path/to/.subversion'):\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure        =\u003e present,\n  provider      =\u003e svn,\n  source        =\u003e 'svn://svnrepo/hello/branches/foo',\n  configuration =\u003e '/path/to/.subversion',\n}\n~~~\n\n#### Connect via SSH\n\nTo connect to your source repository via SSH (such as `'svn+ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppet.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied:\n\n~~~ puppet\nvcsrepo { '/path/to/repo':\n  ensure   =\u003e latest,\n  provider =\u003e svn,\n  source   =\u003e 'svn+ssh://svnrepo/hello/branches/foo',\n  user     =\u003e 'toto', #uses toto's $HOME/.ssh setup\n  require  =\u003e File['/home/toto/.ssh/id_rsa'],\n}\n~~~\n\n\u003ca id=\"reference\"\u003e\u003c/a\u003e \n## Reference\n\n\u003ca id=\"type-vcsrepo\"\u003e\u003c/a\u003e \n### Type: vcsrepo\n\nThe vcsrepo module adds only one type with several providers.\n\nFor information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-vcsrepo/blob/main/REFERENCE.md)\n\n\u003ca id=\"providers\"\u003e\u003c/a\u003e \n#### Providers\n\n**Note:** Not all features are available with all providers.\n\n##### `git` - Supports the Git VCS.\n\nFeatures: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `submodules`, `user`\n\nParameters: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user`\n\n##### `bzr` - Supports the Bazaar VCS.\n\nFeatures: `reference_tracking`\n\nParameters: `ensure`, `excludes`, `force`, `group`, `owner`, `path`, `provider`, `revision`, `source`\n\n##### `cvs` - Supports the CVS VCS.\n\nFeatures: `cvs_rsh`, `gzip_compression`, `modules`, `reference_tracking`, `user`\n\nParameters: `compression`, `cvs_rsh`, `ensure`, `excludes`, `force`, `group`, `module`, `owner`, `path`, `provider`\n\n##### `hg` - Supports the Mercurial VCS.\n\nFeatures: `reference_tracking`, `ssh_identity`, `user`\n\nParameters: `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `revision`, `source`, `user`\n\n##### `p4` - Supports the Perforce VCS.\n\nFeatures: `p4config`, `reference_tracking`\n\nParameters: `ensure`, `excludes`, `force`, `group`, `owner`, `p4config`, `path`, `provider`, `revision`, `source`\n\n##### `svn` - Supports the Subversion VCS.\n\nFeatures: `basic_auth`, `configuration`, `conflict`, `depth`, `filesystem_types`, `reference_tracking`\n\nParameters: `basic_auth_password`, `basic_auth_username`, `configuration`, `conflict`, `ensure`, `excludes`, `force`, `fstype`, `group`, `includes`, `owner`, `path`, `provider`, `revision`, `source`, `trust_server_cert`\n\n\u003ca id=\"features\"\u003e\u003c/a\u003e \n#### Features\n\n**Note:** Not all features are available with all providers.\n\n* `bare_repositories` - Differentiates between bare repositories and those with working copies. (Available with `git`.)\n* `basic_auth` - Supports HTTP Basic authentication. (Available with `hg` and `svn`.)\n* `conflict` - Lets you decide how to resolve any conflicts between the source repository and your working copy. (Available with `svn`.)\n* `configuration` - Lets you specify the location of your configuration files. (Available with `svn`.)\n* `cvs_rsh` - Understands the `CVS_RSH` environment variable. (Available with `cvs`.)\n* `depth` - Supports shallow clones in `git` or sets the scope limit in `svn`. (Available with `git` and `svn`.)\n* `filesystem_types` - Supports multiple types of filesystem. (Available with `svn`.)\n* `gzip_compression` - Supports explicit GZip compression levels. (Available with `cvs`.)\n* `include_paths` - Lets you checkout only certain paths. (Available with `svn`.)\n* `modules` - Lets you choose a specific repository module. (Available with `cvs`.)\n* `multiple_remotes` - Tracks multiple remote repositories. (Available with `git`.)\n* `reference_tracking` - Lets you track revision references that can change over time (e.g., some VCS tags and branch names). (Available with all providers)\n* `ssh_identity` - Lets you specify an SSH identity file. (Available with `git` and `hg`.)\n* `user` - Can run as a different user. (Available with `git`, `hg` and `cvs`.)\n* `p4config` - Supports setting the `P4CONFIG` environment. (Available with `p4`.)\n* `submodules` - Supports repository submodules which can be optionally initialized. (Available with `git`.)\n\n\u003ca id=\"limitations\"\u003e\u003c/a\u003e\n## Limitations\n\nGit is the only VCS provider officially [supported by Puppet Inc.](https://forge.puppet.com/supported) Git with 3.18 changes the maximum enabled TLS protocol version, this breaks some HTTPS functionality on older operating systems. They are Enterprise Linux 5 and OracleLinux 6.\n\nThe includes parameter is only supported when SVN client version is \u003e= 1.6.\n\nFor an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-vcsrepo/blob/main/metadata.json)\n\n### Response to CVE-2022-24765\n\nThe vulnerability described in this CVE could impact users working on multi-user machines.\nA malicious actor could create a `.git` directory above the current working directory causing all git invocations to occur outside of a repository to read its configuration.\n\nFor a more in-depth description of this vulnerability, check out [this blog post](https://github.blog/2022-04-12-git-security-vulnerability-announced/).\n\nFixes were released in Git versions 2.35.2 and 1:2.25.1-1ubuntu3.4 respectively.\n\nVCSRepo users were impacted when running newer versions of Git and managing repositories that were owned by a user or group that differed from the user executing Git.\n\nFor example, setting the `owner` parameter on a resource would cause Puppet runs to fail with a `Path /destination/path exists and is not the desired repository.` error.\n\nImpacted users are now advised to use the new `safe_directory` parameter on Git resources.\nExplicitily setting the value to `true` will add the current path specified on the resource to the `safe.directory` git configuration for the current user (global scope) allowing the Puppet run to continue without error.\n\nSafe directory configuration will be stored within the system wide configuration file `/etc/gitconfig`.\n\n\u003ca id=\"license\"\u003e\u003c/a\u003e\n## License\n\nThis codebase is licensed under the Apache2.0 licensing, however due to the nature of the codebase the open source dependencies may also use a combination of [AGPL](https://opensource.org/license/agpl-v3/), [BSD-2](https://opensource.org/license/bsd-2-clause/), [BSD-3](https://opensource.org/license/bsd-3-clause/), [GPL2.0](https://opensource.org/license/gpl-2-0/), [LGPL](https://opensource.org/license/lgpl-3-0/), [MIT](https://opensource.org/license/mit/) and [MPL](https://opensource.org/license/mpl-2-0/) Licensing.\n\n\u003ca id=\"development\"\u003e\u003c/a\u003e \n## Development\n\nPuppet Inc. 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.\n\nWe 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.\n\nYou can read the complete module contribution guide [on the Puppet documentation site.](https://docs.puppet.com/guides/module_guides/bgtm.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-vcsrepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-vcsrepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-vcsrepo/lists"}