From d7e01d44ad6a30d6a5af0b90fdcd8d3e7eb2cf52 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Fri, 9 Dec 2022 16:51:41 +0100
Subject: [PATCH] PIPELINE: fix generation of version.json

---
 .gitlab-ci.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5528c59..59ce666 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,18 +41,18 @@ add-commit:
     - echo ",{\"server\"${COLON} \"$SERVER\", \"mysqlbackend\"${COLON} \"$MYSQL\", \"pylib\"${COLON} \"$PYLIB\", \"webui\"${COLON} \"$WEBUI\" }" >> versions.json
 
       # add closing ] again
-    - echo "\n]"
+    - echo "\n]" >> versions.json
 
       # create the commit.json which is to send to the commit api of gitlab
     - echo -n "{\"branch\"${COLON} \"main\", \"commit_message\"${COLON} \"new commit via ci pipeline\", \"actions\"${COLON} [ { \"action\"${COLON} \"update\", \"file_path\"${COLON} \"versions.json\", \"encoding\"${COLON} \"base64\", \"content\"${COLON} \"" > commit.json
     - echo -n "$(base64 versions.json)" >> commit.json
     - echo -n '" } ] }' >> commit.json
 
-      # for debugging
-    - cat commit.json
+    - DATA="$(cat commit.json)"
+    - echo "$DATA"
 
       # commit the changes (which then triggers the pages job)
-    - curl --fail-with-body --request POST --header "PRIVATE-TOKEN${COLON} $CIPRIVATETOKEN" --header "Content-Type${COLON} application/json" --data "$(cat commit.json)" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits"
+    - curl --fail-with-body --request POST --header "PRIVATE-TOKEN${COLON} $CIPRIVATETOKEN" --header "Content-Type${COLON} application/json" --data "$DATA" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits"
 
 pages:
   rules:
-- 
GitLab