From 67638ffbb7486a7e262bde0748773fc1c912d47c Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 17 Apr 2025 08:31:24 +0200
Subject: [PATCH] generate cdb

---
 .gitlab-ci.yml | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd41d11e2..6013e0d48 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -61,9 +61,33 @@ run_shellcheck:
     STATIONS: cs001 cs032 rs307
     COMPONENTS: mesh-gateway monitoring logging tango object-storage object-replication sdptr device-server dsconfig ec-sim jupyter snmp-exporter landing-page rpc-server
 
+# Generate TangoDB configuration files for each station, serving as a default configuration
+# if none exists yet.
+generate_CDB:
+  extends: .components
+  stage: render
+  needs:
+    - trigger_prepare
+  when: manual
+  script:
+    - |
+      mkdir generate-cdb
+
+      for STATION in ${STATIONS}; do
+        echo "Generating CDB for station $STATION"
+        LCU_IP=1.2.3.4 # hack, get this from NetBox
+        python $CI_PROJECT_DIR/tangostationcontrol/toolkit/generate_cdb_from_lofar1.py -s ${STATION} -C -l ${LCU_IP} > generate-cdb/${STATION}.json
+      done
+  artifacts:
+    expire_in: 4 weeks
+    expose_as: 'generated cdb files'
+    name: generated-cdb-files
+    paths:
+      - generate-cdb/
+
 # Collect TangoDB configuration files for each station, to be fed to dsconfig to populate
 # the Tango devices and their station-specific properties.
-render_CDB:
+collect_CDB:
   extends: .components
   stage: render
   needs: []
@@ -163,7 +187,7 @@ render_levant:
 
 test_CDB_correctness:
   needs:
-   - render_CDB
+   - collect_CDB
   stage: test
   script:
     - |
-- 
GitLab