From 850a447722e51af6e7c159e90377a2fdd2892892 Mon Sep 17 00:00:00 2001 From: Dominik Hanak Date: Mon, 5 Feb 2024 12:11:49 +0100 Subject: [PATCH] kso-issue-376: Adjust e2e.cluster jenkinsfile to use Kind --- .ci/jenkins/Jenkinsfile.e2e.cluster | 56 +++++++++++++++++++++-------- .ci/jenkins/scripts/kind.groovy | 11 ++++++ 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.e2e.cluster b/.ci/jenkins/Jenkinsfile.e2e.cluster index 3b90cab28..9a73791b0 100644 --- a/.ci/jenkins/Jenkinsfile.e2e.cluster +++ b/.ci/jenkins/Jenkinsfile.e2e.cluster @@ -2,7 +2,7 @@ helper = null -minikubeClusterPlatform = 'minikube' +kindClusterPlatform = 'kind' openshiftClusterPlatform = 'openshift' pipeline { @@ -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 { @@ -121,8 +146,8 @@ String getOperatorVersion() { void setupCluster() { switch (getClusterName()) { - case minikubeClusterPlatform: - setupMinikube() + case kindClusterPlatform: + setupKind() break case openshiftClusterPlatform: setupOpenshift() @@ -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() { @@ -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 !' @@ -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: @@ -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' diff --git a/.ci/jenkins/scripts/kind.groovy b/.ci/jenkins/scripts/kind.groovy index 31dd23cc8..c12ae658a 100644 --- a/.ci/jenkins/scripts/kind.groovy +++ b/.ci/jenkins/scripts/kind.groovy @@ -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