Git DM Handler
This page describes accessing and configuring a git DM Handler integration.
Installation
The mdx_piextra installation package, available at PiExtras Examples, includes a directory "custom_dm/gitcdm" containing scripts to add git as a supported data management tool inside the Perforce IPLM platform.
After installation the "pi ip load", "pi ip diff", "pi update", and "pi release" commands can interact with git based IPs.
The "src" directory contains example code for a custom git DMTYPE hook. The binary "bin/gitcdm" can be registered in Percient via "pi dm add" as a GITCMD (git custom DM type) type, and then used when creating new IP via "pi ip add".
As repo path a fully qualified git clone URL should be provided.
Assumptions
- The "
git" and "pi" executables are available in $PATH - The hook does not provide interactive response, so clones should likely be done via ssh protocol, which must configured via password-less ssh keys, and the server key should already have been accepted.
- A proper "
~/.gitconfig"has been created for each user, with a valid user.name and user.email setting. - When adding this Git DM Handler type via "
pi dm add", the value for "repo_path_required" should be "true".
Recommendations
- A proper git server should have already been setup and configured. Examples are
- Preferably group git repositories, for example into organizations or projects, to provide the equivalent of Perforce IPLM Libraries
- Configure and deploy git via ssh, upload users ~/.ssh/id_rsa.pub automatically, and setup a good ~/.gitconfig so usernames and emails match
- When dealing with with firewalls or http caching features, git via http might perform better than ssh
Debugging
The hook provides some debug logging, which can be enabled via setting the environment variable "export GITCDM_LOG=~/gitcdm.log". These log files can be viewed via "tail -f ~/gitcdm.log | jq -S".
Testcase
There's an example script "gitcdm_test.py", with a wrapper "gitcdm_test.sh", which can be modified to create a testing setup.
- The "
PYTHON_EXE" line of "gitcdm_test.sh" must point to a valid python installation, for example the one supplied with mdx-picli (/usr/share/mdx/products/piclient/local/bin/python2.7) - The "
git" and "pi" executables are available in $PATH - It assumes that there is a git server available in line 154, this will need to be modified to your particular setup
- It assumes there's a Library called "
drinks". - It will register a new GITCDM dmtype, and create a new IP "
drinks.scotch"which can be used for testing purposes - After modifications you can create the testcase via "
./gitcdm_test.sh create" - To remove the testcase data you can run "
./gitcdm_test.sh remove"