本文整理汇总了Golang中github.com/openshift/origin/pkg/generate/app.NewDockerfile函数的典型用法代码示例。如果您正苦于以下问题:Golang NewDockerfile函数的具体用法?Golang NewDockerfile怎么用?Golang NewDockerfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewDockerfile函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestResolveJenkinsfileAndDockerfile
// TestResolveJenkinsfileAndDockerfile ensures that if a repo has a Jenkinsfile
// and a Dockerfile, we use the Jenkinsfile.
func TestResolveJenkinsfileAndDockerfile(t *testing.T) {
dockerfile, _ := app.NewDockerfile("FROM centos\n")
i := app.SourceRepositoryInfo{Dockerfile: dockerfile, Jenkinsfile: true}
repo := app.SourceRepository{}
repo.SetInfo(&i)
repositories := app.SourceRepositories{&repo}
resolvers := Resolvers{}
componentrefs, err := AddMissingComponentsToRefBuilder(&app.ReferenceBuilder{}, repositories, resolvers.DockerfileResolver(), resolvers.SourceResolver(), resolvers.PipelineResolver(), &GenerationInputs{})
checkResolveResult(t, componentrefs, err, generate.StrategyPipeline)
}
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:15,代码来源:resolve_test.go
示例2: TestResolveDockerfileAndSource
// TestResolveDockerfileAndSource ensures that if a repo has a Dockerfile and
// source, we use the Dockerfile.
func TestResolveDockerfileAndSource(t *testing.T) {
dockerfile, _ := app.NewDockerfile("FROM centos\n")
i := app.SourceRepositoryInfo{Dockerfile: dockerfile, Types: []app.SourceLanguageType{{Platform: "foo"}}}
repo := app.SourceRepository{}
repo.SetInfo(&i)
repositories := app.SourceRepositories{&repo}
resolvers := Resolvers{}
componentrefs, err := AddMissingComponentsToRefBuilder(&app.ReferenceBuilder{}, repositories, resolvers.DockerfileResolver(), resolvers.SourceResolver(), resolvers.PipelineResolver(), &GenerationInputs{})
checkResolveResult(t, componentrefs, err, generate.StrategyDocker)
}
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:15,代码来源:resolve_test.go
示例3: TestBuildPipelinesWithUnresolvedImage
// Make sure that buildPipelines defaults DockerImage.Config if needed to
// avoid a nil panic.
func TestBuildPipelinesWithUnresolvedImage(t *testing.T) {
dockerFile, err := app.NewDockerfile("FROM centos\nEXPOSE 1234\nEXPOSE 4567")
if err != nil {
t.Fatal(err)
}
sourceRepo, err := app.NewSourceRepository("https://github.com/foo/bar.git")
if err != nil {
t.Fatal(err)
}
sourceRepo.BuildWithDocker()
sourceRepo.SetInfo(&app.SourceRepositoryInfo{
Dockerfile: dockerFile,
})
refs := app.ComponentReferences{
app.ComponentReference(&app.ComponentInput{
Value: "mysql",
Uses: sourceRepo,
ExpectToBuild: true,
ResolvedMatch: &app.ComponentMatch{
Value: "mysql",
},
}),
}
a := AppConfig{}
a.Out = &bytes.Buffer{}
group, err := a.buildPipelines(refs, app.Environment{})
if err != nil {
t.Error(err)
}
expectedPorts := sets.NewString("1234", "4567")
actualPorts := sets.NewString()
for port := range group[0].InputImage.Info.Config.ExposedPorts {
actualPorts.Insert(port)
}
if e, a := expectedPorts.List(), actualPorts.List(); !reflect.DeepEqual(e, a) {
t.Errorf("Expected ports=%v, got %v", e, a)
}
}
开发者ID:Waxolunist,项目名称:origin,代码行数:44,代码来源:newapp_test.go
注:本文中的github.com/openshift/origin/pkg/generate/app.NewDockerfile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论