Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/helpers/kubeconfig/smart_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 31 additions & 31 deletions pkg/helpers/newapp/newapptest/newapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"},
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand All @@ -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)
}
Expand Down Expand Up @@ -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",
},
},
Expand All @@ -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)
}
Expand All @@ -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()
},
Expand All @@ -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{
Expand All @@ -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)
}
Expand All @@ -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{
Expand All @@ -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)
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down