本文整理汇总了Golang中github.com/openshift/origin/pkg/build/api.Build.ResourceVersion方法的典型用法代码示例。如果您正苦于以下问题:Golang Build.ResourceVersion方法的具体用法?Golang Build.ResourceVersion怎么用?Golang Build.ResourceVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/build/api.Build
的用法示例。
在下文中一共展示了Build.ResourceVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateBuildRevision
func updateBuildRevision(c client.BuildInterface, build *api.Build, sourceInfo *git.SourceInfo) {
if build.Spec.Revision != nil {
return
}
build.Spec.Revision = &api.SourceRevision{
Git: &api.GitSourceRevision{
Commit: sourceInfo.CommitID,
Message: sourceInfo.Message,
Author: api.SourceControlUser{
Name: sourceInfo.AuthorName,
Email: sourceInfo.AuthorEmail,
},
Committer: api.SourceControlUser{
Name: sourceInfo.CommitterName,
Email: sourceInfo.CommitterEmail,
},
},
}
// Reset ResourceVersion to avoid a conflict with other updates to the build
build.ResourceVersion = ""
glog.V(4).Infof("Setting build revision to %#v", build.Spec.Revision.Git)
_, err := c.UpdateDetails(build)
if err != nil {
glog.Warningf("An error occurred saving build revision: %v", err)
}
}