Today, while trying to setup CodeQuality in my .gitlab-ci.yml
(on gitlab-ee 11.10
, gitlab-runner 11.10
) I encountered the following issue:
First thing the GitLab documentation tells you is it is possible to set this with help of a DockerInDocker gitlab-runner
and a single configuration line:
include:
- template: Code-Quality.gitlab-ci.yml
There is also disclaimer that this is supported in gitlab 11.11
or later, which is strange because as of April 23rd 2019, the latest version is 11.10
. Not sure if this a typo or if they publish documentation before the releases are actually available.
I tried following this instructions but many things are unclear:
I realized that the
include
statement should be added after thestages
definition for the syntax check to pass.A
code_quality
job showed up and passed:
(source: cozyo.io)
However, later I learned from this answer that I need to create a .codeclimate.yml
file and somehow add it .gitlab-ci.yml
. That answer shares two links that can be used to understand how to work with CodeClimate
but I'm haven't figured a way to add to gitlab-ci.yml
. I found some example in this gitlab related page BUT this is not using the include
statement described in the docs.
- I'm unable to find the report of the
code_quaity
job that passed. In this answer someone pointed out that the report is only available for download on the merge request forgitlab-ee
. However this is not practical since then devs would have to start spamming mock merge request just to see if they code suffered down grades.
The gitlab-ci.yml
I use looks something like this:
image: docker:stable
variables:
ARTEFACT: my_app
VERSION: 0.1
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:dind
before_script:
- docker info
stages:
- build
- test
- deploy
build:
stage: build
script:
- docker build -t $ARTEFACT:$VERSION-DEV .
test:
stage: test
script:
- docker run --rm --env MODE=DEV $ARTEFACT:$VERSION-DEV ./my_test.sh
include:
- template: Code-Quality.gitlab-ci.yml
Ideally, this should be a simple as figuring out how to use CodeClimate
for python applications and then adding its configuration to the repo and referencing in gitlab-ci.yml
correct? But how to make the reference. Is there any clear documentation available somewhere?
EDIT: I now know that jobs are independent and that I should modify the build
stage in the .gitlab-ci.yml
above to push the build image somewhere other jobs can pull from. Still this doesn't help to solve the CodeQuality problem I think.