Last active
August 29, 2015 14:25
-
-
Save vsudilov/e61a170ae8d55f6efc55 to your computer and use it in GitHub Desktop.
Fetch latest commit from target repo on github, check if that image is on dockerhub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import argparse | |
API_ENDPOINT = "https://api.github.com/repos/adsabs/{repo}/branches/master" | |
DOCKERHUB = "https://registry.hub.docker.com/v1/repositories/adsabs/{repo}/tags" | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
"--repos", | |
nargs='*', | |
dest='repos', | |
) | |
args = parser.parse_args() | |
for repo in args.repos: | |
hash = requests.get(API_ENDPOINT.format(repo=repo)).json()['commit']['sha'] | |
tags = [i['name'] for i in requests.get(DOCKERHUB.format(repo=repo)).json()] | |
print "{}\t\t{}\t\t{}".format(repo, hash, hash in tags) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment