1 Star 0 Fork 0

passionboyxie/toutiao

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qrcode.py 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
passionboyxie 提交于 2020-10-26 18:15 . add some codes
import jenkins
job_name = "ec-oneapp"
"""
"""
class Jenkins_Api:
def __init__(self, username='', password=''):
self._url = 'http://10.128.43.56:8080/'
self._username = username
self._password = password
self.get_server = jenkins.Jenkins(self._url) # username=self._username, password=self._password)
def get_version(self):
return self.get_server.get_version()
def get_jobs(self):
return self.get_server.get_jobs()
def get_jobs_count(self):
return self.get_server.jobs_count()
def get_job_config(self, job_name):
return self.get_server.get_job_config(job_name)
def create_job(self, job_name, config_xml):
return self.get_server.create_job(job_name, config_xml)
def copy_job(self, job_name, new_job_name):
return self.get_server.copy_job(job_name, new_job_name)
def delete_job(self, job_name):
return self.get_server.delete_job(job_name)
def build_job(self, job_name):
return self.get_server.build_job(job_name)
def get_job_info(self, job_name):
return self.get_server.get_job_info(job_name)
def get_job_number(self, job_name):
return self.get_server.get_job_info(job_name)['lastCompletedBuild']['number']
def get_build_info(self, job_name, number):
return self.get_server.get_build_info(job_name, number)
def get_views(self):
return self.get_server.get_views()
import jsonpath
api = Jenkins_Api()
number = api.get_job_number(job_name)
print("The last number is {}".format(number))
build = api.get_build_info(job_name, number)
branch = jsonpath.jsonpath(build, '$.actions..parameters')
author = jsonpath.jsonpath(build, '$.actions..userName')
buildinfo = {}
buildinfo["url"] = build['url']
buildinfo["author"] = author
for x in branch[0]:
buildinfo[x['name']] = x['value']
print(buildinfo)
# if build['url'] != "":
#
# print("...start to open url...")
#
# import webbrowser as web
#
# web.open(build['url'], new=0, autoraise=True) # new:0/1/2 0:同一浏览器窗口打开 1:打开浏览器新的窗口,2:打开浏览器窗口新的tab
# # #autoraise=True:窗口自动增长
# # web.open_new("")
# # web.open_new_tab("")
# else:
# print("no url found!")
build_url = build['url'] + r"artifact/Export/{}/Smart%20English.ipa".format(buildinfo['PARAM_ENVIRONMENT'])
print(build_url)
import requests
import json
rainbow="http://10.128.43.56:8181/products/E790FA8D-86C8-4C28-A2AD-86CD8792969F/builds"
r = requests.get(rainbow)
content = r.json()
result = content["builds"]
from operator import itemgetter
import time
for x in result:
x['uploaded_at']= time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(x['uploaded_at']))
print(json.dumps(result,indent=4))
with open ("/Users/anderson/Downloads/bridge.json","w+") as f:
f.write(json.dumps(result,indent=4))
url =result[0]["manifest_url"].replace("manifests","packages").replace("manifest.plist","package.ipa")
print(url)
print(result[0]["app_version"])
print(result[0]["branch"])
print(result[0]["configuration"])
print(result[0]["commit_number"])
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/passionboyxie/toutiao.git
git@gitee.com:passionboyxie/toutiao.git
passionboyxie
toutiao
toutiao
master

搜索帮助