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

OZG-3184 e2e on new cluster

parent 7c892b20
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,8 @@ pipeline {
RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
BUNDESLAND = "by"
CLUSTER_BASE_URL = "dev.by.kop-cloud.de"
SSO_URL = "sso.dev.by.kop-cloud.de"
CLUSTER_BASE_URL = "apps01.dev.by.kop-cloud.de"
FAILED_STAGE = ""
IMAGE_TAG = ""
VERSION = ""
......@@ -409,6 +410,7 @@ Void setupAnsible(String imageTag, String stage, Boolean isEa, String chartVersi
copyTestEnvironmentToDev(stage)
}
editProvisioningBundesland(stage)
editEnvironemntVersion(stage, imageTag, isEa, chartVersion)
if (isEa) {
......@@ -473,6 +475,17 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa, String
}
}
Void editProvisioningBundesland(String stage) {
dir("${stage}/provisioning") {
def editEnvFile = "inventories/group_vars/all/env"
def envVersions = readYaml file: editEnvFile
envVersions.kop_bundesland = env.BUNDESLAND
writeYaml file: editEnvFile, data: envVersions, overwrite: true
}
}
String getSpringProfile(Boolean isEa) {
if (isEa) {
return "oc,ea,e2e,dev"
......@@ -601,7 +614,7 @@ Void publishE2ETestResult(String reportFolder, String reportName) {
}
String runTests(String stageName, String bezeichner, String reportFolder, Integer dbPort) {
def configFile = generateCypressConfig(stageName, bezeichner, reportFolder, env.BUNDESLAND, dbPort)
def configFile = generateCypressConfig(stageName, bezeichner, reportFolder, dbPort)
try {
dir("goofy-client") {
......@@ -650,6 +663,7 @@ String generateCypressConfig(String stage, String bezeichner, String testFolder,
config.baseUrl = "https://${bezeichner}.${env.CLUSTER_BASE_URL}" as String
config.env.dbUrl = "mongodb://pluto-database-user:XnHhfznNWg65NNd@localhost:${dbPort}/admin?ssl=false&directConnection=true" as String
config.env.keycloakUrl = "https://${env.SSO_URL}/" as String
config.env.keycloakRealm = namespace as String
config.env.keycloakClient = namespace + "-goofy" as String
config.env.sabineUuid = getKeycloakUuid(namespace, "sabine") as String
......@@ -689,7 +703,7 @@ def getSecrect(namespace, secretName){
String getKeycloakUuid(realm, userName) {
def shScript = """curl -H 'Content-Type: application/json' \
-H 'Authorization: bearer ${getKeycloakAccessToken()}' \
'https://sso.${env.CLUSTER_BASE_URL}/admin/realms/${realm}/users'
'https://${env.SSO_URL}/admin/realms/${realm}/users'
"""
def users = readJSON text: sh(script: shScript, returnStdout: true)
......@@ -703,8 +717,7 @@ String getKeycloakUuid(realm, userName) {
String getKeycloakAccessToken() {
withCredentials([usernamePassword(credentialsId: 'keycloak-dev-cluster', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
def ssoURL = "https://sso.${env.CLUSTER_BASE_URL}/realms/master/protocol/openid-connect/token"
def token = readJSON text: sh (script: 'curl -d "client_id=admin-cli" -d "username=$USER" -d "password=$PASSWORD" -d "grant_type=password" $ssoUrl', returnStdout: true)
def token = readJSON text: sh (script: 'curl -d "client_id=admin-cli" -d "username=$USER" -d "password=$PASSWORD" -d "grant_type=password" https://$SSO_URL/realms/master/protocol/openid-connect/token', returnStdout: true)
return token.access_token
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment