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

e2e ansible refactoring

parent 74c41bf8
Branches
Tags
No related merge requests found
...@@ -343,18 +343,23 @@ Void checkoutProvisioningRepo(String stage) { ...@@ -343,18 +343,23 @@ Void checkoutProvisioningRepo(String stage) {
dir(stage) { dir(stage) {
sh 'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/provisioning.git' sh 'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/provisioning.git'
// todo remove git checkout dir('provisioning') {
//dir('provisioning') { sh 'git checkout feature/refactoring'
// sh 'git checkout ozg-2552-jenkins-e2e' }
//}
} }
} }
} }
Void copyTestEnvironmentToDev(stage) { Void copyTestEnvironmentToDev(stage) {
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
if (env.BRANCH_NAME == 'release') {
def devEnvFile = "playbook/inventory/versions/dev.yml" def devEnvFile = "playbook/inventory/versions/dev.yml"
def testEnvFile = "playbook/inventory/versions/test.yml" def testEnvFile = "playbook/inventory/versions/test.yml"
}
else {
def devEnvFile = "inventory/group_vars/dev/versions"
def testEnvFile = "inventory/group_vars/test/versions"
}
def devVersions = readYaml file: devEnvFile def devVersions = readYaml file: devEnvFile
def testVersions = readYaml file: testEnvFile def testVersions = readYaml file: testEnvFile
...@@ -368,7 +373,12 @@ Void copyTestEnvironmentToDev(stage) { ...@@ -368,7 +373,12 @@ Void copyTestEnvironmentToDev(stage) {
Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
if (env.BRANCH_NAME == 'release') {
def editFile = "playbook/inventory/versions/dev.yml" def editFile = "playbook/inventory/versions/dev.yml"
}
else {
def editFile = "inventory/group_vars/dev/versions"
}
def devVersions = readYaml file: editFile def devVersions = readYaml file: editFile
...@@ -380,8 +390,6 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { ...@@ -380,8 +390,6 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
devVersions.versions.goofy.image.tag = imageTag devVersions.versions.goofy.image.tag = imageTag
writeYaml file: editFile, data: devVersions, overwrite: true writeYaml file: editFile, data: devVersions, overwrite: true
sh "cat ${editFile}"
} }
} }
...@@ -395,7 +403,13 @@ String getSpringProfile(Boolean isEa) { ...@@ -395,7 +403,13 @@ String getSpringProfile(Boolean isEa) {
Void setupEaEnvironment(String stage) { Void setupEaEnvironment(String stage) {
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
if (env.BRANCH_NAME == 'release') {
def editFile = "playbook/inventory/group_vars/all.yml" def editFile = "playbook/inventory/group_vars/all.yml"
}
else {
def editFile = "inventory/group_vars/all/env"
}
def groupVars = readYaml file: editFile def groupVars = readYaml file: editFile
groupVars.kop_einheitlicher_ansprechpartner = true groupVars.kop_einheitlicher_ansprechpartner = true
...@@ -406,7 +420,13 @@ Void setupEaEnvironment(String stage) { ...@@ -406,7 +420,13 @@ Void setupEaEnvironment(String stage) {
Void setPlutoDatabasePassword(String stage) { Void setPlutoDatabasePassword(String stage) {
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
if (env.BRANCH_NAME == 'release') {
def editFile = "playbook/inventory/versions/dev.yml" def editFile = "playbook/inventory/versions/dev.yml"
}
else {
def editFile = "inventory/group_vars/dev/versions"
}
def devVars = readYaml file: editFile def devVars = readYaml file: editFile
devVars.values.pluto.database.password = "XnHhfznNWg65NNd" devVars.values.pluto.database.password = "XnHhfznNWg65NNd"
...@@ -427,7 +447,7 @@ Void rolloutKopStack(String bezeichner, String stage) { ...@@ -427,7 +447,7 @@ Void rolloutKopStack(String bezeichner, String stage) {
"install_fs_adapter":false, \ "install_fs_adapter":false, \
"external_db_enabled":false}""" "external_db_enabled":false}"""
sh "ansible-playbook playbook/rollout.yml --extra-vars '${ansibleVars}'" sh "ansible-playbook playbooks/rollout.yml --extra-vars '${ansibleVars}'"
} }
} }
} }
...@@ -446,7 +466,7 @@ Void addKeycloakGroups(String bezeichner, String stage) { ...@@ -446,7 +466,7 @@ Void addKeycloakGroups(String bezeichner, String stage) {
}""" }"""
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
sh "ansible-playbook playbook/add-keycloak-group.yml --extra-vars '${ansibleVars}'" sh "ansible-playbook playbooks/add-keycloak-group.yml --extra-vars '${ansibleVars}'"
} }
} }
} }
...@@ -466,7 +486,7 @@ Void addKeycloakUser(String bezeichner, String stage) { ...@@ -466,7 +486,7 @@ Void addKeycloakUser(String bezeichner, String stage) {
}""" }"""
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
sh "ansible-playbook playbook/add-keycloak-user.yml --extra-vars '${ansibleVars}'" sh "ansible-playbook playbooks/add-keycloak-user.yml --extra-vars '${ansibleVars}'"
} }
} }
} }
...@@ -479,7 +499,7 @@ Void deleteKopStack(String bezeichner, String stage) { ...@@ -479,7 +499,7 @@ Void deleteKopStack(String bezeichner, String stage) {
"kop_env":"dev", \ "kop_env":"dev", \
"kop_bezeichner":${bezeichner}}""" "kop_bezeichner":${bezeichner}}"""
sh "ansible-playbook playbook/delete-commune.yml --extra-vars '${ansibleVars}'" sh "ansible-playbook playbooks/delete-commune.yml --extra-vars '${ansibleVars}'"
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment