diff --git a/Jenkinsfile b/Jenkinsfile index c1c240d05ef207061c0d3c6de725f2a7609ac9e8..0e966522203880bcc8d4ac1d3c6072d2a5bf2be9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -341,20 +341,25 @@ Void setAnsibleKubeConfig() { Void checkoutProvisioningRepo(String stage) { withCredentials([usernamePassword(credentialsId: 'jenkins-gitea-access-token', passwordVariable: 'TOKEN', usernameVariable: 'USER')]) { 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') { - // sh 'git checkout ozg-2552-jenkins-e2e' - //} + dir('provisioning') { + sh 'git checkout feature/refactoring' + } } } } Void copyTestEnvironmentToDev(stage) { dir("${stage}/provisioning") { - def devEnvFile = "playbook/inventory/versions/dev.yml" - def testEnvFile = "playbook/inventory/versions/test.yml" + if (env.BRANCH_NAME == 'release') { + def devEnvFile = "playbook/inventory/versions/dev.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 testVersions = readYaml file: testEnvFile @@ -368,7 +373,12 @@ Void copyTestEnvironmentToDev(stage) { Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { dir("${stage}/provisioning") { - def editFile = "playbook/inventory/versions/dev.yml" + if (env.BRANCH_NAME == 'release') { + def editFile = "playbook/inventory/versions/dev.yml" + } + else { + def editFile = "inventory/group_vars/dev/versions" + } def devVersions = readYaml file: editFile @@ -380,8 +390,6 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { devVersions.versions.goofy.image.tag = imageTag writeYaml file: editFile, data: devVersions, overwrite: true - - sh "cat ${editFile}" } } @@ -395,7 +403,13 @@ String getSpringProfile(Boolean isEa) { Void setupEaEnvironment(String stage) { dir("${stage}/provisioning") { - def editFile = "playbook/inventory/group_vars/all.yml" + if (env.BRANCH_NAME == 'release') { + def editFile = "playbook/inventory/group_vars/all.yml" + } + else { + def editFile = "inventory/group_vars/all/env" + } + def groupVars = readYaml file: editFile groupVars.kop_einheitlicher_ansprechpartner = true @@ -406,7 +420,13 @@ Void setupEaEnvironment(String stage) { Void setPlutoDatabasePassword(String stage) { dir("${stage}/provisioning") { - def editFile = "playbook/inventory/versions/dev.yml" + if (env.BRANCH_NAME == 'release') { + def editFile = "playbook/inventory/versions/dev.yml" + } + else { + def editFile = "inventory/group_vars/dev/versions" + } + def devVars = readYaml file: editFile devVars.values.pluto.database.password = "XnHhfznNWg65NNd" @@ -427,7 +447,7 @@ Void rolloutKopStack(String bezeichner, String stage) { "install_fs_adapter":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) { }""" 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) { }""" 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) { "kop_env":"dev", \ "kop_bezeichner":${bezeichner}}""" - sh "ansible-playbook playbook/delete-commune.yml --extra-vars '${ansibleVars}'" + sh "ansible-playbook playbooks/delete-commune.yml --extra-vars '${ansibleVars}'" } } }