Skip to content

Commit

Permalink
kso-issue-376: Adjust e2e.cluster jenkinsfile to use Kind
Browse files Browse the repository at this point in the history
  • Loading branch information
domhanak committed Feb 5, 2024
1 parent 56b139d commit 850a447
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
56 changes: 41 additions & 15 deletions .ci/jenkins/Jenkinsfile.e2e.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

helper = null

minikubeClusterPlatform = 'minikube'
kindClusterPlatform = 'kind'
openshiftClusterPlatform = 'openshift'

pipeline {
Expand Down Expand Up @@ -47,6 +47,31 @@ pipeline {
}
}
}
stage('Load image into Kind') {
when {
expression {
return getClusterName() == kindClusterPlatform
}
}
steps {
script {
kind.loadImage(getTestImage())
}
}
}
stage('Deploy the operator') {
when {
expression {
return getClusterName() == kindClusterPlatform
}
}
steps {
script {
sh "make deploy IMG=${getTestImage()}"
sh "kubectl wait pod -A -l control-plane=sonataflow-operator --for condition=Ready"
}
}
}
stage('Prepare for e2e tests') {
when {
expression {
Expand Down Expand Up @@ -121,8 +146,8 @@ String getOperatorVersion() {

void setupCluster() {
switch (getClusterName()) {
case minikubeClusterPlatform:
setupMinikube()
case kindClusterPlatform:
setupKind()
break
case openshiftClusterPlatform:
setupOpenshift()
Expand All @@ -132,13 +157,14 @@ void setupCluster() {
}
}

void setupMinikube() {
// Start minikube
minikube.minikubeMemory = '12g'
minikube.start()

minikube.waitForMinikubeStarted()
minikube.waitForMinikubeRegistry()
void setupKind() {
// Start kind
kind.start()
kind.waitUntilKubeSystemPodsAreStarted()
kind.createRegistryContainer()
kind.connectRegistryContainerToClusterNetwork()
kind.addRegistryConfigToTheClusterNodes()
kind.documentLocalRegistry()
}

void setupOpenshift() {
Expand All @@ -148,8 +174,8 @@ void setupOpenshift() {

void cleanupCluster() {
switch (getClusterName()) {
case minikubeClusterPlatform:
minikube.stop()
case kindClusterPlatform:
kind.stop()
break
case openshiftClusterPlatform:
echo 'Nothing to cleanup on openshift. All good !'
Expand All @@ -161,8 +187,8 @@ void cleanupCluster() {

void executeInCluster(Closure executeClosure) {
switch (getClusterName()) {
case minikubeClusterPlatform:
echo "Execute in minikube"
case kindClusterPlatform:
echo "Execute in kind"
executeClosure()
break
case openshiftClusterPlatform:
Expand All @@ -178,7 +204,7 @@ void executeInCluster(Closure executeClosure) {

void getPlatformCRFilePath() {
switch (getClusterName()) {
case minikubeClusterPlatform:
case kindClusterPlatform:
return 'test/testdata/sonataflow.org_v1alpha08_sonataflowplatform_withCache_minikube.yaml'
case openshiftClusterPlatform:
return 'test/testdata/sonataflow.org_v1alpha08_sonataflowplatform_openshift.yaml'
Expand Down
11 changes: 11 additions & 0 deletions .ci/jenkins/scripts/kind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,15 @@ void documentLocalRegistry() {
}
}

void stop() {
println 'Stopping kind cluster'
def documentLocalRegistryStatus = sh(returnStatus: true, script: '''
kind delete cluster
''')
}

void loadImage(String imageName) {
sh "kind load docker-image ${imageName}"
}

return this

0 comments on commit 850a447

Please sign in to comment.