Dockerfile detector will only check files containing "Dockerfile" in the name#3499
Dockerfile detector will only check files containing "Dockerfile" in the name#3499dgageot merged 2 commits intoGoogleContainerTools:masterfrom
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.
FWIW, I've also seen a lot of *.dockerfile out there
There was a problem hiding this comment.
so, it would be better to make it case insensitive?
There was a problem hiding this comment.
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.
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.
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
Dockerfilein the name even when using multiple files in the same folder.User facing changes
Before
When running
skaffold initwith 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