From 7c0b1df2391da7b65fe5290d2d0fa9fcd641e171 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Thu, 27 Apr 2023 10:47:49 +0200
Subject: [PATCH] fix(ci-lint): ci-lint API changes

---
 templates/validation.yml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/templates/validation.yml b/templates/validation.yml
index 95e8fb8..cbdd382 100644
--- a/templates/validation.yml
+++ b/templates/validation.yml
@@ -32,13 +32,14 @@
     for file in $(eval "ls -1 $GITLAB_CI_FILES")
     do
       log_info "Validating: $file..."
-      REQUEST="{\"content\": $(jq --raw-input --slurp '.'  < "${file:-/dev/stdin}")}"
-      RESULT=$(curl -s --header "Content-Type: application/json" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $CI_API_V4_URL/ci/lint --data "$REQUEST")
-      if [ "$(echo "$RESULT" |  jq '.status')" == "\"valid\"" ]
+      cilint_req="{\"content\": $(jq --raw-input --slurp '.'  < "${file:-/dev/stdin}")}"
+      cilint_resp=$(curl -s --header "Content-Type: application/json" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/ci/lint --data "$cilint_req")
+      if [ "$(echo "$cilint_resp" | jq -r '.valid')" == "true" ]
       then
-        log_info " ... valid ($RESULT)"
+        log_info " ... valid"
       else
-        log_error " ... invalid: $RESULT"
+        log_error " ... invalid"
+        echo "$cilint_resp" | jq -r '.errors[]'
         rc=1
       fi
     done
-- 
GitLab