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

add linting rules for undeclared args in from #4843

Merged
merged 2 commits into from
May 1, 2024

Conversation

daghack
Copy link
Collaborator

@daghack daghack commented Apr 15, 2024

This adds another linting rule related to unmatched ARGs in the FROM command.

@daghack daghack marked this pull request as draft April 15, 2024 15:23
@daghack daghack self-assigned this Apr 15, 2024
@daghack daghack force-pushed the basic-arg-lint-rules branch 3 times, most recently from 87dd6f5 to 7272349 Compare April 15, 2024 17:33
@tonistiigi
Copy link
Member

Because this behavior is normally caught in the parser,

You mean the cases where build already errors? I don't think we need special handling for these cases or to skip any actual errors. I think it would be enough if we can detect:

ARG tag=foo
FROM busybox:${tag}${version} AS b

This is not invalid build but the $version part is something that is unhandled always and should cause a warning.

@daghack
Copy link
Collaborator Author

daghack commented Apr 15, 2024

Exactly what I meant, yes.
Sounds good! I will update the tests to get rid of the logic skip and test that, instead. :)

@daghack daghack force-pushed the basic-arg-lint-rules branch 6 times, most recently from 9113680 to 606efdd Compare April 18, 2024 19:04
@daghack daghack marked this pull request as ready for review April 18, 2024 19:27
frontend/dockerfile/dockerfile_lint_test.go Outdated Show resolved Hide resolved
frontend/dockerfile/shell/lex.go Show resolved Hide resolved
frontend/dockerfile/shell/lex.go Outdated Show resolved Hide resolved
frontend/dockerfile/dockerfile2llb/convert.go Outdated Show resolved Hide resolved
frontend/dockerfile/dockerfile2llb/convert.go Outdated Show resolved Hide resolved
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Looks like some errors in CI for latest version.

frontend/dockerfile/dockerfile_lint_test.go Show resolved Hide resolved
@daghack daghack marked this pull request as draft April 24, 2024 17:54
@daghack daghack force-pushed the basic-arg-lint-rules branch 12 times, most recently from 1c07614 to 45af41e Compare April 25, 2024 16:46
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
@daghack daghack force-pushed the basic-arg-lint-rules branch 6 times, most recently from 043b19c to 30a4b38 Compare April 30, 2024 19:21
@daghack daghack marked this pull request as ready for review April 30, 2024 22:22
@daghack daghack marked this pull request as draft April 30, 2024 22:37
@daghack daghack force-pushed the basic-arg-lint-rules branch 3 times, most recently from 52948d4 to 1e0a955 Compare April 30, 2024 23:32
@daghack daghack marked this pull request as ready for review April 30, 2024 23:40
@daghack daghack marked this pull request as draft April 30, 2024 23:49
@daghack daghack marked this pull request as ready for review May 1, 2024 03:55
@daghack
Copy link
Collaborator Author

daghack commented May 1, 2024

Okay, review ready again at last! 😂

…of parameters

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
@tonistiigi tonistiigi merged commit 51d85d7 into moby:master May 1, 2024
73 checks passed
@daghack daghack deleted the basic-arg-lint-rules branch May 1, 2024 21:26
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.

None yet

2 participants