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


Golang MungeObject.GetStatusTime方法代碼示例

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


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

示例1: Munge

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

	if !obj.HasLabel(lgtmLabel) {
		return
	}

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

	if !obj.IsStatusSuccess(requiredContexts) {
		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) > staleGreenCIHours*time.Hour {
			obj.WriteComment(greenMsgBody)
			err := obj.WaitForPending(requiredContexts)
			if err != nil {
				glog.Errorf("Failed waiting for PR to start testing: %v", err)
			}
			return
		}
	}
}
開發者ID:jojimt,項目名稱:contrib,代碼行數:34,代碼來源:stale-green-ci.go

示例2: 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

示例3: commentBeforeLastCI

func commentBeforeLastCI(obj *github.MungeObject, comment *githubapi.IssueComment) bool {
	if !obj.IsStatusSuccess(requiredContexts) {
		return false
	}
	if comment.CreatedAt == nil {
		return false
	}
	commentTime := *comment.CreatedAt

	for _, context := range requiredContexts {
		statusTimeP := obj.GetStatusTime(context)
		if statusTimeP == nil {
			return false
		}
		statusTime := statusTimeP.Add(30 * time.Minute)
		if commentTime.After(statusTime) {
			return false
		}
	}
	return true
}
開發者ID:jojimt,項目名稱:contrib,代碼行數:21,代碼來源:stale-green-ci.go

示例4: Munge

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

	if !obj.IsPR() {
		return
	}

	if !obj.HasLabels([]string{"lgtm"}) {
		return
	}

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

	if !obj.IsStatusSuccess(requiredContexts) {
		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) > staleHours*time.Hour {
			msgFormat := `@k8s-bot test this

Tests are more than %d hours old. Re-running tests.`
			msg := fmt.Sprintf(msgFormat, staleHours)
			obj.WriteComment(msg)
			err := obj.WaitForPending(requiredContexts)
			if err != nil {
				glog.Errorf("Failed waiting for PR to start testing: %v", err)
			}
			return
		}
	}
}
開發者ID:resouer,項目名稱:contrib,代碼行數:40,代碼來源:stale-unit-test.go

示例5: 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.GetStatusTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。