This repo allows a user to pull a project and all its submodules though the github API.
##configs.cfg To get started, replace the values in configs.cfg.
####external_token A token to a user on github enterprise. Creating this read only would be a good idea, since this code never needs to write anything.
Read more about creating OAUTH tokens here
Read more about robot users here
####internal_token Same as above, but for an internal GHE instance
####internal_url This is a URL as it is passed to the github3.py library. If your GHE instance is code.lan, the URL would look like http://code.lan
##Constraints
-The initial repository, and all submodules must be on a github instance
-Both keys need to be able to read any repo that gets specified. This should not be an issue, because you probably are not making submodules of private repos that your key cant reach.
##Docker I reccomend running the docker with:
--dns so it can see your GHE instance
-d so its disconnected
-p **:8080 so it can grab a port on the host
--name ghrc##General process
- grab the repo
- determine with GH its on
- download
- extract it in place
- parse its .gitmodules file
- for each module, get its URL and current sha, repeat
##JSON input: Its currently triggered by sending JSON formated data, specifying the URL and the sha that you are looking for. For example
{
"URL":"git@github.com:paparazzi/paparazzi.git",
"sha":"22ca42632644f7dd90ab79e0e8a5a737316a94b3"
}
##Curl Examples Some examples where we assume this code is running on http://ghrc:8080/ghrc
# Basic curl with JSON on the command line
curl -H "Content-Type: application/json" -d '{"URL":"", "sha":"40chars"}' http://ghrc:8080/ghrc -o repo.tar.gz
# Basic curl with json stored in a file
curl -H "Content-Type: application/json" -d @master.json http://ghrc:8080/ghrc -o repo.tar.gz
# In the case of error, -f tells curl to return nonzero, and create no output
curl -f -H "Content-Type: application/json" -d @master.json http://ghrc:8080/ghrc -o repo.tar.gz