diff --git a/Jenkinsfile b/Jenkinsfile index 5af15dcbbaeb532c2c4b644d5690cb07e2396e42..44b00e3d68fc91122eb33faf68d6020c18426ec6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 }