diff --git a/Jenkinsfile b/Jenkinsfile index 776d62c8f7c0e0da7191e848facccf0cf7a2410f..e4a1b123f1c9d56d323fb31474f9df09cae5ce62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -137,6 +137,10 @@ 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 version' } } @@ -337,9 +341,7 @@ Void checkIfNamespaceExists(String namespace) { Void startPluto(String namespace, String values, String bezeichner) { container("k8s") { dir('goofy-client/apps/goofy-e2e/deployment-values/pluto') { - withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { - sh "helm upgrade --install --create-namespace pluto pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version 0.12.0-SNAPSHOT" + ' --repo https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD} --wait --wait-for-jobs' - } + 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" } sh "kubectl rollout status statefulset/pluto-database -n ${namespace}" @@ -349,9 +351,7 @@ Void startPluto(String namespace, String values, String bezeichner) { Void startGoofy(String namespace, String values, String imageTag, String bezeichner) { container("k8s") { dir('goofy-client/apps/goofy-e2e/deployment-values/goofy') { - withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { - sh "helm upgrade --install --create-namespace goofy goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version 0.14.0-SNAPSHOT" + ' --repo https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD} --wait --wait-for-jobs' - } + 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" } createKeycloakGroups(namespace) @@ -360,6 +360,12 @@ Void startGoofy(String namespace, String values, String imageTag, String bezeich } } +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) + } +} + String runTests(String stageName, String reportFolder) { container("cypress") { try {