Access Github and Bitbucket - hqzhang/cloudtestbed GitHub Wiki

Access github and bitbucket can use git/curl/api/ etc.

##Get file content

curl https://raw.githubusercontent.com/hqzhang/cloudtestbed/master/ansible/hello.yml
curl https://bitbucket.org/wave-cloud/groovytest/raw/master/vars/Utils.groovy
mast can be commit id.

##Get file List

github:  curl https://api.github.com/repos/${repo}/git/trees/${brch}?recursive=2
bitbucket: curl https://api.bitbucket.org/2.0/repositories/${repos}/src/\${branch}/${folder}".execute().text
         curl https://bitbucket.org/rest/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/files/{path}?at=refs/heads/{branchName}

##Get branch List

def out = "git ls-remote --heads ${repo}".execute().text    

##Get branch Commitid

branch="git ls-remote https://[email protected]/hqzhang/solution-repo.git -b ${brch}".execute().text.substring(0,40)