Closes #22679
Comment From: scottfrederick
@anshlykov Thank you for the contribution. The changes look very good.
As I was looking at implementing this myself, I started thinking that we could do better than replicating the --no-pull option from pack build. The semantics of noPull=false configuration in Gradle or a <noPull>false</noPull> configuration in Maven could be confusing to users because of the double-negative.
Instead of a boolean "pull or no pull" option, we could model the Kubernetes behavior of a pullPolicy option with the possible values ALWAYS, NEVER, and IF_NOT_PRESENT where:
ALWAYShas the same behavior as your changes withnoPull=false(the default)NEVERhas the same behavior as your changes withnoPull=trueIF_NOT_PRESENTchecks to see if the image exists in the local daemon and uses it if it does exist, otherwise pulls the image from the remote repository if it does not exist locally
This has the benefits of being familiar to Kubernetes users, providing one additional option for increased control, and making the configuration easier to understand.
Would you mind updating the PR to implement this option?
Comment From: anshlykov
@scottfrederick thanks you for the review.
instead of a boolean "pull or no pull" option, we could model the Kubernetes behavior of a pullPolicy option
It is a good idea. I will implement this option.
Comment From: anshlykov
@scottfrederick I added the implementation of the PullPolicy option. I also refactored the BuildLog interface a bit to reduce code duplication. Failed tests in CI are not relevant to this PR as far as I understand
Comment From: scottfrederick
@anshlykov Thank you very much for the contribution. This will be a very useful feature. I've merged your changes along with a commit to polish a few things, update the documentation, and add an integration test.