From 884c6dbe64500d0f6a3d1a60e577003d0f2552b7 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 13 Oct 2022 18:35:52 +0200
Subject: [PATCH] ozg-2502 ansible refactoring

---
 Jenkinsfile | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 7a1b9d8a6e..550fe2082f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -638,7 +638,11 @@ Void initHelmRepo() {
 
 Void setNewGoofyProvisioningVersion(String environment) {
     dir("provisioning") {
-        def envFile = "playbook/inventory/versions/${environment}.yml"
+        def envFile = "inventories/group_vars/${environment}/versions"
+
+        if (env.BRANCH_NAME == 'release') {
+            envFile = "playbook/inventory/versions/${environment}.yml"
+        }
         def envVersions = readYaml file: envFile
 
         envVersions.versions.goofy.image.tag = IMAGE_TAG
@@ -650,7 +654,12 @@ Void setNewGoofyProvisioningVersion(String environment) {
 Void pushNewProvisioningVersion(String environment) {
     withCredentials([usernamePassword(credentialsId: 'jenkins-gitea-access-token', passwordVariable: 'TOKEN', usernameVariable: 'USER')]) {       
         dir('provisioning') {
-            sh 'git add playbook/inventory/versions/.'
+            if (env.BRANCH_NAME == 'release') {
+                sh 'git add playbook/inventory/versions/.'
+            }
+            else {
+                sh 'git add inventories/group_vars/*/versions'
+            }
             sh 'git config user.email "jenkins@ozg.de"'
             sh 'git config user.name "jenkins"'
             sh "git commit -m 'jenkins rollout ${environment} goofy version ${IMAGE_TAG}'"
-- 
GitLab