Merge branch 'update_code_quality_job' into 'master'
Use standard codequality job See merge request gitlab-org/gitlab-ce!18070
This commit is contained in:
commit
6587a0cdbb
2 changed files with 8 additions and 25 deletions
|
@ -618,7 +618,8 @@ karma:
|
||||||
|
|
||||||
codequality:
|
codequality:
|
||||||
<<: *dedicated-no-docs-no-db-pull-cache-job
|
<<: *dedicated-no-docs-no-db-pull-cache-job
|
||||||
image: docker:latest
|
image: docker:stable
|
||||||
|
allow_failure: true
|
||||||
# gitlab-org runners set `privileged: false` but we need to have it set to true
|
# gitlab-org runners set `privileged: false` but we need to have it set to true
|
||||||
# since we're using Docker in Docker
|
# since we're using Docker in Docker
|
||||||
tags: []
|
tags: []
|
||||||
|
@ -628,14 +629,15 @@ codequality:
|
||||||
variables:
|
variables:
|
||||||
SETUP_DB: "false"
|
SETUP_DB: "false"
|
||||||
DOCKER_DRIVER: overlay2
|
DOCKER_DRIVER: overlay2
|
||||||
CODECLIMATE_FORMAT: json
|
|
||||||
cache: {}
|
cache: {}
|
||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
script:
|
||||||
- apk update && apk add jq
|
# Get the custom rubocop codeclimate image (https://gitlab.com/gitlab-org/codeclimate-rubocop/wikis/home)
|
||||||
- ./scripts/codequality analyze -f json > raw_codeclimate.json || true
|
- docker pull dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1
|
||||||
# The following line keeps only the fields used in the MR widget, reducing the JSON artifact size
|
- docker tag dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1 codeclimate/codeclimate-rubocop:gitlab-codeclimate-rubocop-0-52-1
|
||||||
- jq -c 'map({check_name,description,fingerprint,location})' raw_codeclimate.json > codeclimate.json
|
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" for Security Products
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run --env SOURCE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||||
artifacts:
|
artifacts:
|
||||||
paths: [codeclimate.json]
|
paths: [codeclimate.json]
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
code_path=$(pwd)
|
|
||||||
|
|
||||||
# docker run --tty will merge stderr and stdout, we don't need this on CI or
|
|
||||||
# it will break codequality json file
|
|
||||||
[ "$CI" != "" ] || docker_tty="--tty"
|
|
||||||
|
|
||||||
# The codebase and instructions for the following image can be found at https://gitlab.com/gitlab-org/codeclimate-rubocop/wikis/home
|
|
||||||
docker pull dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1 > /dev/null
|
|
||||||
docker tag dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1 codeclimate/codeclimate-rubocop:gitlab-codeclimate-rubocop-0-52-1 > /dev/null
|
|
||||||
|
|
||||||
exec docker run --rm $docker_tty --env CODECLIMATE_CODE="$code_path" \
|
|
||||||
--volume "$code_path":/code \
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
|
||||||
--volume /tmp/cc:/tmp/cc \
|
|
||||||
"codeclimate/codeclimate:${CODECLIMATE_VERSION:-0.71.1}" "$@"
|
|
Loading…
Reference in a new issue