Skip to content
Snippets Groups Projects
Unverified Commit 720aca61 authored by Ahmed Hemdan's avatar Ahmed Hemdan
Browse files

Accept debug as input instead of CODECLIMATE_DEBUG variable

parent 9791c32e
No related branches found
No related tags found
No related merge requests found
......@@ -9,12 +9,11 @@ include:
- component: gitlab.com/$CI_PROJECT_PATH@$CI_COMMIT_SHA
inputs:
stage: qa
debug: "1"
# We customize the `code_quality` job to enable verbose logs (for debugging), and to also save the
# code quality report so it can be inspected by other jobs to verify it works correctly.
code_quality:
variables:
CODECLIMATE_DEBUG: 1
artifacts:
paths:
- gl-code-quality-report.json
......
......@@ -31,6 +31,7 @@ where `<VERSION>` is the latest released tag or `main`.
| ----- | ------------- | ----------- |
| `stage` | `test` | The stage where you want the job to be added |
| `image` | `$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/ci-cd/codequality:0.96.0` | The Docker image of the analyzer |
| `debug` | `""` | Set to enable [CodeClimate debug mode](https://github.com/codeclimate/codeclimate#environment-variables) |
### Variables
......
......@@ -4,6 +4,8 @@ spec:
default: test
image:
default: "$CI_TEMPLATE_REGISTRY_HOST/gitlab-org/ci-cd/codequality:0.96.0"
debug:
default: ""
---
code_quality:
......@@ -33,6 +35,12 @@ code_quality:
echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME "
done
}
- |
function codeclimate_debug_var() {
if [ -n "$[[ inputs.debug ]]" ]; then
echo "--env CODECLIMATE_DEBUG=1"
fi
}
- |
if [ -n "$CODECLIMATE_REGISTRY_USERNAME" ] && [ -n "$CODECLIMATE_REGISTRY_PASSWORD" ] && [ -n "$CODECLIMATE_PREFIX" ]; then
CODECLIMATE_REGISTRY=${CODECLIMATE_PREFIX%%/*}
......@@ -44,7 +52,6 @@ code_quality:
$(propagate_env_vars \
SOURCE_CODE \
TIMEOUT_SECONDS \
CODECLIMATE_DEBUG \
CODECLIMATE_DEV \
REPORT_STDOUT \
REPORT_FORMAT \
......@@ -53,6 +60,7 @@ code_quality:
CODECLIMATE_REGISTRY_USERNAME \
CODECLIMATE_REGISTRY_PASSWORD \
) \
$(codeclimate_debug_var) \
--volume "$PWD":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
"$[[ inputs.image ]]" /code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment