diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml index fd1a44b5480e92aa5553a4851381b6d1fc479337..7fdc9117a1c401c0a4997198dcc6b257dbc52726 100644 --- a/templates/gitlab-ci-docker.yml +++ b/templates/gitlab-ci-docker.yml @@ -451,18 +451,20 @@ docker-hadolint: - autoconfig_hadolint - mkdir -p reports - chmod o+rwx reports - - hadolint_report_name="hadolint-$(md5sum "$DOCKER_FILE" | cut -d" " -f1).json" - # Force one run with tty format in order to have a nice output without failure - - hadolint --no-fail $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" - # Make one run with ad hoc output for gitlab integration - - hadolint -f gitlab_codeclimate $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" > "reports/$hadolint_report_name" + - dockerfile_hash=$(md5sum "$DOCKER_FILE" | cut -d" " -f1) + # Output in Code Climate format (GitLab integration) + - hadolint --no-fail -f gitlab_codeclimate $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" > "reports/hadolint-cc-${dockerfile_hash}.json" + # Output in JSON format + - hadolint --no-fail -f json $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" > "reports/hadolint-json-${dockerfile_hash}.json" + # las run with console output (with failure) + - hadolint $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" expire_in: 1 day when: always reports: codequality: - - "reports/hadolint-*.json" + - "reports/hadolint-cc-*.json" paths: - "reports/hadolint-*.json" rules: