Skip to content

Add no-pull option for image building #22736

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

Closed
wants to merge 4 commits into from

Conversation

anshlykov
Copy link
Contributor

Closes #22679

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 4, 2020
@scottfrederick scottfrederick self-assigned this Aug 4, 2020
@scottfrederick scottfrederick added theme: kubernetes type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 4, 2020
@scottfrederick scottfrederick added this to the 2.4.x milestone Aug 4, 2020
@scottfrederick
Copy link
Contributor

@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:

  • ALWAYS has the same behavior as your changes with noPull=false (the default)
  • NEVER has the same behavior as your changes with noPull=true
  • IF_NOT_PRESENT checks 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?

@anshlykov
Copy link
Contributor Author

@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.

@anshlykov anshlykov marked this pull request as draft August 7, 2020 15:47
@anshlykov anshlykov marked this pull request as ready for review August 10, 2020 14:12
@anshlykov
Copy link
Contributor Author

@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

scottfrederick pushed a commit to scottfrederick/spring-boot that referenced this pull request Aug 12, 2020
This commit adds a pullPolicy option to the configuration of the Maven
plugin spring-boot:build-image goal and the Gradle plugin bootBuildImage
task. The new option gives users control over pulling the builder image
and run image from a remote image registry to the local Docker daemon.

See spring-projectsgh-22736
scottfrederick added a commit to scottfrederick/spring-boot that referenced this pull request Aug 12, 2020
@scottfrederick
Copy link
Contributor

@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.

@snicoll snicoll modified the milestones: 2.4.x, 2.4.0-M2 Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add no-pull option for image building
4 participants