Skip to content
Snippets Groups Projects
Commit a2bf57c1 authored by OZGCloud's avatar OZGCloud
Browse files

ozg-2964 jenkinsfile

parent 1ffa7ef9
No related branches found
No related tags found
No related merge requests found
......@@ -547,6 +547,7 @@ String generateCypressConfig(String stage, String bezeichner, String testFolder)
dir('goofy-client/apps/goofy-e2e/'){
def config = readJSON file: 'cypress-ci.json'
def elasticsearchEnv = getElasticsearchEnv(namespace)
config.baseUrl = "https://${bezeichner}.dev.ozg-sh.de" as String
config.env.dbUrl = "mongodb+srv://pluto-database-user:XnHhfznNWg65NNd@pluto-database-svc.${namespace}.svc.cluster.local/admin?ssl=false" as String
......@@ -558,7 +559,12 @@ String generateCypressConfig(String stage, String bezeichner, String testFolder)
config.screenshotsFolder = "./reports/${testFolder}/screenshots" as String
config.reporterOptions.reportDir = "./reports/${testFolder}/mochawesome-report" as String
environment = config.env
environment.put("elasticsearch", elasticsearchEnv)
writeJSON file: configName, json: config
sh "cat ${configName}"
}
return configName
......@@ -615,4 +621,30 @@ Void initHelmRepo() {
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}'
}
}
def getElasticsearchSecret(namespace) {
container("k8s"){
script {
def elasticsearch = readJSON ( text: sh (script: "kubectl get secret elasticsearch-credentials -n ${namespace} -o jsonpath={.data}", returnStdout: true))
return elasticsearch
}
}
}
String getElasticsearchEnv(namespace) {
def elasticsearchSecret = getElasticsearchSecret(namespace)
def env = """{
"user":"${decodeString(elasticsearchSecret.username)}", \
"password":"${decodeString(elasticsearchSecret.password)}", \
"index":"${decodeString(elasticsearchSecret.index)}", \
"url":"${decodeString(elasticsearchSecret.uris)}"}"""
return readJSON ( text: env)
}
String decodeString(encoded) {
return sh (script: "echo -n ${encoded} | base64 --decode", returnStdout: true)
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment