diff --git a/.ci-scripts/lint.sh b/.ci-scripts/lint.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c875b085588e42397dcfd89850f95c2a1098678 --- /dev/null +++ b/.ci-scripts/lint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +jq --null-input --arg yaml "$1" '.content=$yaml' \ + | curl -vvv "https://git.ethitter.com/api/v4/ci/lint?include_merged_yaml=true" \ + --header 'Content-Type: application/json' \ + --header "PRIVATE-TOKEN: $GITLAB_API_PAT" \ + --data @- -o result.json + +jq --raw-output '.merged_yaml' < result.json +jq '.errors' < result.json +jq '.warnings' < result.json + +if [[ true == $(jq '.valid' < result.json) ]]; then + exit 0 +else + exit 1 +fi diff --git a/.gitignore b/.gitignore index c38fa4e005685a861be5fdbe8fcbb03f84a216b0..b5d13acb256d175e8272861d347920fd4c1e7736 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea *.iml + +result.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b5d1e78fcd23af6f730377bded51319a03a26c0..838bbf3ea6ccaba10d2ba30b31048851cf8af63d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,14 @@ before_script: apt-get clean rm -rf /var/lib/apt/lists/* -Lint:plugins:default: +lint:plugins:default: stage: test image: containers.ethitter.com:443/docker/images/debian:bullseye script: - - | - jq --null-input --arg yaml "$(<./plugins/default.yml)" '.content=$yaml' \ - | curl "https://git.ethitter.com/api/v4/ci/lint?include_merged_yaml=true" \ - --header 'Content-Type: application/json' \ - --header "PRIVATE-TOKEN: $GITLAB_API_PAT" \ - --data @- + - sh ./.ci-scripts/lint.sh "$(<./plugins/default.yml)" + +lint:plugins:default-redis: + stage: test + image: containers.ethitter.com:443/docker/images/debian:bullseye + script: + - sh ./.ci-scripts/lint.sh "$(<./plugins/default-redis.yml)"