Package: gitshelf
# gitshelf - a shelf full of git reposManage a collection of git repos that you don't want to manage as sub-modulesCreated to be used to manage a set of salt states, formula & pillars in a controlled fashion, the default config file is a YAML file that can also be loaded as a pillar (for whatever reason).Using the branch parameter, you can pin a repo to a branch, sha1, tag, whatever you need to keep it at your known good version.Also supports creating symlinks for you.## Installgitshelf is published on pypi [here](https://pypi.python.org/pypi/gitshelf), so you can install from pypi using pip:pip install gitshelfYou can also install from the github repo:pip install git+http://github.com/gitshelf/gitshelfWe use the python [sh](https://pypi.python.org/pypi/sh) sub process interface to work with git repos, so you'll need a standard git cli install, if you don't know how to do that, this might be the wrong tool for you.## UsageHere's a sample gitshelf.ymlbooks:- book: "srv/salt/state/base"git: "ssh://deploy-user@internal-git-repo-server/salt/state-base"- book: "srv/salt/state/sudoers-formula"git: "https://github.com/saltstack-formulas/sudoers-formula.git"## Pillars, an example of using a specific branch- book: "srv/salt/pillar/base"git: "ssh://deploy-user@internal-git-repo-server/salt/pillar-base"branch: "staging"- book: srv/salt/pillar/base/top.slslink: some/link/target.sls### Create the required clones$ gitshelf install### Check for repo driftRun `git status` against each repo, reporting drift$ gitshelf status### Discover all the reposCrudely create a gitshelf.yml for the current directory, recurses down through the directory looking for git repos (by looking for .git/config) and symlinks:$ gitshelf discoverbooks:- book: srv/salt/pillar/basegit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-core/salt-openstack/pillar-basebranch: 7a46de1c2b666dda2c37ee9183ef28c0a4b0f82d- book: srv/salt/pillar/env/someplacelink: ../../base- book: srv/salt/state/basegit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-core/salt-openstack/state-basebranch: dbfb89908011bb9e177dd3ceac0369e3ca884937- book: srv/salt/state/beaver-formulagit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-share/salt/beaver-formula.gitbranch: 0d00d407cef62bcc4e9a2fe8e7d5b21aebdddaa3- book: srv/salt/state/dbaas_state_envgit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-core/salt-openstack/dbaas_state_envbranch: 9bbe4bd94951aa5c47f17efe5fedcc230551e8d1- book: srv/salt/state/elasticsearch-formulagit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-share/salt/elasticsearch-formula.gitbranch: 36252f32d48a54c598c9d52b011ec8b7625d164c- book: srv/salt/state/logstash-formulagit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-share/salt/logstash-formula.gitbranch: ef246438c2aeb7f9d934409191edd7dc1ebf904eOr use the branch name instead of the SHA1:$ gitshelf discover --use-branchbooks:- book: srv/salt/pillar/basegit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-core/salt-openstack/pillar-basebranch: ae1az1- book: srv/salt/pillar/env/someplacelink: ../../base- book: srv/salt/state/basegit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-core/salt-openstack/state-basebranch: master- book: srv/salt/state/beaver-formulagit: ssh://simonm@gerrit.paas.hpcloud.net:29418/paas-share/salt/beaver-formula.gitbranch: master### Tokens & Environmentsgitshelf supports token replacement in the `gitshelf.yml`:defaults:environment: devenvironments:prod:description: "Prod deploy kit, use the r/o git mirror"tokens:giturlbase: "https://paas-core-salt-ae1@gerrit.paas.hpcloud.net"dev:description: "dev deploy kit, use the gerrit repo"tokens:giturlbase: "ssh://simonm@gerrit.paas.hpcloud.net:29418"books:- book: "/srv/salt/state/formulae/beaver"git: "{giturlbase}/paas-share/salt/beaver-formula"branch: 'b3032ff60bbfc77472f79f621b214d0393963796'You can specify the environment to use using the `--environment` option:gitshelf install --environment prodTODO: Add support for specifying a token on the command line## Developmentpbr introduces some weirdness under virtualenv, so we use the site packages to help makesure pbr doesn't break everything.virtualenv --system-site-packages .venv && . .venv/bin/activate && python setup.py develop# hack## publishing a new versionbuild & upload to pypi in a single hit:git tag -s 0.0.xpython setup.py sdist upload