Skip to content
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

Cache buildpack builds in a local docker volume #2463

Closed
rohanKanojia opened this issue Nov 21, 2023 · 5 comments
Closed

Cache buildpack builds in a local docker volume #2463

rohanKanojia opened this issue Nov 21, 2023 · 5 comments
Assignees

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented Nov 21, 2023

Component

JKube Kit

Task description

Description

Part of #439

Buildpack builds can involve downloading artifacts from multiple sources in a single build. I've even seen various intermittent failures due to network errors during pack build.

We should enable caching buildpack builds in a local docker volume so that subsequent builds are faster. This would provide much better development experience. Name of the local docker volume should be directly mapped to the project / container image name.

We can probably configure this behavior via the nocache configuration option that we already have at the moment. If user explicitly enables nocache, we won't cache buildpack build.

Expected Behavior

As a user using JKube to build container images leveraging buildpacks, I want to have faster subsequent builds by relying on the build cache, so that I can save time and avoid intermittent network errors.

Acceptance Criteria

Given:

  • User hasn't performed build and has disabled nocache option.
  • User has specified build strategy as buildpacks using jkube.build.strategy property / plugin configuration

When: User performs k8s:build

Then: BuildPackConfiguration cache is added by default during k8s:build

@manusa manusa moved this to Planned in Eclipse JKube May 15, 2024
@rohanKanojia rohanKanojia moved this from Planned to In Progress in Eclipse JKube May 27, 2024
@rohanKanojia rohanKanojia self-assigned this May 27, 2024
@rohanKanojia
Copy link
Member Author

Now that I'm revisiting this issue again, I'm observing that pack CLI automatically creates docker volumes for caching the build process.

If I do mvn k8s:build with buildpacks build strategy enabled:

mvn k8s:build -Djkube.build.strategy=buildpacks

I notice that these docker volumes get created automatically:

$ docker volume ls
DRIVER    VOLUME NAME
local     pack-cache-rohankanojiabot_spring-boot3-demo-jkube_latest-ad8ffa513fae.build
local     pack-cache-rohankanojiabot_spring-boot3-demo-jkube_latest-ad8ffa513fae.launch

I think we can just add configuration to clear old cache using --clear-cache pack CLI flag by checking plugin's nocache option.

@manusa
Copy link
Member

manusa commented May 28, 2024

I notice that these docker volumes get created automatically:

Could we add something in our test suites (E2E or IT) that verifies that these volumes are created?

@rohanKanojia
Copy link
Member Author

Could we add something in our test suites (E2E or IT) that verifies that these volumes are created?

I'm not able to see any integration test related to buildpacks build strategy. Shall I add integration test for buildpacks build strategy in scope of this issue or create a new issue?

@manusa
Copy link
Member

manusa commented May 28, 2024

New issue

@rohanKanojia
Copy link
Member Author

I've created #3097 for this task.

I'm closing this one as #3093 got merged.

@github-project-automation github-project-automation bot moved this from Review to Done in Eclipse JKube May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants