From 0584e9d297665868b2e9228740324f0085eaf46e Mon Sep 17 00:00:00 2001
From: Lubomir Dolezal <lubomir.bucek@eox.at>
Date: Thu, 20 Jan 2022 16:01:13 +0100
Subject: [PATCH] sort collections keys when checking initdb

to avoid unnecessary changes in CI runs of config generation
---
 charts/vs-registrar/files/init-db.sh | 2 +-
 charts/vs-renderer/files/init-db.sh  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/charts/vs-registrar/files/init-db.sh b/charts/vs-registrar/files/init-db.sh
index f20670c..f6c89d0 100644
--- a/charts/vs-registrar/files/init-db.sh
+++ b/charts/vs-registrar/files/init-db.sh
@@ -86,7 +86,7 @@
 
 # Check if collection exits in database and initialize database only if not
 {{- if .Values.global.collections }}
-if python3 manage.py id check {{ index (keys $.Values.global.collections) 0 | quote }}; then
+if python3 manage.py id check {{ index (keys $.Values.global.collections | sortAlpha) 0 | quote }}; then
     echo "Initializing database"
 
     python3 manage.py coveragetype import /opt/core/rgbnir_definition.json --traceback
diff --git a/charts/vs-renderer/files/init-db.sh b/charts/vs-renderer/files/init-db.sh
index f20670c..f6c89d0 100644
--- a/charts/vs-renderer/files/init-db.sh
+++ b/charts/vs-renderer/files/init-db.sh
@@ -86,7 +86,7 @@
 
 # Check if collection exits in database and initialize database only if not
 {{- if .Values.global.collections }}
-if python3 manage.py id check {{ index (keys $.Values.global.collections) 0 | quote }}; then
+if python3 manage.py id check {{ index (keys $.Values.global.collections | sortAlpha) 0 | quote }}; then
     echo "Initializing database"
 
     python3 manage.py coveragetype import /opt/core/rgbnir_definition.json --traceback
-- 
GitLab