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

Move bundle download to struct API and bullet stream #330

Merged
merged 9 commits into from
Oct 7, 2024

Conversation

schneems
Copy link
Contributor

@schneems schneems commented Oct 3, 2024

Details in commits. The handle layer caching logic is exactly the same as the Ruby install layer

let layer_ref = cached_layer_write_metadata(layer_name!("ruby"), context, metadata)?;
match &layer_ref.state {
LayerState::Restored { cause } => {
bullet = bullet.sub_bullet(cause);
}
LayerState::Empty { cause } => {
match cause {
EmptyLayerCause::NewlyCreated => {}
EmptyLayerCause::InvalidMetadataAction { cause }
| EmptyLayerCause::RestoredLayerAction { cause } => {
bullet = bullet.sub_bullet(cause);
}
}
let timer = bullet.start_timer("Installing");
install_ruby(metadata, &layer_ref.path())?;
bullet = timer.done();
}
}
Ok((bullet, layer_ref.read_env()?))

@schneems schneems marked this pull request as ready for review October 4, 2024 15:58
@schneems schneems requested a review from a team as a code owner October 4, 2024 15:58
* Introduce meta struct for holding layer ref results

* Rename generic to match M for metadata style

* Rename metadata generic

* Use Meta<M> to return old cached data

Meta<M> acts like a String for purposes of printing, but can optionally contain old metadata if the programmer needs it. This is useful for the "bundle install" layer which stores information in it's cache that is not used for cache invalidation but rather to determine whether or not it can skip running `bundle install`.

* Rename structs

* Move docs to module

* Update docs

* Move metadata type alias to top of file

* Update const name and add docs

* Add docs

* Implement MetadataDiff

This diff will eventually control caching logic

* Test caching logic

* Refactor bundle install command invocation

* Group imports

* Stub handle function with no logic

* Build install state from old cache data

* Rename UpdateState to InstallState

* Call bundle install from handle function

* Replace layer with struct API call

* Rename function

* Remove unused imports

* Move buildpack logging to the top of main

* Remove import

* Move logic out of function

* Replace commons logging with bullet stream

* Clippy
@schneems schneems enabled auto-merge (squash) October 7, 2024 21:35
@schneems schneems merged commit c8cdfd0 into main Oct 7, 2024
7 checks passed
@schneems schneems deleted the schneems/refactor-bundler branch October 7, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants