本文整理汇总了Golang中github.com/openshift/origin/test/util.GetBaseDir函数的典型用法代码示例。如果您正苦于以下问题:Golang GetBaseDir函数的具体用法?Golang GetBaseDir怎么用?Golang GetBaseDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetBaseDir函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DefaultAllInOneOptions
func DefaultAllInOneOptions() (*configapi.MasterConfig, *configapi.NodeConfig, error) {
startOptions := start.AllInOneOptions{MasterOptions: &start.MasterOptions{}, NodeArgs: &start.NodeArgs{}}
startOptions.MasterOptions.MasterArgs, startOptions.NodeArgs, _, _, _ = setupStartOptions()
startOptions.MasterOptions.MasterArgs.NodeList = nil
startOptions.NodeArgs.AllowDisabledDocker = true
startOptions.ServiceNetworkCIDR = start.NewDefaultNetworkArgs().ServiceNetworkCIDR
startOptions.Complete()
startOptions.MasterOptions.MasterArgs.ConfigDir.Default(path.Join(util.GetBaseDir(), "openshift.local.config", "master"))
startOptions.NodeArgs.ConfigDir.Default(path.Join(util.GetBaseDir(), "openshift.local.config", admin.DefaultNodeDir(startOptions.NodeArgs.NodeName)))
startOptions.NodeArgs.MasterCertDir = startOptions.MasterOptions.MasterArgs.ConfigDir.Value()
if err := CreateMasterCerts(startOptions.MasterOptions.MasterArgs); err != nil {
return nil, nil, err
}
if err := CreateBootstrapPolicy(startOptions.MasterOptions.MasterArgs); err != nil {
return nil, nil, err
}
if err := CreateNodeCerts(startOptions.NodeArgs); err != nil {
return nil, nil, err
}
masterOptions, err := startOptions.MasterOptions.MasterArgs.BuildSerializeableMasterConfig()
if err != nil {
return nil, nil, err
}
nodeOptions, err := startOptions.NodeArgs.BuildSerializeableNodeConfig()
if err != nil {
return nil, nil, err
}
return masterOptions, nodeOptions, nil
}
示例2: TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange
func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange(t *testing.T) {
defer testutil.DumpEtcdOnFailure(t)
projectAdminClient, _ := setup(t)
clusterAdminClient, err := testutil.GetClusterAdminClient(testutil.GetBaseDir() + "/openshift.local.config/master/admin.kubeconfig")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
clusterRoleBindingAccessor := policy.NewClusterRoleBindingAccessor(clusterAdminClient)
subjects := []kapi.ObjectReference{
{
Kind: authorizationapi.SystemGroupKind,
Name: bootstrappolicy.AuthenticatedGroup,
},
}
options := policy.RoleModificationOptions{
RoleNamespace: testutil.Namespace(),
RoleName: bootstrappolicy.BuildStrategyCustomRoleName,
RoleBindingAccessor: clusterRoleBindingAccessor,
Subjects: subjects,
}
options.AddRole()
if err := testutil.WaitForPolicyUpdate(projectAdminClient, testutil.Namespace(), "create", buildapi.Resource(authorizationapi.CustomBuildResource), true); err != nil {
t.Fatal(err)
}
imageStream := mockImageStream2(tag)
imageStreamMapping := mockImageStreamMapping(imageStream.Name, "someimage", tag, "registry:8080/openshift/test-image-trigger:"+tag)
strategy := customStrategy("ImageStreamTag", streamName+":"+tag)
config := imageChangeBuildConfigWithConfigChange("custom-imagestreamtag", strategy)
runTest(t, "SimpleImageChangeBuildTriggerFromImageStreamTagCustom", projectAdminClient, imageStream, imageStreamMapping, config, tag)
}
示例3: TestGetDockerfileFrom
func TestGetDockerfileFrom(t *testing.T) {
tests := map[string]struct {
dockerfileContent string
want []string
}{
"no FROM instruction": {
dockerfileContent: `RUN echo "invalid Dockerfile"
`,
want: []string{},
},
"single FROM instruction": {
dockerfileContent: `FROM scratch
RUN echo "hello world"
`,
want: []string{"scratch"},
},
"multi FROM instruction": {
dockerfileContent: `FROM scratch
FROM busybox
RUN echo "hello world"
`,
want: []string{"scratch", "busybox"},
},
}
for i, test := range tests {
buildDir, err := ioutil.TempDir(util.GetBaseDir(), "dockerfile-path")
if err != nil {
t.Errorf("failed to create tmpdir: %v", err)
continue
}
dockerfilePath := filepath.Join(buildDir, defaultDockerfilePath)
dockerfileContent := test.dockerfileContent
if err = os.MkdirAll(filepath.Dir(dockerfilePath), os.FileMode(0750)); err != nil {
t.Errorf("failed to create directory %s: %v", filepath.Dir(dockerfilePath), err)
continue
}
if err = ioutil.WriteFile(dockerfilePath, []byte(dockerfileContent), os.FileMode(0644)); err != nil {
t.Errorf("failed to write dockerfile to %s: %v", dockerfilePath, err)
continue
}
froms := getDockerfileFrom(dockerfilePath)
if len(froms) != len(test.want) {
t.Errorf("test[%s]: getDockerfileFrom(dockerfilepath, %s) = %+v; want %+v", i, dockerfilePath, froms, test.want)
t.Logf("Dockerfile froms::\n%v", froms)
continue
}
for fi := range froms {
if froms[fi] != test.want[fi] {
t.Errorf("test[%s]: getDockerfileFrom(dockerfilepath, %s) = %+v; want %+v", i, dockerfilePath, froms, test.want)
t.Logf("Dockerfile froms::\n%v", froms)
break
}
}
os.RemoveAll(buildDir)
}
}
示例4: DefaultAllInOneOptions
func DefaultAllInOneOptions() (*configapi.MasterConfig, *configapi.NodeConfig, *utilflags.ComponentFlag, error) {
startOptions := start.AllInOneOptions{MasterOptions: &start.MasterOptions{}, NodeArgs: &start.NodeArgs{}}
startOptions.MasterOptions.MasterArgs, startOptions.NodeArgs, _, _, _ = setupStartOptions(false, false)
startOptions.NodeArgs.AllowDisabledDocker = true
startOptions.NodeArgs.Components.Disable("plugins", "proxy", "dns")
startOptions.ServiceNetworkCIDR = start.NewDefaultNetworkArgs().ServiceNetworkCIDR
startOptions.Complete()
startOptions.MasterOptions.MasterArgs.ConfigDir.Default(path.Join(util.GetBaseDir(), "openshift.local.config", "master"))
startOptions.NodeArgs.ConfigDir.Default(path.Join(util.GetBaseDir(), "openshift.local.config", admin.DefaultNodeDir(startOptions.NodeArgs.NodeName)))
startOptions.NodeArgs.MasterCertDir = startOptions.MasterOptions.MasterArgs.ConfigDir.Value()
if err := CreateMasterCerts(startOptions.MasterOptions.MasterArgs); err != nil {
return nil, nil, nil, err
}
if err := CreateBootstrapPolicy(startOptions.MasterOptions.MasterArgs); err != nil {
return nil, nil, nil, err
}
if err := CreateNodeCerts(startOptions.NodeArgs, startOptions.MasterOptions.MasterArgs.MasterAddr.String()); err != nil {
return nil, nil, nil, err
}
masterOptions, err := startOptions.MasterOptions.MasterArgs.BuildSerializeableMasterConfig()
if err != nil {
return nil, nil, nil, err
}
if fn := startOptions.MasterOptions.MasterArgs.OverrideConfig; fn != nil {
if err := fn(masterOptions); err != nil {
return nil, nil, nil, err
}
}
nodeOptions, err := startOptions.NodeArgs.BuildSerializeableNodeConfig()
if err != nil {
return nil, nil, nil, err
}
return masterOptions, nodeOptions, startOptions.NodeArgs.Components, nil
}
示例5: setupStartOptions
func setupStartOptions(startEtcd, useDefaultPort bool) (*start.MasterArgs, *start.NodeArgs, *start.ListenArg, *start.ImageFormatArgs, *start.KubeConnectionArgs) {
masterArgs, nodeArgs, listenArg, imageFormatArgs, kubeConnectionArgs := start.GetAllInOneArgs()
basedir := util.GetBaseDir()
nodeArgs.NodeName = "127.0.0.1"
nodeArgs.VolumeDir = path.Join(basedir, "volume")
// Allows to override the default etcd directory from the shell script.
etcdDir := os.Getenv("TEST_ETCD_DIR")
if len(etcdDir) == 0 {
etcdDir = path.Join(basedir, "etcd")
}
masterArgs.EtcdDir = etcdDir
masterArgs.ConfigDir.Default(path.Join(basedir, "openshift.local.config", "master"))
nodeArgs.ConfigDir.Default(path.Join(basedir, "openshift.local.config", nodeArgs.NodeName))
nodeArgs.MasterCertDir = masterArgs.ConfigDir.Value()
if !useDefaultPort {
// don't wait for nodes to come up
masterAddr := os.Getenv("OS_MASTER_ADDR")
if len(masterAddr) == 0 {
if addr, err := FindAvailableBindAddress(12000, 12999); err != nil {
glog.Fatalf("Couldn't find free address for master: %v", err)
} else {
masterAddr = addr
}
}
fmt.Printf("masterAddr: %#v\n", masterAddr)
masterArgs.MasterAddr.Set(masterAddr)
listenArg.ListenAddr.Set(masterAddr)
}
if !startEtcd {
masterArgs.EtcdAddr.Set(util.GetEtcdURL())
}
dnsAddr := os.Getenv("OS_DNS_ADDR")
if len(dnsAddr) == 0 {
if addr, err := FindAvailableBindAddress(8053, 8100); err != nil {
glog.Fatalf("Couldn't find free address for DNS: %v", err)
} else {
dnsAddr = addr
}
}
masterArgs.DNSBindAddr.Set(dnsAddr)
return masterArgs, nodeArgs, listenArg, imageFormatArgs, kubeConnectionArgs
}
示例6: setupStartOptions
func setupStartOptions() (*start.MasterArgs, *start.NodeArgs, *start.ListenArg, *start.ImageFormatArgs, *start.KubeConnectionArgs) {
masterArgs, nodeArgs, listenArg, imageFormatArgs, kubeConnectionArgs := start.GetAllInOneArgs()
basedir := util.GetBaseDir()
nodeArgs.VolumeDir = path.Join(basedir, "volume")
masterArgs.EtcdDir = path.Join(basedir, "etcd")
masterArgs.ConfigDir.Default(path.Join(basedir, "openshift.local.config", "master"))
nodeArgs.ConfigDir.Default(path.Join(basedir, "openshift.local.config", nodeArgs.NodeName))
nodeArgs.MasterCertDir = masterArgs.ConfigDir.Value()
// don't wait for nodes to come up
masterAddr := os.Getenv("OS_MASTER_ADDR")
if len(masterAddr) == 0 {
if addr, err := FindAvailableBindAddress(8443, 8999); err != nil {
glog.Fatalf("Couldn't find free address for master: %v", err)
} else {
masterAddr = addr
}
}
fmt.Printf("masterAddr: %#v\n", masterAddr)
masterArgs.MasterAddr.Set(masterAddr)
listenArg.ListenAddr.Set(masterAddr)
masterArgs.EtcdAddr.Set(util.GetEtcdURL())
dnsAddr := os.Getenv("OS_DNS_ADDR")
if len(dnsAddr) == 0 {
if addr, err := FindAvailableBindAddress(8053, 8100); err != nil {
glog.Fatalf("Couldn't find free address for DNS: %v", err)
} else {
dnsAddr = addr
}
}
fmt.Printf("dnsAddr: %#v\n", dnsAddr)
masterArgs.DNSBindAddr.Set(dnsAddr)
return masterArgs, nodeArgs, listenArg, imageFormatArgs, kubeConnectionArgs
}
示例7: DefaultMasterOptions
func DefaultMasterOptions() (*configapi.MasterConfig, error) {
startOptions := start.MasterOptions{}
startOptions.MasterArgs, _, _, _, _ = setupStartOptions()
startOptions.Complete()
startOptions.MasterArgs.ConfigDir.Default(path.Join(util.GetBaseDir(), "openshift.local.config", "master"))
if err := CreateMasterCerts(startOptions.MasterArgs); err != nil {
return nil, err
}
if err := CreateBootstrapPolicy(startOptions.MasterArgs); err != nil {
return nil, err
}
masterConfig, err := startOptions.MasterArgs.BuildSerializeableMasterConfig()
if err != nil {
return nil, err
}
// force strict handling of service account secret references by default, so that all our examples and controllers will handle it.
masterConfig.ServiceAccountConfig.LimitSecretReferences = true
return masterConfig, nil
}
示例8: Run
func (o *DebugAPIServerOptions) Run() error {
masterConfig, err := testserver.DefaultMasterOptionsWithTweaks(true /*start etcd server*/, true /*use default ports*/)
if err != nil {
return err
}
etcdConfig := masterConfig.EtcdConfig
masterConfig.EtcdConfig = nil
masterConfig.DNSConfig = nil
etcdserver.RunEtcd(etcdConfig)
if err := o.ImportEtcdDump(masterConfig.EtcdClientInfo); err != nil {
return err
}
if err := o.StartAPIServer(*masterConfig); err != nil {
return err
}
if o.AllowAll {
osClient, err := testutil.GetClusterAdminClient(testutil.GetBaseDir() + "/openshift.local.config/master/admin.kubeconfig")
if err != nil {
return err
}
addClusterAdmin := &policy.RoleModificationOptions{
RoleName: bootstrappolicy.ClusterAdminRoleName,
RoleBindingAccessor: policy.ClusterRoleBindingAccessor{Client: osClient},
Groups: []string{"system:authenticated"},
}
if err := addClusterAdmin.AddRole(); err != nil {
return err
}
}
select {}
}
示例9: TestServiceAccountAuthorization
func TestServiceAccountAuthorization(t *testing.T) {
saNamespace := api.NamespaceDefault
saName := serviceaccountadmission.DefaultServiceAccountName
saUsername := serviceaccount.MakeUsername(saNamespace, saName)
// Start one OpenShift master as "cluster1" to play the external kube server
cluster1MasterConfig, cluster1AdminConfigFile, err := testserver.StartTestMaster()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
cluster1AdminConfig, err := testutil.GetClusterAdminClientConfig(cluster1AdminConfigFile)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
cluster1AdminKubeClient, err := testutil.GetClusterAdminKubeClient(cluster1AdminConfigFile)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
cluster1AdminOSClient, err := testutil.GetClusterAdminClient(cluster1AdminConfigFile)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Get a service account token and build a client
saToken, err := waitForServiceAccountToken(cluster1AdminKubeClient, saNamespace, saName, 20, time.Second)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if len(saToken) == 0 {
t.Fatalf("token was not created")
}
cluster1SAClientConfig := kclient.Config{
Host: cluster1AdminConfig.Host,
Prefix: cluster1AdminConfig.Prefix,
BearerToken: saToken,
TLSClientConfig: kclient.TLSClientConfig{
CAFile: cluster1AdminConfig.CAFile,
CAData: cluster1AdminConfig.CAData,
},
}
cluster1SAKubeClient, err := kclient.New(&cluster1SAClientConfig)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Make sure the service account doesn't have access
failNS := &api.Namespace{ObjectMeta: api.ObjectMeta{Name: "test-fail"}}
if _, err := cluster1SAKubeClient.Namespaces().Create(failNS); !errors.IsForbidden(err) {
t.Fatalf("expected forbidden error, got %v", err)
}
// Make the service account a cluster admin on cluster1
addRoleOptions := &policy.RoleModificationOptions{
RoleName: bootstrappolicy.ClusterAdminRoleName,
RoleBindingAccessor: policy.NewClusterRoleBindingAccessor(cluster1AdminOSClient),
Users: []string{saUsername},
}
if err := addRoleOptions.AddRole(); err != nil {
t.Fatalf("could not add role to service account")
}
// Give the policy cache a second to catch it's breath
time.Sleep(time.Second)
// Make sure the service account now has access
// This tests authentication using the etcd-based token getter
passNS := &api.Namespace{ObjectMeta: api.ObjectMeta{Name: "test-pass"}}
if _, err := cluster1SAKubeClient.Namespaces().Create(passNS); err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Create a kubeconfig from the serviceaccount config
cluster1SAKubeConfigFile, err := ioutil.TempFile(testutil.GetBaseDir(), "cluster1-service-account.kubeconfig")
if err != nil {
t.Fatalf("error creating tmpfile: %v", err)
}
defer os.Remove(cluster1SAKubeConfigFile.Name())
if err := writeClientConfigToKubeConfig(cluster1SAClientConfig, cluster1SAKubeConfigFile.Name()); err != nil {
t.Fatalf("error creating kubeconfig: %v", err)
}
// Set up cluster 2 to run against cluster 1 as external kubernetes
cluster2MasterConfig, err := testserver.DefaultMasterOptions()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Don't start kubernetes in process
cluster2MasterConfig.KubernetesMasterConfig = nil
// Connect to cluster1 using the service account credentials
cluster2MasterConfig.MasterClients.ExternalKubernetesKubeConfig = cluster1SAKubeConfigFile.Name()
// Don't start etcd
cluster2MasterConfig.EtcdConfig = nil
// Use the same credentials as cluster1 to connect to existing etcd
cluster2MasterConfig.EtcdClientInfo = cluster1MasterConfig.EtcdClientInfo
// Set a custom etcd prefix to make sure data is getting sent to cluster1
cluster2MasterConfig.EtcdStorageConfig.KubernetesStoragePrefix += "2"
cluster2MasterConfig.EtcdStorageConfig.OpenShiftStoragePrefix += "2"
// Don't manage any names in cluster2
cluster2MasterConfig.ServiceAccountConfig.ManagedNames = []string{}
// Don't create any service account tokens in cluster2
//.........这里部分代码省略.........
示例10: TestDockerfilePath
// TestDockerfilePath validates that we can use a Dockerfile with a custom name, and in a sub-directory
func TestDockerfilePath(t *testing.T) {
tests := []struct {
contextDir string
dockerfilePath string
dockerStrategy *api.DockerBuildStrategy
}{
// default Dockerfile path
{
dockerfilePath: "Dockerfile",
dockerStrategy: &api.DockerBuildStrategy{},
},
// custom Dockerfile path in the root context
{
dockerfilePath: "mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "mydockerfile",
},
},
// custom Dockerfile path in a sub directory
{
dockerfilePath: "dockerfiles/mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "dockerfiles/mydockerfile",
},
},
// custom Dockerfile path in a sub directory
// with a contextDir
{
contextDir: "somedir",
dockerfilePath: "dockerfiles/mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "dockerfiles/mydockerfile",
},
},
}
for _, test := range tests {
buildDir, err := ioutil.TempDir(util.GetBaseDir(), "dockerfile-path")
if err != nil {
t.Errorf("failed to create tmpdir: %v", err)
continue
}
absoluteDockerfilePath := filepath.Join(buildDir, test.contextDir, test.dockerfilePath)
dockerfileContent := "FROM openshift/origin-base"
if err = os.MkdirAll(filepath.Dir(absoluteDockerfilePath), os.FileMode(0750)); err != nil {
t.Errorf("failed to create directory %s: %v", filepath.Dir(absoluteDockerfilePath), err)
continue
}
if err = ioutil.WriteFile(absoluteDockerfilePath, []byte(dockerfileContent), os.FileMode(0644)); err != nil {
t.Errorf("failed to write dockerfile to %s: %v", absoluteDockerfilePath, err)
continue
}
build := &api.Build{
Spec: api.BuildSpec{
CommonSpec: api.CommonSpec{
Source: api.BuildSource{
Git: &api.GitBuildSource{
URI: "http://github.com/openshift/origin.git",
},
ContextDir: test.contextDir,
},
Strategy: api.BuildStrategy{
DockerStrategy: test.dockerStrategy,
},
Output: api.BuildOutput{
To: &kapi.ObjectReference{
Kind: "DockerImage",
Name: "test/test-result:latest",
},
},
},
},
}
dockerClient := &FakeDocker{
buildImageFunc: func(opts docker.BuildImageOptions) error {
if opts.Dockerfile != test.dockerfilePath {
t.Errorf("Unexpected dockerfile path: %s (expected: %s)", opts.Dockerfile, test.dockerfilePath)
}
return nil
},
}
dockerBuilder := &DockerBuilder{
dockerClient: dockerClient,
build: build,
gitClient: git.NewRepository(),
tar: tar.New(s2iutil.NewFileSystem()),
}
// this will validate that the Dockerfile is readable
// and append some labels to the Dockerfile
if err = dockerBuilder.addBuildParameters(buildDir); err != nil {
t.Errorf("failed to add build parameters: %v", err)
continue
}
// check that our Dockerfile has been modified
//.........这里部分代码省略.........
示例11: TestDockerfilePath
// TestDockerfilePath validates that we can use a Dockerfile with a custom name, and in a sub-directory
func TestDockerfilePath(t *testing.T) {
tests := []struct {
contextDir string
dockerfilePath string
dockerStrategy *api.DockerBuildStrategy
}{
// default Dockerfile path
{
dockerfilePath: "Dockerfile",
dockerStrategy: &api.DockerBuildStrategy{},
},
// custom Dockerfile path in the root context
{
dockerfilePath: "mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "mydockerfile",
},
},
// custom Dockerfile path in a sub directory
{
dockerfilePath: "dockerfiles/mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "dockerfiles/mydockerfile",
},
},
// custom Dockerfile path in a sub directory
// with a contextDir
{
contextDir: "somedir",
dockerfilePath: "dockerfiles/mydockerfile",
dockerStrategy: &api.DockerBuildStrategy{
DockerfilePath: "dockerfiles/mydockerfile",
},
},
}
from := "FROM openshift/origin-base"
expected := []string{
from,
// expected env variables
"\"OPENSHIFT_BUILD_NAME\"=\"name\"",
"\"OPENSHIFT_BUILD_NAMESPACE\"=\"namespace\"",
"\"OPENSHIFT_BUILD_SOURCE\"=\"http://github.com/openshift/origin.git\"",
"\"OPENSHIFT_BUILD_COMMIT\"=\"commitid\"",
// expected labels
"\"io.openshift.build.commit.author\"=\"test user \\[email protected]\\u003e\"",
"\"io.openshift.build.commit.date\"=\"date\"",
"\"io.openshift.build.commit.id\"=\"commitid\"",
"\"io.openshift.build.commit.ref\"=\"ref\"",
"\"io.openshift.build.commit.message\"=\"message\"",
}
for _, test := range tests {
buildDir, err := ioutil.TempDir(util.GetBaseDir(), "dockerfile-path")
if err != nil {
t.Errorf("failed to create tmpdir: %v", err)
continue
}
absoluteDockerfilePath := filepath.Join(buildDir, test.contextDir, test.dockerfilePath)
if err = os.MkdirAll(filepath.Dir(absoluteDockerfilePath), os.FileMode(0750)); err != nil {
t.Errorf("failed to create directory %s: %v", filepath.Dir(absoluteDockerfilePath), err)
continue
}
if err = ioutil.WriteFile(absoluteDockerfilePath, []byte(from), os.FileMode(0644)); err != nil {
t.Errorf("failed to write dockerfile to %s: %v", absoluteDockerfilePath, err)
continue
}
build := &api.Build{
Spec: api.BuildSpec{
CommonSpec: api.CommonSpec{
Source: api.BuildSource{
Git: &api.GitBuildSource{
URI: "http://github.com/openshift/origin.git",
},
ContextDir: test.contextDir,
},
Strategy: api.BuildStrategy{
DockerStrategy: test.dockerStrategy,
},
Output: api.BuildOutput{
To: &kapi.ObjectReference{
Kind: "DockerImage",
Name: "test/test-result:latest",
},
},
},
},
}
build.Name = "name"
build.Namespace = "namespace"
sourceInfo := &git.SourceInfo{}
sourceInfo.AuthorName = "test user"
sourceInfo.AuthorEmail = "[email protected]"
sourceInfo.Date = "date"
sourceInfo.CommitID = "commitid"
sourceInfo.Ref = "ref"
sourceInfo.Message = "message"
//.........这里部分代码省略.........