#190 Allow set quay.io/openshift/origin-jenkins image in e2e tests
This commit is contained in:
parent
c1c301ec79
commit
cc35dcfc72
|
|
@ -0,0 +1,13 @@
|
|||
// +build !OpenShift
|
||||
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
|
||||
)
|
||||
|
||||
func updateJenkinsCR(t *testing.T, jenkins *v1alpha2.Jenkins) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// +build OpenShift
|
||||
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
|
||||
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/configuration/base/resources"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
func updateJenkinsCR(t *testing.T, jenkins *v1alpha2.Jenkins) {
|
||||
jenkins.Spec.Master.Containers[0].Image = "quay.io/openshift/origin-jenkins"
|
||||
jenkins.Spec.Master.Containers[0].Command = []string{
|
||||
"bash",
|
||||
"-c",
|
||||
"/var/jenkins/scripts/init.sh && exec /usr/bin/go-init -main /usr/libexec/s2i/run",
|
||||
}
|
||||
jenkins.Spec.Master.Containers[0].Env = append(jenkins.Spec.Master.Containers[0].Env,
|
||||
corev1.EnvVar{
|
||||
Name: "JENKINS_SERVICE_NAME",
|
||||
Value: resources.GetJenkinsHTTPServiceName(jenkins),
|
||||
},
|
||||
corev1.EnvVar{
|
||||
Name: "JNLP_SERVICE_NAME",
|
||||
Value: resources.GetJenkinsSlavesServiceName(jenkins),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -168,6 +168,7 @@ func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.S
|
|||
Name: resources.GetResourceName(jenkins),
|
||||
},
|
||||
}
|
||||
updateJenkinsCR(t, jenkins)
|
||||
|
||||
t.Logf("Jenkins CR %+v", *jenkins)
|
||||
if err := framework.Global.Client.Create(context.TODO(), jenkins, nil); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue