Skip to content
Snippets Groups Projects
Commit d98093d8 authored by Christophe Mathias's avatar Christophe Mathias Committed by Pierre SMEYERS
Browse files

feat: add JSON output format for Hadolint report

parent 6cb9d988
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment