def POST(self): ''' Method: post ''' try: try: data = web.data() build_info = utils.json_load_to_str(data) log.debug("build info: %s" % build_info) except Exception, e: log.error(e) raise UnableParsePostDataError # update status dbopts = SQLAdaptor() # commit_id = dbopts.SetBuildStatus(build_info) # if all results are failures, send email to commitor # phase_id, failure_list, commit_id = dbopts.CheckBuildFailures(build_info) if failure_list: if not opts.SendEmailToCommitor(build_info, commit_id): dbopts.SetCommitStatus(commit_id, 10) else: dbopts.SetCommitStatus(commit_id, 4) elif (not failure_list) and (phase_id == 3): dbopts.SetCommitStatus(commit_id, 1) else: dbopts.SetCommitStatus(commit_id, 3) return HTTPAdaptor.format_response("ok", "003", "Update status based on CI")
def POST(self): try: #@Step 1: Parse commit info try: data = web.data() callback = utils.json_load_to_str(data) log.debug("callback: %s" % callback) uuid = callback["uuid"] txn = callback["transaction"] status = callback["status"] except Exception, e: log.error(e) raise UnableParsePostDataError dbopts = SQLAdaptor() dbopts.UpdateStatusByTxn(uuid, txn, status) return HTTPAdaptor.format_response("ok", "00", "Jobs are triggered. Please wait for the response.")
def POST(self): ''' Method:post ''' try: #@Step 1: Parse commit info try: data = web.data() commit_info = utils.json_load_to_str(data) commit_info = opts.FormatChangeSet(commit_info) log.debug("commit info: %s" % commit_info) except Exception, e: log.error(e) raise UnableParsePostDataError #@Step 2: Check author info if not opts.CheckAuthorInfo(commit_info["author"]): return HTTPAdaptor.format_response("pass", "001", "No authors available.") # log.error(NoAuthorFoundError.message) # raise NoAuthorFoundError #@Step 3: Check jobs needed to be triggerred jobs = opts.GetJobs(commit_info) if not jobs: log.warning(NoValidJobFoundError().message) return HTTPAdaptor.format_response("pass", "001", "No tests can be executed.") #@Step 4: Insert commit info dbopts = SQLAdaptor() dbopts.InsertCommitInfo(commit_info) dbopts.InsertJobInfo(jobs) log.debug("set status id to :%s" % 7) #@Step 5: Trigger jobs opts.TriggerJobs(jobs) return HTTPAdaptor.format_response("ok", "003", "Jobs are triggered. Please wait for the response.")
def POST(self): ''' Method: post ''' try: try: data = web.data() build_info = utils.json_load_to_str(data) log.debug("build info: %s" % build_info) except Exception, e: log.error(e) raise UnableParsePostDataError # update status dbopts = SQLAdaptor() # commit_id = dbopts.SetBuildStatus(build_info) # if all results are failures, send email to commitor # phase_id, failure_list, commit_id = dbopts.CheckBuildFailures( build_info) if failure_list: if not opts.SendEmailToCommitor(build_info, commit_id): dbopts.SetCommitStatus(commit_id, 10) else: dbopts.SetCommitStatus(commit_id, 4) elif (not failure_list) and (phase_id == 3): dbopts.SetCommitStatus(commit_id, 1) else: dbopts.SetCommitStatus(commit_id, 3) return HTTPAdaptor.format_response("ok", "003", "Update status based on CI")