diff --git a/pkg/helpers/kubeconfig/smart_merge.go b/pkg/helpers/kubeconfig/smart_merge.go index d096e1de33..d048714fc6 100644 --- a/pkg/helpers/kubeconfig/smart_merge.go +++ b/pkg/helpers/kubeconfig/smart_merge.go @@ -58,6 +58,9 @@ func CreateConfig(namespace, userName string, clientCfg *restclient.Config) (*cl credentials := clientcmdapi.NewAuthInfo() credentials.Token = clientCfg.BearerToken + credentials.TokenFile = clientCfg.BearerTokenFile + credentials.AuthProvider = clientCfg.AuthProvider + credentials.Exec = clientCfg.ExecProvider credentials.ClientCertificate = clientCfg.TLSClientConfig.CertFile if len(credentials.ClientCertificate) == 0 { credentials.ClientCertificateData = clientCfg.TLSClientConfig.CertData diff --git a/pkg/helpers/newapp/newapptest/newapp_test.go b/pkg/helpers/newapp/newapptest/newapp_test.go index 44bb83ac1f..ae5c26b176 100644 --- a/pkg/helpers/newapp/newapptest/newapp_test.go +++ b/pkg/helpers/newapp/newapptest/newapp_test.go @@ -517,7 +517,7 @@ func TestNewAppRunAll(t *testing.T) { }, checkPort: "8080", expected: map[string][]string{ - "imageStream": {"ruby-hello-world", "ruby-27-centos7"}, + "imageStream": {"ruby-hello-world", "ruby-27"}, "buildConfig": {"ruby-hello-world"}, "deployment": {"ruby-hello-world"}, "service": {"ruby-hello-world"}, @@ -715,7 +715,7 @@ func TestNewAppRunAll(t *testing.T) { Resolvers: cmd.Resolvers{ DockerSearcher: app.DockerClientSearcher{ Client: &apptest.FakeDockerClient{ - Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-27-centos7"}}}, + Images: []docker.APIImages{{RepoTags: []string{"quay.io/centos7/ruby-27-centos7"}}}, Image: dockerBuilderImage(), }, Insecure: true, @@ -743,7 +743,7 @@ func TestNewAppRunAll(t *testing.T) { OriginNamespace: "default", }, expected: map[string][]string{ - "imageStream": {"ruby-hello-world", "ruby-27-centos7"}, + "imageStream": {"ruby-hello-world", "ruby-27"}, "buildConfig": {"ruby-hello-world"}, "deployment": {"ruby-hello-world"}, "service": {"ruby-hello-world"}, @@ -761,7 +761,7 @@ func TestNewAppRunAll(t *testing.T) { Resolvers: cmd.Resolvers{ DockerSearcher: app.DockerClientSearcher{ Client: &apptest.FakeDockerClient{ - Images: []docker.APIImages{{RepoTags: []string{"quay.io/centos7/ruby-27-centos7"}}}, + Images: []docker.APIImages{{RepoTags: []string{"registry.access.redhat.com/ubi8/ruby-27"}}}, Image: dockerBuilderImage(), }, Insecure: true, @@ -1075,7 +1075,7 @@ func TestNewAppRunBuilds(t *testing.T) { config: &cmd.AppConfig{ ComponentInputs: cmd.ComponentInputs{ SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"}, - DockerImages: []string{"centos/ruby-27-centos7", "openshift/nodejs-010-centos7"}, + DockerImages: []string{"quay.io/centos7/ruby-27-centos7", "openshift/nodejs-010-centos7"}, }, GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, @@ -1181,7 +1181,7 @@ func TestNewAppRunBuilds(t *testing.T) { SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"}, }, GenerationInputs: cmd.GenerationInputs{ - Dockerfile: "FROM centos/ruby-27-centos7\nRUN false", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7\nRUN false", }, }, expected: map[string][]string{ @@ -1206,7 +1206,7 @@ func TestNewAppRunBuilds(t *testing.T) { if bc.Spec.Source.Dockerfile != nil { got = *bc.Spec.Source.Dockerfile } - want := "FROM centos/ruby-27-centos7\nRUN false" + want := "FROM quay.io/centos7/ruby-27-centos7\nRUN false" if got != want { return fmt.Errorf("bc.Spec.Source.Dockerfile = %q; want %q", got, want) } @@ -1247,7 +1247,7 @@ func TestNewAppRunBuilds(t *testing.T) { }, }, GenerationInputs: cmd.GenerationInputs{ - Dockerfile: "FROM centos/ruby-27-centos7\nRUN false", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7\nRUN false", }, }, expectedErr: func(err error) bool { @@ -1263,13 +1263,13 @@ func TestNewAppRunBuilds(t *testing.T) { }, }, GenerationInputs: cmd.GenerationInputs{ - SourceImage: "centos/mongodb-26-centos7", + SourceImage: "registry.centos.org/centos/mongodb-34-centos7", SourceImagePath: "/src:dst", }, }, expected: map[string][]string{ "buildConfig": {"ruby-hello-world"}, - "imageStream": {"mongodb-26-centos7", "ruby-27-centos7", "ruby-hello-world"}, + "imageStream": {"mongodb-34-centos7", "ruby-27", "ruby-hello-world"}, }, checkResult: func(res *cmd.AppResult) error { var bc *buildv1.BuildConfig @@ -1287,7 +1287,7 @@ func TestNewAppRunBuilds(t *testing.T) { } var got string - want := "mongodb-26-centos7:latest" + want := "mongodb-34-centos7:latest" got = bc.Spec.Source.Images[0].From.Name if got != want { return fmt.Errorf("bc.Spec.Source.Image.From.Name = %q; want %q", got, want) @@ -1321,13 +1321,13 @@ func TestNewAppRunBuilds(t *testing.T) { }, GenerationInputs: cmd.GenerationInputs{ To: "outputimage", - SourceImage: "centos/mongodb-26-centos7", + SourceImage: "registry.centos.org/centos/mongodb-34-centos7", SourceImagePath: "/src:dst", }, }, expected: map[string][]string{ "buildConfig": {"outputimage"}, - "imageStream": {"mongodb-26-centos7", "nodejs-010-centos7", "outputimage"}, + "imageStream": {"mongodb-34-centos7", "nodejs-010-centos7", "outputimage"}, }, checkResult: func(res *cmd.AppResult) error { var bc *buildv1.BuildConfig @@ -1345,7 +1345,7 @@ func TestNewAppRunBuilds(t *testing.T) { } var got string - want := "mongodb-26-centos7:latest" + want := "mongodb-34-centos7:latest" got = bc.Spec.Source.Images[0].From.Name if got != want { return fmt.Errorf("bc.Spec.Source.Image.From.Name = %q; want %q", got, want) @@ -1420,7 +1420,7 @@ func TestNewAppRunBuilds(t *testing.T) { config: &cmd.AppConfig{ ComponentInputs: cmd.ComponentInputs{ Components: []string{ - "centos/nodejs-4-centos7~https://github.com/sclorg/nodejs-ex", + "registry.centos.org/centos/nodejs-12-centos7~https://github.com/sclorg/nodejs-ex", }, }, GenerationInputs: cmd.GenerationInputs{ @@ -1582,8 +1582,8 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { config: &cmd.AppConfig{ GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, - To: "centos/ruby-27-centos7", - Dockerfile: "FROM centos/ruby-27-centos7:latest", + To: "quay.io/centos7/ruby-27-centos7", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7:latest", }, }, expected: map[string][]string{ @@ -1595,7 +1595,7 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { if err != nil { return err } - want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n" + want := "--> WARNING: output image of \"quay.io/centos7/ruby-27-centos7:latest\" should be different than input\n" if string(got) != want { return fmt.Errorf("stderr: got %q; want %q", got, want) } @@ -1630,7 +1630,7 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { name: "successful build from dockerfile with identical input and output image references with warning(2)", config: &cmd.AppConfig{ GenerationInputs: cmd.GenerationInputs{ - Dockerfile: "FROM centos/ruby-27-centos7\nRUN yum install -y httpd", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7\nRUN yum install -y httpd", To: "ruby-27-centos7", }, }, @@ -1643,7 +1643,7 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { if err != nil { return err } - want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n" + want := "--> WARNING: output image of \"quay.io/centos7/ruby-27-centos7:latest\" should be different than input\n" if string(got) != want { return fmt.Errorf("stderr: got %q; want %q", got, want) } @@ -1668,12 +1668,12 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { name: "unsuccessful build from dockerfile due to identical input and output image references(2)", config: &cmd.AppConfig{ GenerationInputs: cmd.GenerationInputs{ - Dockerfile: "FROM centos/ruby-27-centos7\nRUN yum install -y httpd", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7\nRUN yum install -y httpd", }, }, expectedErr: func(err error) bool { e := app.CircularOutputReferenceError{ - Reference: "centos/ruby-27-centos7:latest", + Reference: "quay.io/centos7/ruby-27-centos7:latest", } return err.Error() == fmt.Errorf("%v, set a different tag with --to", e).Error() }, @@ -1683,8 +1683,8 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { config: &cmd.AppConfig{ GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, - To: "centos/ruby-27-centos7", - Dockerfile: "FROM centos/ruby-27-centos7", + To: "quay.io/centos7/ruby-27-centos7", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7", }, Resolvers: cmd.Resolvers{ DockerSearcher: app.DockerClientSearcher{ @@ -1703,7 +1703,7 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { if err != nil { return err } - want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n" + want := "--> WARNING: output image of \"quay.io/centos7/ruby-27-centos7:latest\" should be different than input\n" if string(got) != want { return fmt.Errorf("stderr: got %q; want %q", got, want) } @@ -1715,8 +1715,8 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { config: &cmd.AppConfig{ GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, - To: "centos/ruby-27-centos7", - Dockerfile: "FROM centos/ruby-27-centos7:latest", + To: "quay.io/centos7/ruby-27-centos7", + Dockerfile: "FROM quay.io/centos7/ruby-27-centos7:latest", }, Resolvers: cmd.Resolvers{ DockerSearcher: app.DockerClientSearcher{ @@ -1735,7 +1735,7 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) { if err != nil { return err } - want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n" + want := "--> WARNING: output image of \"quay.io/centos7/ruby-27-centos7:latest\" should be different than input\n" if string(got) != want { return fmt.Errorf("stderr: got %q; want %q", got, want) } @@ -1816,7 +1816,7 @@ func TestNewAppNewBuildEnvVars(t *testing.T) { config: &cmd.AppConfig{ ComponentInputs: cmd.ComponentInputs{ SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"}, - DockerImages: []string{"centos/ruby-27-centos7", "openshift/nodejs-010-centos7"}, + DockerImages: []string{"quay.io/centos7/ruby-27-centos7", "registry.centos.org/centos/nodejs-12-centos7"}, }, GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, @@ -1892,7 +1892,7 @@ func TestNewAppBuildConfigEnvVarsAndSecrets(t *testing.T) { config: &cmd.AppConfig{ ComponentInputs: cmd.ComponentInputs{ SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"}, - DockerImages: []string{"centos/ruby-27-centos7", "centos/mongodb-26-centos7"}, + DockerImages: []string{"quay.io/centos7/ruby-27-centos7", "registry.centos.org/centos/mongodb-34-centos7"}, }, GenerationInputs: cmd.GenerationInputs{ OutputDocker: true, @@ -2327,7 +2327,7 @@ func fakeDockerSearcher() app.Searcher { func fakeSimpleDockerSearcher() app.Searcher { return app.DockerClientSearcher{ Client: &apptest.FakeDockerClient{ - Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-27-centos7"}}}, + Images: []docker.APIImages{{RepoTags: []string{"quay.io/centos7/ruby-27-centos7"}}}, Image: &docker.Image{ ID: "ruby", Config: &docker.Config{