Last active
December 10, 2015 19:29
-
-
Save eiyaya/4481959 to your computer and use it in GitHub Desktop.
get info from jenkis
This file contains 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 json,sys,os | |
import urllib2 | |
url = 'http://10.6.198.114/job/BaseIM_basicim4ml/lastBuild/api/json' | |
try: | |
u = urllib2.urlopen(url).read() | |
except: | |
exit(0) | |
try: | |
baseim = json.loads(u) | |
baseim_revision = baseim["changeSet"]['revisions'][0]['revision'] | |
print baseim_revision | |
revision_with_baseim = ">%s-BASEIM-%s<" % (os.environ['SVN_REVISION'],baseim_revision) | |
new_rules = [] | |
with open("custom_rules.xml") as f: | |
for line in f: | |
new_rules.append(line.replace('>${env.SVN_REVISION}<',revision_with_baseim)) | |
print "".join(new_rules) | |
with open("custom_rules.xml","w") as f: | |
f.write("".join(new_rules)) | |
except: | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment