-
Notifications
You must be signed in to change notification settings - Fork 306
Add support for Containerfile #100
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
base: main
Are you sure you want to change the base?
Conversation
First time working with Swift, be gentle. :) |
1860948
to
0dbb950
Compare
guard FileManager.default.fileExists(atPath: file) else { | ||
throw ValidationError("Dockerfile does not exist at path: \(file)") | ||
} |
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.
Removing this because the validation is happening in the new checkForDockerOrContainerfile()
function. But maybe there is a more clean way to keep all of the validation happening here. Happy to take suggestions on that.
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.
For readability and responsibility determination, I would try to keep validation logic in the validate()
function.
Perhaps by moving the defaultBuildFileNames
constant from run()
to a static attribute, and creating a fun checkBuildFileIsPresent(atPath: String) -> Bool
that determines the file is present.
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.
Yeah, I agree. It would be much nicer to keep it here. I'll keep thinking about this one while we debate the merits of just switching the default to Containerfile
over on the linked issue:
#99
0dbb950
to
fbc1d96
Compare
d93e0d6
to
2988b07
Compare
Ok, this builds and when I test the binary locally, it works to fix the issue I raised: Testing on:
Implicit Containerfile
Bad file:
Explicit Containerfile:
Explicit Dockerfile:
Implicit 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.
I agree with your point that Container CLI should have support for Containerfiles.
I've made some code-related suggestions, but I do think the CLI should default to generic terminology (e.g. Containerfile) and use vendor-specific Dockerfile as a synonym – not vice-versa.
guard FileManager.default.fileExists(atPath: file) else { | ||
throw ValidationError("Dockerfile does not exist at path: \(file)") | ||
} |
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.
For readability and responsibility determination, I would try to keep validation logic in the validate()
function.
Perhaps by moving the defaultBuildFileNames
constant from run()
to a static attribute, and creating a fun checkBuildFileIsPresent(atPath: String) -> Bool
that determines the file is present.
Thanks for submitting this PR! Before proceeding with code review, let’s first discuss and align on the proposed direction. Please contribute your thoughts to the discussion here: #99 Once we’ve reached consensus there, we’ll revisit this PR. Appreciate your cooperation! |
Yeah, I think before we push too much further into the PR, it would be nice to understand if the maintainers are open to using Containerfile as the default. If that's the case, we can vastly simplify all of this and just change the default: But yeah, if not, I think it would be great to support both at least. Since Dockerfile is very specific to the company "Docker". |
This change adds a function to check for either a Dockerfile or Containerfile. If either exist, and the user hasn't explicitly provided the file to use, then we can default to the existing file. Fixes: 99 Signed-off-by: Brendan Shephard <bshephar@bne-home.net>
baba2c0
to
e901332
Compare
Co-authored-by: Alexander Matzen <alexander@alexander.dk>
e901332
to
9bcfbf7
Compare
This change adds a function to check for either a Dockerfile or Containerfile. If either exist, and the user hasn't explicitly provided the file to use, then we can default to the existing file.
Fixes #99