Created
June 13, 2017 20:04
-
-
Save niedbalski/56ea832139812d9309c01a09fddf36f2 to your computer and use it in GitHub Desktop.
Check if the latest published artifact on charmstore matches with current github tip for a given branch
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
| function charmislatest() { | |
| if [ ! ${#@} -ge 2 ]; then | |
| echo -e "Please provide a charm name and a branch" && return; | |
| fi | |
| q=$(curl -s https://api.github.com/repos/openstack/charm-$1/commits/stable/$2 | python -c "import sys, json; q=json.load(sys.stdin); print q['sha']") | |
| head=$(curl -s https://api.jujucharms.com/charmstore/v5/$1/meta/extra-info | python -c "import sys, json; q=json.load(sys.stdin)['vcs-revisions'][-1]; print q['commit'];") | |
| if [ "$head" == "$q" ]; then | |
| echo "OK - $1 (Charmstore: $head == Github($2): $q)" | |
| else | |
| echo "Not OK - Charm is not latest: $q != $head" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment