From 4b22f443676f9ba89391c0e553e939f7f4cabd53 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Wed, 31 Jan 2024 15:52:41 +0100
Subject: [PATCH] Wrong format for the compiler_definition.yaml

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f4992d9..0a9162e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -114,7 +114,7 @@ spack:install_compilers:
     - .spack_cache
     - .parallel_job
   script:
-    - COMPILER_LIST_SPECS=$(jq -r '.stack | .core_compiler as $core | .compilers | map("\(.spec)@\(.version) %\($core)")[]' config.json)
+    - COMPILER_LIST_SPECS=$(jq -ra '.stack | .core_compiler as $core | .compilers | map("\(.spec)@\(.version) %\($core)")[]' config.json)
     - echo "Compilers to install \n${COMPILER_LIST_SPECS}"
 
     - spack/bin/spack compiler find --scope system /usr
@@ -141,7 +141,7 @@ spack:install_compilers:
       --show-log-on-error
       ${COMPILER_LIST_SPECS}
 
-    - hashes=$(jq -r '.spec.nodes | map("/\(.hash)") | join(" ")' compilers_spec.json)
+    - hashes=$(jq -ra '.spec.nodes | map("/\(.hash)") | join(" ")' compilers_spec.json)
 
     - spack/bin/spack buildcache create
       --update-index
@@ -149,7 +149,8 @@ spack:install_compilers:
       /buildcache ${hashes}
 
     - |
-      echo 'definitions: [ compilers: [' ${COMPILER_LIST_SPECS} ']]' > compiler_definitions.yaml
+      echo 'definitions: [ compilers: ' $(jq -rac '.stack | .core_compiler as $core | .compilers | map("\(.spec)@\(.version) %\($core)")' config.json) ']' > compiler_definitions.yaml
+      cat compiler_definitions.yaml
 
     - |
       while read -r compiler
-- 
GitLab