本文整理匯總了Golang中github.com/evergreen-ci/evergreen/model.Project.GetSpecForTask方法的典型用法代碼示例。如果您正苦於以下問題:Golang Project.GetSpecForTask方法的具體用法?Golang Project.GetSpecForTask怎麽用?Golang Project.GetSpecForTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/evergreen-ci/evergreen/model.Project
的用法示例。
在下文中一共展示了Project.GetSpecForTask方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: checkDependencyGraph
// Makes sure that the dependencies for the tasks in the project form a
// valid dependency graph (no cycles).
func checkDependencyGraph(project *model.Project) []ValidationError {
errs := []ValidationError{}
// map of task name and variant -> BuildVariantTask
tasksByNameAndVariant := map[model.TVPair]model.BuildVariantTask{}
// generate task nodes for every task and variant combination
visited := map[model.TVPair]bool{}
allNodes := []model.TVPair{}
for _, bv := range project.BuildVariants {
for _, t := range bv.Tasks {
t.Populate(project.GetSpecForTask(t.Name))
node := model.TVPair{bv.Name, t.Name}
tasksByNameAndVariant[node] = t
visited[node] = false
allNodes = append(allNodes, node)
}
}
// run through the task nodes, checking their dependency graphs for cycles
for _, node := range allNodes {
// the visited nodes
if err := dependencyCycleExists(node, visited, tasksByNameAndVariant); err != nil {
errs = append(errs,
ValidationError{
Message: fmt.Sprintf(
"dependency error for '%v' task: %v", node.TaskName, err),
},
)
}
}
return errs
}