diff --git a/Jenkinsfile b/Jenkinsfile
index caeb98bd4c0bd9b352aa6cbcf77d0bee2b00af34..df78c67cae1e206e433fbbbd1b58da3c087a2641 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -136,10 +136,7 @@ pipeline {
                         sh 'cp ${KUBE_CONFIG} ~/.kube/config'
                     }
 
-                    withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
-                        sh 'helm repo add ozg-base-apps-snapshot https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD}'
-                        sh 'helm repo add ozg-base-apps https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD}'
-                    }
+                    initHelmRepo()
 
                     sh 'helm version'
                 }
@@ -333,19 +330,23 @@ Void checkIfNamespaceExists(String namespace) {
         def namespaceList = sh (script: 'kubectl get namespaces', returnStdout: true)
 
         if(namespaceList.contains(namespace)) {
-            sh "kubectl delete namespace ${namespace}"
+            deleteNamespace(namespace)
         }
     }
 }
 
+Void deleteNamespace(String namespace) {
+    sh "kubectl delete namespace ${namespace}"
+}
+
 Void startPluto(String namespace, String values, String bezeichner) {
     container("k8s") {
         dir('goofy-client/apps/goofy-e2e/deployment-values/pluto') {
             if(env.BRANCH_NAME == 'release') {
-               	sh "helm upgrade --install --create-namespace pluto ozg-base-apps/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
+                startPlutoForReleaseTests(namespace, values, bezeichner)
             }
             else {
-               	sh "helm upgrade --install --create-namespace pluto ozg-base-apps-snapshot/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('pluto').trim()} --wait --wait-for-jobs"
+                startPlutoForSnapshotTests(namespace, values, bezeichner)
             }
         }
 
@@ -353,14 +354,22 @@ Void startPluto(String namespace, String values, String bezeichner) {
     }
 }
 
+Void startPlutoForReleaseTests(String namespace, String values, String bezeichner) {
+    sh "helm upgrade --install --create-namespace pluto ozg-base-apps/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
+}
+
+Void startPlutoForSnapshotTests(String namespace, String values, String bezeichner) {
+    sh "helm upgrade --install --create-namespace pluto ozg-base-apps-snapshot/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('pluto').trim()} --wait --wait-for-jobs"
+}
+
 Void startGoofy(String namespace, String values, String imageTag, String bezeichner) {
     container("k8s") {
         dir('goofy-client/apps/goofy-e2e/deployment-values/goofy') {
             if(env.BRANCH_NAME == 'release') {
-               	sh "helm upgrade --install --create-namespace goofy ozg-base-apps/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
+                startGoofyForReleaseTests(namespace, values, bezeichner, imageTag)
             }
             else {
-               	sh "helm upgrade --install --create-namespace goofy ozg-base-apps-snapshot/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('goofy').trim()} --wait --wait-for-jobs"
+                startGoofyForSnapshotTests(namespace, values, bezeichner, imageTag)
             }
         }
 
@@ -371,6 +380,14 @@ Void startGoofy(String namespace, String values, String imageTag, String bezeich
     }
 }
 
+Void startGoofyForReleaseTests(String namespace, String values, String bezeichner, String imageTag) {
+    sh "helm upgrade --install --create-namespace goofy ozg-base-apps/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
+}
+
+Void startGoofyForSnapshotTests(String namespace, String values, String bezeichner, String imageTag) {
+    sh "helm upgrade --install --create-namespace goofy ozg-base-apps-snapshot/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('goofy').trim()} --wait --wait-for-jobs"
+}
+
 String getLatestChartVersion(String chart) {
     container("k8s") {
         return sh (script: "helm search repo ozg-base-apps-snapshot --devel -l -o json | jq -r 'first(.[] | select((.name==\"ozg-base-apps-snapshot/${chart}\") and (.version|match(\"SNAPSHOT\$\"))) | .version)'", returnStdout: true)
@@ -414,13 +431,19 @@ String generateBezeichner(String stage) {
     def branchName = makeUrlConform(env.BRANCH_NAME)
     def stageName = makeUrlConform(stage)
 
-    def cutBranchNamePosition = 30 - (branchName.length() + stageName.length() + 8)
+    return "${cutBranchNameForKeycloakRealm(branchName, stageName)}${stageName}"
+}
+
+String cutBranchNameForKeycloakRealm(String branchName, String stageName) {
+    def maxKeycloakRealmLength = 30
+    def postPrefixLength = 8
+    def cutBranchNamePosition = maxKeycloakRealmLength - (branchName.length() + stageName.length() + postPrefixLength)
 
     if(cutBranchNamePosition < 0) {
         branchName = branchName[0..cutBranchNamePosition]
     }
 
-    return "${branchName}${stageName}"
+    return branchName
 }
 
 String generateNamespaceName(String bezeichner) {
@@ -577,4 +600,11 @@ String getElementAccessToken() {
     withCredentials([string(credentialsId: 'element-login-json', variable: 'LOGIN_JSON')]) {
         return readJSON ( text: sh (script: '''curl -XPOST -d \"$LOGIN_JSON\" https://matrix.ozg-sh.de/_matrix/client/v3/login''', returnStdout: true)).access_token
     }
+}
+
+Void initHelmRepo() {
+    withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
+        sh 'helm repo add ozg-base-apps-snapshot https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD}'
+        sh 'helm repo add ozg-base-apps https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD}'
+    }
 }
\ No newline at end of file