本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.GetStatus方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.GetStatus方法的具體用法?Golang MungeObject.GetStatus怎麽用?Golang MungeObject.GetStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.MungeObject
的用法示例。
在下文中一共展示了MungeObject.GetStatus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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)
}
示例2: Munge
// Munge is the workhorse the will actually make updates to the PR
func (PingCIMunger) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
if !obj.HasLabel("lgtm") {
return
}
mergeable, err := obj.IsMergeable()
if err != nil {
glog.V(2).Infof("Skipping %d - problem determining mergeability", *obj.Issue.Number)
return
}
if !mergeable {
glog.V(2).Infof("Skipping %d - not mergeable", *obj.Issue.Number)
return
}
if status, err := obj.GetStatus([]string{jenkinsCIContext, travisContext}); err == nil && status != "incomplete" {
glog.V(2).Info("Have %s status - skipping ping CI", jenkinsCIContext)
return
}
status, err := obj.GetStatus([]string{shippableContext, travisContext})
if err != nil {
glog.Errorf("unexpected error getting status: %v", err)
return
}
if status == "incomplete" {
msg := "Continuous integration appears to have missed, closing and re-opening to trigger it"
obj.WriteComment(msg)
obj.ClosePR()
time.Sleep(5 * time.Second)
obj.OpenPR(10)
}
}
示例3: requiredStatusContexts
func (sq *SubmitQueue) requiredStatusContexts(obj *github.MungeObject) []string {
contexts := sq.RequiredStatusContexts
// If the pr has a jenkins ci status, require it, otherwise require shippable
if status, err := obj.GetStatus([]string{jenkinsCIContext}); err == nil && status != "incomplete" {
contexts = append(contexts, jenkinsCIContext)
} else {
contexts = append(contexts, shippableContext)
}
return contexts
}
示例4: Munge
// Munge is the workhorse the will actually make updates to the PR
func (OkToTestMunger) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
if !obj.HasLabel("lgtm") {
return
}
status, err := obj.GetStatus([]string{"Jenkins GCE e2e"})
if err != nil {
glog.Errorf("unexpected error getting status: %v", err)
return
}
if status == "incomplete" {
glog.V(2).Infof("status is incomplete, adding ok to test")
msg := `@k8s-bot ok to test
pr builder appears to be missing, activating due to 'lgtm' label.`
obj.WriteComment(msg)
}
}