本文整理汇总了Golang中github.com/openshift/source-to-image/pkg/scm/git.Git.GetInfo方法的典型用法代码示例。如果您正苦于以下问题:Golang Git.GetInfo方法的具体用法?Golang Git.GetInfo怎么用?Golang Git.GetInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/source-to-image/pkg/scm/git.Git
的用法示例。
在下文中一共展示了Git.GetInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: fetchSource
// fetchSource retrieves the inputs defined by the build source into the
// provided directory, or returns an error if retrieval is not possible.
func fetchSource(dir string, build *api.Build, urlTimeout time.Duration, in io.Reader, git git.Git) (*s2iapi.SourceInfo, error) {
hasGitSource := false
// expect to receive input from STDIN
if err := extractInputBinary(in, build.Spec.Source.Binary, dir); err != nil {
return nil, err
}
// may retrieve source from Git
hasGitSource, err := extractGitSource(git, build.Spec.Source.Git, build.Spec.Revision, dir, urlTimeout)
if err != nil {
return nil, err
}
var sourceInfo *s2iapi.SourceInfo
if hasGitSource {
sourceInfo = git.GetInfo(dir)
}
// a Dockerfile has been specified, create or overwrite into the destination
if dockerfileSource := build.Spec.Source.Dockerfile; dockerfileSource != nil {
baseDir := dir
// if a context dir has been defined and we cloned source, overwrite the destination
if hasGitSource && len(build.Spec.Source.ContextDir) != 0 {
baseDir = filepath.Join(baseDir, build.Spec.Source.ContextDir)
}
return sourceInfo, ioutil.WriteFile(filepath.Join(baseDir, "Dockerfile"), []byte(*dockerfileSource), 0660)
}
return sourceInfo, nil
}