本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.SetStatus方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.SetStatus方法的具體用法?Golang MungeObject.SetStatus怎麽用?Golang MungeObject.SetStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.MungeObject
的用法示例。
在下文中一共展示了MungeObject.SetStatus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SetMergeStatus
// SetMergeStatus will set the status given a particular PR. This function should
// be used instead of manipulating the prStatus directly as sq.Lock() must be
// called when manipulating that structure
// `obj` is the active github object
// `reason` is the new 'status' for this object
func (sq *SubmitQueue) SetMergeStatus(obj *github.MungeObject, reason string) {
glog.V(4).Infof("SubmitQueue not merging %d because %q", *obj.Issue.Number, reason)
submitStatus := submitStatus{
Time: sq.clock.Now(),
statusPullRequest: *objToStatusPullRequest(obj),
Reason: reason,
}
status := obj.GetStatus(sqContext)
if status == nil || *status.Description != reason {
state := reasonToState(reason)
url := fmt.Sprintf("http://submit-queue.k8s.io/#/prs/?prDisplay=%d&historyDisplay=%d", *obj.Issue.Number, *obj.Issue.Number)
_ = obj.SetStatus(state, url, reason, sqContext)
}
sq.Lock()
defer sq.Unlock()
// If we are currently retesting E2E the normal munge loop might find
// that the ci tests are not green. That's normal and expected and we
// should just ignore that status update entirely.
if sq.githubE2ERunning != nil && *sq.githubE2ERunning.Issue.Number == *obj.Issue.Number && reason == ciFailure {
return
}
if sq.onQueue(obj) {
sq.statusHistory = append(sq.statusHistory, submitStatus)
if len(sq.statusHistory) > 128 {
sq.statusHistory = sq.statusHistory[1:]
}
}
sq.prStatus[strconv.Itoa(*obj.Issue.Number)] = submitStatus
sq.cleanupOldE2E(obj, reason)
}