Commit 0ab57ae8 authored by Matija Čupić's avatar Matija Čupić

Update CodeQuality example docs

parent 23230aa8
# Analyze your project's Code Quality # Analyze your project's Code Quality
CAUTION: **Caution:** CAUTION: **Caution:**
The job definition shown below is supported on GitLab 11.5 and later versions. The job definition shown below is supported on GitLab 11.11 and later versions.
It also requires the GitLab Runner 11.5 or later. It also requires the GitLab Runner 11.5 or later.
For earlier versions, use the [previous job definitions](#previous-job-definitions). For earlier versions, use the [previous job definitions](#previous-job-definitions).
...@@ -11,27 +11,11 @@ and Docker. ...@@ -11,27 +11,11 @@ and Docker.
First, you need GitLab Runner with First, you need GitLab Runner with
[docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor). [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor).
Once you set up the Runner, add a new job to `.gitlab-ci.yml` that Once you set up the Runner, include the CodeQuality template in your CI config:
generates the expected report:
```yaml ```yaml
code_quality: include:
image: docker:stable - template: Code-Quality.gitlab-ci.yml
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- 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:
reports:
codequality: gl-code-quality-report.json
``` ```
The above example will create a `code_quality` job in your CI/CD pipeline which The above example will create a `code_quality` job in your CI/CD pipeline which
...@@ -54,6 +38,28 @@ While these old job definitions are still maintained they have been deprecated ...@@ -54,6 +38,28 @@ While these old job definitions are still maintained they have been deprecated
and may be removed in next major release, GitLab 12.0. and may be removed in next major release, GitLab 12.0.
You are advised to update your current `.gitlab-ci.yml` configuration to reflect that change. You are advised to update your current `.gitlab-ci.yml` configuration to reflect that change.
For GitLab 11.5 and earlier, the job should look like:
```yaml
code_quality:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- 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:
reports:
codequality: gl-code-quality-report.json
```
For GitLab 11.4 and earlier, the job should look like: For GitLab 11.4 and earlier, the job should look like:
```yaml ```yaml
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment