Skip to content

Instantly share code, notes, and snippets.

@johnbuhay
Last active August 29, 2015 14:23
Show Gist options
  • Save johnbuhay/20a99587e485cb33cb9e to your computer and use it in GitHub Desktop.
Save johnbuhay/20a99587e485cb33cb9e to your computer and use it in GitHub Desktop.
Particularly fond of these useful one liners:
# Get a version from a json:
REMOTE_VERSION=$(curl -s URL_THAT_RETURNS_JSON|python -c 'import json,sys;obj=json.load(sys.stdin);print obj["version"]')
# Get latest version from Artifactory:
REMOTE_VERSION=$(curl -s http://{{artifactory_integration_host}}:8081/artifactory/api/npm/libs-npm-virtual/ww-node-configs/latest|python -c 'import json,sys;obj=json.load(sys.stdin);version = "0.0.0" if obj.get("version") is None else obj["version"];print version')
# To stop a job in jenkins if this build is not for a newer version:
python -c 'import sys; exit(0) if sys.argv[1] > sys.argv[2] else exit(1)' $LOCAL_VERSION $REMOTE_VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment