本文整理汇总了Golang中github.com/evergreen-ci/evergreen/model/patch.Patch.AddTasks方法的典型用法代码示例。如果您正苦于以下问题:Golang Patch.AddTasks方法的具体用法?Golang Patch.AddTasks怎么用?Golang Patch.AddTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/evergreen-ci/evergreen/model/patch.Patch
的用法示例。
在下文中一共展示了Patch.AddTasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AddNewTasksForPatch
// Given a patch version and a list of task names, creates a new task with
// the given name for each variant, if applicable.
func AddNewTasksForPatch(p *patch.Patch, patchVersion *version.Version, project *Project,
taskNames []string) error {
// create new tasks for all of the added patch tasks
var newTasks []string
for _, taskName := range taskNames {
if !util.SliceContains(p.Tasks, taskName) {
newTasks = append(newTasks, taskName)
}
}
// add tasks to the patch in the db
if err := p.AddTasks(taskNames); err != nil {
return err
}
// add new tasks to the build, if they exist
if len(newTasks) > 0 {
builds, err := build.Find(build.ByIds(patchVersion.BuildIds))
if err != nil {
return err
}
for _, b := range builds {
if _, err = AddTasksToBuild(&b, project, patchVersion, newTasks); err != nil {
return err
}
}
}
return nil
}