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

Introduce Hadolint #105

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: "Docker"

on:
pull_request:
paths:
- "**/Dockerfile"
- ".hadolint.yaml"
push:
branches:
- "main"
paths:
- "**/Dockerfile"
- ".hadolint.yaml"

permissions:
contents: "read"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
hadolint:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to style.yml?

Copy link
Contributor Author

@szepeviktor szepeviktor Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I name actions based on what it cares about, not based on what it does.
E.g. "style" is a job in "back-end" and in "front-end" and in "yaml"
https://github.com/szepeviktor/byte-level-care/tree/master/.github/workflows

Copy link
Contributor Author

@szepeviktor szepeviktor Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you organize workflows based on the activity you will end up with 5 totally different target types in "style.yml".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First let's see its output!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approved the run.

Copy link
Contributor Author

@szepeviktor szepeviktor Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the output: https://github.com/szepeviktor/cachewerk_relay/actions/runs/5732711289/job/15536150993

  • What rules (e.g DL3040) to you want to be corrected?
  • What rules do you want to be ignored?

https://github.com/hadolint/hadolint#rules

Copy link
Contributor Author

@szepeviktor szepeviktor Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the output sorted and grouped by rule code
👉🏻 https://gist.github.com/szepeviktor/16c82e95c3b08906b297a2262728a2bc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of issues and they are pretty strict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point of my work: prevent future problems.

name: "🐳 Hadolint"
runs-on: "ubuntu-22.04"
timeout-minutes: 1
steps:
-
name: "Checkout repository"
uses: "actions/checkout@v3"
-
name: "Check Dockerfiles"
uses: "hadolint/[email protected]"