Skip to content

The --failure-threshold setting is treated as inclusive instead of exclusive #788

@kingrichard2005

Description

@kingrichard2005
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

hadolint should treat the --failure-threshold setting as exclusive per documentation which indicates Exit with failure code only when rules with a severity above THRESHOLD are violated.

Actual behavior

hadolint treats the --failure-threshold setting as inclusive i.e. if the number of validation errors is equal to or greater than the threshold, the lint validation fails.

Steps to reproduce the behavior

Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version or
docker run --rm ghcr.io/hadolint/hadolint hadolint --version:

:: Not sure if this is a separate issue, but using the latest version 2.8.0 Windows binaries 
:: outputs UNKNOWN instead of the version number
C:\path\to\hadolint.exe --version
Haskell Dockerfile Linter UNKNOWN

C:\path\to\hadolint\hadolint.exe --failure-threshold info C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile
C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile:18 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

C:\path\to\ echo %ErrorLevel%
1

C:\path\to\hadolint\hadolint.exe --failure-threshold warning C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile
C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
C:\srcs\33\docker-base-images\node-10-buster-slim\Dockerfile:18 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

C:\path\to\ echo %ErrorLevel%
0

Dockerfile (if relevant)

FROM node:10.22-buster-slim

ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates=20200601~deb10u2 \
        tzdata=2021a-0+deb10u1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/share/ca-certificates/my-ca-certificates
COPY ./certs .
	
RUN update-ca-certificates --fresh

RUN useradd -rm -d /home/debian -s /bin/bash -g root -G sudo -u 1001 debian

RUN yarn config set @my-private-repo:registry https://artifactory.my-private-repo.com/artifactory/api/npm/ows-npm-virtual

WORKDIR /

Additional environment details (OS, stack version, etc.)

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18363 N/A Build 18363

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions