diff --git a/templates/validation.yml b/templates/validation.yml index 95e8fb80c0be1b0095823ed553cecc0a6299367f..cbdd382fe0df404831b38792de5bbcb7aa351a1e 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