当前位置: 首页>>代码示例>>Golang>>正文


Golang Patch.AddTasks方法代码示例

本文整理汇总了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
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:32,代码来源:patch_lifecycle.go


注:本文中的github.com/evergreen-ci/evergreen/model/patch.Patch.AddTasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。