You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.1 KiB

# encoding: utf-8
import task
import tools
import sys
import os
from pathlib import Path
class CIProcess():
def __init__(self, webhook, p4path, msg):
self.webhook = webhook
self.p4path = p4path
self.msg = msg
def Run(self):
p4_number, p4_author = tools.GetP4Info(self.p4path)
job_name = os.getenv('JOB_NAME')
build_url = os.getenv('BUILD_URL')
content = "<font color=\"red\">{}</font> {} p4提交号:<font color=\"red\">{}</font> 提交者:@<font color=\"red\">{}</font> [点击查看日志!]({}/consoleFull)".\
format(job_name, self.msg, p4_number, p4_author, build_url)
tools.SendRobot(self.webhook, content)
return 0
if __name__ == '__main__':
if (3 > len(sys.argv)):
print("ERROR: args not enoug!")
os._exit(-1)
webhook = sys.argv[1]
p4path = sys.argv[2]
msg = sys.argv[3]
print(webhook)
print(p4path)
print(msg)
process = CIProcess(webhook, p4path, msg)
# ret = task.Start(10, process)
ret = process.Run()
print("ret:%d" % ret)
os._exit(ret)