當前位置: 首頁>>代碼示例>>Golang>>正文


Golang MungeObject.GetStatusState方法代碼示例

本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.GetStatusState方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.GetStatusState方法的具體用法?Golang MungeObject.GetStatusState怎麽用?Golang MungeObject.GetStatusState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在k8s/io/contrib/mungegithub/github.MungeObject的用法示例。


在下文中一共展示了MungeObject.GetStatusState方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Munge

// Munge is the workhorse the will actually make updates to the PR
func (StalePendingCI) Munge(obj *github.MungeObject) {
	requiredContexts := []string{jenkinsUnitContext, jenkinsE2EContext}

	if !obj.IsPR() {
		return
	}

	if !obj.HasLabel(lgtmLabel) {
		return
	}

	if mergeable, err := obj.IsMergeable(); !mergeable || err != nil {
		return
	}

	status := obj.GetStatusState(requiredContexts)
	if status != "pending" {
		return
	}

	for _, context := range requiredContexts {
		statusTime := obj.GetStatusTime(context)
		if statusTime == nil {
			glog.Errorf("%d: unable to determine time %q context was set", *obj.Issue.Number, context)
			return
		}
		if time.Since(*statusTime) > stalePendingCIHours*time.Hour {
			obj.WriteComment(pendingMsgBody)
			return
		}
	}
}
開發者ID:danehans,項目名稱:contrib,代碼行數:33,代碼來源:stale-pending-ci.go

示例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 state := obj.GetStatusState([]string{jenkinsCIContext, travisContext}); state != "incomplete" {
		glog.V(2).Info("Have %s status - skipping ping CI", jenkinsCIContext)
		return
	}
	state := obj.GetStatusState([]string{shippableContext, travisContext})
	if state == "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)
	}
}
開發者ID:TheMarloGroup,項目名稱:contrib,代碼行數:32,代碼來源:ping_ci.go

示例3: Munge

// Munge is unused by this munger.
func (cla *ClaMunger) Munge(obj *githubhelper.MungeObject) {
	if !obj.IsPR() {
		return
	}

	if obj.HasLabel(claHumanLabel) {
		return
	}

	status := obj.GetStatusState([]string{cla.CLAStatusContext})

	// Check for pending status and exit.
	if status == contextPending {
		// do nothing and wait for state to be updated.
		return
	}

	if status == contextSuccess {
		if obj.HasLabel(cncfClaYesLabel) {
			// status is success and we've already applied 'cncf-cla: yes'.
			return
		}
		if obj.HasLabel(cncfClaNoLabel) {
			obj.RemoveLabel(cncfClaNoLabel)
		}
		obj.AddLabel(cncfClaYesLabel)
		return
	}

	// If we are here, that means that the context is failure/error.
	comments, err := obj.ListComments()
	if err != nil {
		glog.Error(err)
		return
	}
	who := mungerutil.GetIssueUsers(obj.Issue).Author.Mention().Join()

	// Get a notification if it's time to ping.
	notif := cla.pinger.PingNotification(
		comments,
		who,
		nil,
	)
	if notif != nil {
		obj.WriteComment(notif.String())
	}

	if obj.HasLabel(cncfClaNoLabel) {
		// status reported error/failure and we've already applied 'cncf-cla: no' label.
		return
	}

	if obj.HasLabel(cncfClaYesLabel) {
		obj.RemoveLabel(cncfClaYesLabel)
	}
	obj.AddLabel(cncfClaNoLabel)
}
開發者ID:spxtr,項目名稱:contrib,代碼行數:58,代碼來源:cla.go

示例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(lgtmLabel) {
		return
	}
	state := obj.GetStatusState(requiredContexts)
	if state == "incomplete" {
		glog.V(2).Infof("status is incomplete, adding ok to test")
		obj.WriteComment(okToTestBody)
	}
}
開發者ID:jojimt,項目名稱:contrib,代碼行數:15,代碼來源:ok-to-test.go

示例5: 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 state := obj.GetStatusState([]string{jenkinsCIContext}); state != "incomplete" {
		contexts = append(contexts, jenkinsCIContext)
	} else {
		contexts = append(contexts, shippableContext)
	}
	if len(sq.E2EStatusContext) > 0 && (len(sq.DontRequireE2ELabel) == 0 || !obj.HasLabel(sq.DontRequireE2ELabel)) {
		contexts = append(contexts, sq.E2EStatusContext)
	}
	return contexts
}
開發者ID:TheMarloGroup,項目名稱:contrib,代碼行數:14,代碼來源:submit-queue.go

示例6: 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
	}
	state := obj.GetStatusState([]string{"Jenkins GCE e2e"})
	if state == "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)
	}
}
開發者ID:TheMarloGroup,項目名稱:contrib,代碼行數:18,代碼來源:ok-to-test.go

示例7: Munge

// Munge is unused by this munger.
func (c *ClaMunger) Munge(obj *githubhelper.MungeObject) {
	if !obj.IsPR() {
		return
	}

	if obj.HasLabel(claHumanLabel) {
		return
	}

	status := obj.GetStatusState([]string{c.CLAStatusContext})

	// Check for pending status and exit.
	if status == contextPending {
		// do nothing and wait for state to be updated.
		return
	}

	if status == contextSuccess {
		if obj.HasLabel(cncfClaYesLabel) {
			// status is success and we've already applied 'cncf-cla: yes'.
			return
		}
		if obj.HasLabel(cncfClaNoLabel) {
			obj.RemoveLabel(cncfClaNoLabel)
		}
		obj.AddLabel(cncfClaYesLabel)
		return
	}

	if obj.HasLabel(cncfClaNoLabel) {
		// status reported error/failure and we've already applied 'cncf-cla: no' label.
		return
	}

	// Write comment and then modify the labels.
	err := obj.WriteComment(fmt.Sprint(cncfclaNotFoundMessage, mungerutil.GetIssueUsers(obj.Issue).Author.Mention().Join()))
	if err != nil {
		return
	}

	if obj.HasLabel(cncfClaYesLabel) {
		obj.RemoveLabel(cncfClaYesLabel)
	}
	obj.AddLabel(cncfClaNoLabel)
}
開發者ID:saad-ali,項目名稱:contrib,代碼行數:46,代碼來源:cla.go

示例8: Munge

// Munge is the workhorse the will actually make updates to the PR
func (PingCIMunger) Munge(obj *github.MungeObject) {
	if !obj.IsPR() {
		return
	}

	// This munger only runs on certain branches, since travis/CI only listens
	// on certain branches
	validBranch := false
	for _, b := range validBranches {
		if obj.IsForBranch(b) {
			validBranch = true
			break
		}
	}
	if !validBranch {
		return
	}

	if !obj.HasLabel(lgtmLabel) {
		return
	}
	mergeable, err := obj.IsMergeable()
	if err != nil {
		glog.V(2).Infof("ping CI skipping %d - problem determining mergeability", *obj.Issue.Number)
		return
	}
	if !mergeable {
		glog.V(2).Infof("ping CI skipping %d - not mergeable", *obj.Issue.Number)
		return
	}
	if state := obj.GetStatusState([]string{travisContext}); state == "incomplete" {
		msg := "Travis 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)
	}
}
開發者ID:jojimt,項目名稱:contrib,代碼行數:40,代碼來源:ping_ci.go

示例9: Munge

// Munge is the workhorse the will actually make updates to the PR
func (StalePendingCI) Munge(obj *github.MungeObject) {
	requiredContexts := []string{jenkinsUnitContext, jenkinsE2EContext}

	if !obj.IsPR() {
		return
	}

	if !obj.HasLabel("lgtm") {
		return
	}

	if mergeable, err := obj.IsMergeable(); !mergeable || err != nil {
		return
	}

	status := obj.GetStatusState(requiredContexts)
	if status != "pending" {
		return
	}

	for _, context := range requiredContexts {
		statusTime := obj.GetStatusTime(context)
		if statusTime == nil {
			glog.Errorf("%d: unable to determine time %q context was set", *obj.Issue.Number, context)
			return
		}
		if time.Since(*statusTime) > stalePendingCIHours*time.Hour {
			msgFormat := `@k8s-bot test this issue: #IGNORE

Tests have been pending for %d hours`
			msg := fmt.Sprintf(msgFormat, stalePendingCIHours)
			obj.WriteComment(msg)
			return
		}
	}
}
開發者ID:thockin,項目名稱:contrib,代碼行數:37,代碼來源:stale-pending-ci.go


注:本文中的k8s/io/contrib/mungegithub/github.MungeObject.GetStatusState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。