diff --git a/.ci-scripts/lint.sh b/.ci-scripts/lint.sh new file mode 100644 index 0000000000000000000000000000000000000000..682abc331750f93baa781513acb21342b65cc181 --- /dev/null +++ b/.ci-scripts/lint.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +jq --null-input --arg yaml "$1" '.content=$yaml' \ + | curl "https://git.ethitter.com/api/v4/ci/lint?include_merged_yaml=true" \ + --silent \ + --header 'Content-Type: application/json' \ + --header "PRIVATE-TOKEN: $GITLAB_API_PAT" \ + --data @- \ + -o result.json + +echo "**********************************************************" +echo "MERGED YAML:" +jq --raw-output '.merged_yaml' < result.json + +echo "**********************************************************" +echo "ERRORS:" +jq '.errors' < result.json + +echo "**********************************************************" +echo "WARNINGS:" +jq '.warnings' < result.json + +echo "**********************************************************" +echo "IS VALID:" +jq '.valid' < result.json + +if [ "$(jq '.valid' < result.json)" = "true" ]; 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 new file mode 100644 index 0000000000000000000000000000000000000000..838bbf3ea6ccaba10d2ba30b31048851cf8af63d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,18 @@ +before_script: + - | + apt-get update + apt-get -y --no-install-recommends install jq + apt-get clean + rm -rf /var/lib/apt/lists/* + +lint:plugins:default: + stage: test + image: containers.ethitter.com:443/docker/images/debian:bullseye + script: + - 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)"