代码拉取完成,页面将自动刷新
同步操作将从 anolis/anolis-jenkins 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/env python3
# coding=utf-8
import base64
import argparse
import re
import requests
import time
import json
parser = argparse.ArgumentParser(description="T-One job parser")
parser.add_argument("--username", required=True, type=str)
parser.add_argument("--token", required=True, type=str)
parser.add_argument("--workspace", required=True, type=str)
parser.add_argument("--template", required=True, type=str)
parser.add_argument("--rpms", required=True, type=str)
parser.add_argument("--name", required=True, type=str)
parser.add_argument("--project", required=True, type=str)
parser.add_argument("--rpminstall", default=True, type=bool)
parser.add_argument("--webpath", required=True, type=str)
parser.add_argument("--version", required=True, type=str)
config = parser.parse_args()
url = "https://tone.openanolis.cn/api/job/create/"
token = config.username + '|' + config.token + '|' + str(time.time())
signature = base64.b64encode(token.encode('utf-8')).decode('utf-8')
def rpm_info(rpms):
rpms = rpms.split("\n")
kernel_info = {}
rpm_info = []
for rpm in rpms:
if re.match('kernel-%s' % config.version, rpm) and 'src.rpm' not in rpm:
kernel_info['kernel'] = config.webpath + rpm
if re.match('kernel-devel', rpm):
kernel_info['devel'] = config.webpath + rpm
if re.match('kernel-headers', rpm):
kernel_info['headers'] = config.webpath + rpm
if re.match('kernel-debuginfo', rpm) or re.match('kernel-core', rpm) or re.match('kernel-modules', rpm):
rpm_info.append({'pos': 'before', 'rpm': config.webpath+rpm})
return kernel_info, rpm_info
kernel_info, rpm_info = rpm_info(config.rpms)
print(kernel_info)
print(rpm_info)
data = {
'name': config.name,
'username': config.username,
'signature': signature,
'workspace': config.workspace,
'template': config.template,
'project': config.project,
'kernel_info': kernel_info
}
if config.rpminstall:
data['rpm_info'] = rpm_info
print(data)
data_json=json.dumps(data)
result = requests.post(url=url, data=data_json, verify=False)
print(result.text)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。