diff --git a/DefineAndRunPipeline/webservice/.gitlab-ci.yml b/DefineAndRunPipeline/webservice/.gitlab-ci.yml index b6afd7d40c234d558db974a9d11c1ad49fbd0b7c..817d6c4178f852ad60bae9e83c4b6fec60444d6c 100644 --- a/DefineAndRunPipeline/webservice/.gitlab-ci.yml +++ b/DefineAndRunPipeline/webservice/.gitlab-ci.yml @@ -16,6 +16,7 @@ variables: stages: - build - test + - lint - deploy .image: @@ -43,6 +44,31 @@ test-job: - go mod download - go test -v ./... +lint-job: + stage: lint + extends: + - .image + image: golangci/golangci-lint:v1.55.2-alpine + variables: + CONFIG_FILE_LINK: https://gitlab.com/gitlab-ci-utils/config-files/-/raw/10.1.1/Linters/.golangci.yml + rules: + - exists: + - '**/*.go' + before_script: + - apk add jq + - if [ ! -f .golangci.yml ]; then (wget $CONFIG_FILE_LINK) fi + - cd DefineAndRunPipeline/webservice + script: + - > + golangci-lint run --out-format code-climate $LINT_GO_CLI_ARGS | + tee gl-code-quality-report.json | + jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"' + artifacts: + reports: + codequality: gl-code-quality-report.json + paths: + - DefineAndRunPipeline/webservice/$GO_BIN_PATH*/gl-code-quality-report.json + allow_failure: true deploy-job: stage: deploy