-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dockerfile detector will only check files containing "Dockerfile" in the name #3499
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Codecov Report
|
pkg/skaffold/initializer/init.go
Outdated
results := []InitBuilder{docker.ArtifactConfig{File: path}} | ||
return results, true | ||
base := filepath.Base(path) | ||
if strings.Contains(base, "Dockerfile") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I've also seen a lot of *.dockerfile
out there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, it would be better to make it case insensitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made it case insensitive and updated test to cover this case.
return results, true | ||
base := filepath.Base(path) | ||
if strings.Contains(base, "Dockerfile") { | ||
if docker.Validate(path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also check in docker.Validate(path)
if there is some python-ish code after from ...
(like import <name>
).
WDYT @dgageot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that Dockerfile validator should be aware of python-ish code constructs.
It's responsibility to validate Dockerfile and it does that by validating commands. Validating arguments would be too much overhead IMO.
Fixes #3484.
Description
Initializer tries to find all available builders by checking each file in the tree for compatible with Dockerfile syntax.
This syntax is not unique and python file can be taken for Dockerfile:
This fix adds additional check to the file name which should contain "Dockerfile".
I am not sure if that is appropriate solution, because it can affect existing users.
But as far as I know, developers tend to keep
Dockerfile
in the name even when using multiple files in the same folder.User facing changes
Before
When running
skaffold init
with python files like the one mentioned above you can see them in the list of available builders.After
No python files should be listed in the survey.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Reviewer Notes