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

ci: add docker linter #5047

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

ci: add docker linter #5047

wants to merge 2 commits into from

Conversation

inosmeet
Copy link

@inosmeet inosmeet commented Feb 15, 2025

Proposed changes

This PR proposes a ci linter for docker files that runs on PRs that have updated any **/Dockerfile*.
Closes: #1522

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)
  • [ ]

Dependency

Local test success:

litmus on  lint [?] took 32s ➜ ./bin/act -W .github/workflows/docker-lint.yml
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
[Docker Linter/docker-lint] ⭐ Run Set up job
[Docker Linter/docker-lint] 🚀  Start image=hadolint/hadolint:latest-debian
[Docker Linter/docker-lint]   🐳  docker pull image=hadolint/hadolint:latest-debian platform= username= forcePull=true
[Docker Linter/docker-lint] using DockerAuthConfig authentication for docker pull
[Docker Linter/docker-lint]   🐳  docker create image=hadolint/hadolint:latest-debian platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Docker Linter/docker-lint]   🐳  docker run image=hadolint/hadolint:latest-debian platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Docker Linter/docker-lint]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[Docker Linter/docker-lint]   ✅  Success - Set up job
[Docker Linter/docker-lint] ⭐ Run Main Checkout code
[Docker Linter/docker-lint]   🐳  docker cp src=/home/meet/open-source/litmus/. dst=/home/meet/open-source/litmus
[Docker Linter/docker-lint]   ✅  Success - Main Checkout code
[Docker Linter/docker-lint] ⭐ Run Main Lint Dockerfiles
[Docker Linter/docker-lint]   🐳  docker exec cmd=[sh -e /var/run/act/workflow/1.sh] user= workdir=
| ./chaoscenter/upgrade-agents/control-plane/Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/upgrade-agents/control-plane/Dockerfile:21 DL3006 warning: Always tag the version of an image explicitly
| ./chaoscenter/subscriber/Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/event-tracker/Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/dex-server/Dockerfile:1 DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
| ./chaoscenter/authentication/Dockerfile:15 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/graphql/server/Dockerfile:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/web/Dockerfile:3 DL3038 warning: Use the -y switch to avoid manual input `dnf install -y <package`
| ./chaoscenter/web/Dockerfile:3 DL3040 warning: `dnf clean all` missing after dnf command.
| ./chaoscenter/web/Dockerfile:3 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
| ./chaoscenter/web/Dockerfile:3 DL3041 warning: Specify version with `dnf install -y <package>-<version>`.
| ./chaoscenter/web/Dockerfile:4 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
[Docker Linter/docker-lint]   ✅  Success - Main Lint Dockerfiles
[Docker Linter/docker-lint] ⭐ Run Complete job
[Docker Linter/docker-lint] Cleaning up container for job docker-lint
[Docker Linter/docker-lint]   ✅  Success - Complete job
[Docker Linter/docker-lint] 🏁  Job succeeded

@inosmeet
Copy link
Author

cc @ispeakc0de @Jonsy13

@inosmeet
Copy link
Author

Failing tests docker-build-event-tracker and docker-build-subscriber doesn't seems to be related to my code change. And CIFuzz uses deprecated version for uploading artifact (v3).

After digging the code, some other places also have deprecate use of artifacts, should I raise a separate PR for that?

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

Successfully merging this pull request may close these issues.

Include Dockerfile linter in the CI
2 participants