8000 DL3007: Do not error out when latest tag is used alongside a sha256 by JohanLorenzo · Pull Request #739 · hadolint/hadolint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DL3007: Do not error out when latest tag is used alongside a sha256 #739

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

Merged
merged 1 commit into from
Nov 29, 2021

Conversation

JohanLorenzo
Copy link
Contributor

Hello there! 👋

Thank you for creating and maintaining hadolint! I stumbled upon it about a month ago and it really helped me preventing some footguns. I love the fact this linter can save some of my time 👍

What I did

I found an edge case. Docker allows both tags and SHA to be defined in the same base image definition. When this case happens, Docker ignores the tag and just pulls the image associated to its SHA.

Although, Docker ignores the tag, I find the case for having both compelling for humans: it's easier to represent what the image behind a SHA is, if the tag is next to it.

I used this pattern and usually, hadolint is happy with it. Today, one of the tags was explicitly set to latest and hadolint bailed out. Here's a patch that changes the behavior to make it consistent no matter what the tag is.

How I did it

TDD 🙂 I first added the unit test, which failed as expected. Then, I added the new check and ran the unit tests. Let me know what you think!

By the way, that's my first patch in haskell. I mainly copy-pasted some the lines around. I would be happy to make any requested change 🙂

How to verify it

stack test

@lorenzo
Copy link
Member
lorenzo commented Nov 29, 2021

Thanks, it looks perfect!

@lorenzo lorenzo merged commit 43d2bfe into hadolint:master Nov 29, 2021
@JohanLorenzo JohanLorenzo deleted the DL3007-latest-with-sha branch November 29, 2021 10:01
JohanLorenzo added a commit to jobgraph-dev/jobgraph that referenced this pull request Dec 28, 2021
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 this pull request may close these issues.

2 participants
0