Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No hadolint failure but Actions job fails #60

Closed
gakugaku opened this issue May 19, 2022 · 16 comments · Fixed by #71
Closed

Error: No hadolint failure but Actions job fails #60

gakugaku opened this issue May 19, 2022 · 16 comments · Fixed by #71

Comments

@gakugaku
Copy link

gakugaku commented May 19, 2022

No hadolint failure but Actions job fails when executing below actions.

Execution log

error

Actions yaml (part of hadolint job)

  lint-dockerfile:
    runs-on: ubuntu-20.04
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@v3

      - name: hadolint (dockerfile linter)
        uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183
        with:
          recursive: true

Workaround: Actions success when setting failure-threshold: "warning" option.
But even if hadolint fails with info severity, Actions job will succeed😢.

error2

  lint-dockerfile:
    runs-on: ubuntu-20.04
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@v3

      - name: hadolint (dockerfile linter)
        uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183
        with:
          recursive: true
          failure-threshold: "warning"
@hatamiarash7
Copy link

I have this problem too

@FrankGiesecke
Copy link

Same problem an currently no solution 😢

@FrankGiesecke
Copy link

The problem seems to be, that some errors/warnings/infos are not displayed in the log.
I have a Dockerfile which doesn't contain any ignore statements.
In my first run, my .hadolint.yaml only contains the exclusion for DL3018.
If I run Hadolint from CLI, I get the message:

Dockerfile:13 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

But in the CI, no message is displayed but the step fails.

If I add the exclusion for DL3059, the CI step succeeds.

@erzz
Copy link

erzz commented Jun 1, 2022

I hate to leave me too messages - but me too :)

Also I believe that if you write the report to file it also is empty

@ViacheslavKudinov
Copy link
Contributor

Same here.
Had to switch back to v2.0.0, this works fine.

FrankGiesecke added a commit to final-gene/docker-hub-template that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-github-release that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-coverage-check that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-sonar-scanner that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-box-builder that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-heroku-cli that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-ansible that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-php-cli that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-openssh that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-lessc that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-phing that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-phpmd that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-phpcs that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-lftp that referenced this issue Jul 20, 2022
FrankGiesecke added a commit to final-gene/docker-hub-dpl that referenced this issue Jul 20, 2022
@ReenigneArcher
Copy link

I've been experiencing this same issue for a couple of months. Is this project still maintained? Last activity seems to be in May.

@ReenigneArcher
Copy link

I found that if you re-run the job with debug logging enabled you will see some output.

@brpaz
Copy link
Collaborator

brpaz commented Nov 20, 2022

For me it worked to set failure-threshold to error or warning

According to the documentation, the default is info. I don´t know how this works internally in Hadolint, but my theory, is that info is making the pipeline fail with any output, even if it has no errors.

Ex:

 - name: Lint Dockerfile
    uses: hadolint/hadolint-action@v3.0.0
    with:
      dockerfile: Dockerfile
      failure-threshold: error

error should probably be the default value, as I think this is what most people would like to fail the pipeline and then they could override to warning for a more strict workflow.

michaelamattes added a commit to telekom-mms/docker-management-container that referenced this issue Dec 21, 2022
@maxhelias
Copy link

Not sure but this seems to be related to #55

@rene-bos
Copy link

This issue has been fixed by the 3.0.0 release for us (we also pinned at 2.0.0 to avoid having this problem).

@maxhelias
Copy link

I still have it on 3.0.0 and even on master : https://github.com/dunglas/symfony-docker/actions/runs/3765268860/jobs/6400565741

DracoBlue added a commit to DracoBlue/hadolint-action that referenced this issue Jan 17, 2023
@DracoBlue
Copy link
Contributor

You need to set output-file to /dev/stdout.

I added a PR for this at #71

@humphd
Copy link

humphd commented Feb 8, 2023

Setting v3.0.0 up tonight, and it fails like many people are mentioning above, unless I explicitly include failure-threshold: error:

    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Run Hadolint on Dockerfile
        uses: hadolint/hadolint-action@v3.0.0
        with:
          dockerfile: Dockerfile
          # it will fail with no error if I omit this...
          failure-threshold: error

@DracoBlue
Copy link
Contributor

@humphd please use 3.1.0 and the error messages should be visible

@DracoBlue
Copy link
Contributor

I created a PR at #75 to ensure people are not copying v3.0.0 from the README.md

@humphd
Copy link

humphd commented Feb 8, 2023

@DracoBlue that's excellent, thank you for the info and fixing the README. Appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.