-
Notifications
You must be signed in to change notification settings - Fork 445
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
Empty dockerExposedPorts should be okay #1260
Comments
Thanks for you detailed request @dave-handy 😄 Does this cause any issue for you or is it just annoying 😉 The reason I ask this is because introducing new settings is always a maintenance liability. If this is really causing issue, I would prefer to think about a generic way to disable single validations, e.g. validatePackageValidators -= validateExposedPorts |
Now that I understand there's no way to suppress it, it's just annoying. I had to do some hunting in the code to see find it so some other users might be looking for the same thing. It kind of makes me want to set a port just to get rid of the message, even though that seems like a bad idea ;) Here are some other options I thought of:
I have heard it's possible to check if a setting has been overridden in |
That's at least something. You can deploy. But in anger 😝
I know that feeling to well 😉 So if you feel lucky you can disable the validation completely for your sanity with validatePackageValidators := List.empty |
Yep, that would work! Sounds great |
I wasn't aware that |
They are functions, yes. This makes it non-trivial to remove them from the list. Options to achieve this would be
|
Isn't
kind of throwing the baby out with the bathwater? Really no plans to make this more easily configurable? |
Kind of. If you would like to open a pull request making this easier to configure I'm happy to help and review 😃
|
I just stumbled across this while looking at something unrelated, and hadn't figured out how to suppress this warning. I understand the plugin is complicated already and adding support. I liked your original suggestion about how this could work:
I haven't done anything much with plugins before, but this seems to be a case of "simply" exposing the private validation rules so they can be removed. Would you still accept a PR for this? Although "merely" annoying, this particular validation fires for every service I build with SBT: marking ports via |
Hi @asnare PRs always welcome 🤩 |
Bit of hack for those that want to remove the warning via filtering the validators by their results. Something like: Docker / validatePackage := {
Validation.runAndThrow(
(Docker / validatePackageValidators).value
.map(v => () => v.apply().filterNot(_.description.contains("no exposed ports for your docker image"))),
streams.value.log
)
} Obviously brittle if the description message changes in the future. |
Expected behaviour
sbt docker:publishLocal
publishes local docker image without warningsActual behaviour
sbt docker:publishLocal
prints warningsInformation
Using sbt-native-packager 1.4.1 sbt version 1.2.6 building on MacOS
Docker version 19.03.2, build 6a30dfc
This warning may make sense as a default, but there should be a separate settings key to turn off the warning such as
dockerNoExposedPorts := true
. Alternately a check can be added that checks if the settings have been explicitly overridden toNil
.sbt-native-packager/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
Lines 569 to 587 in 9047b33
The text was updated successfully, but these errors were encountered: