Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate Inventory & Sha7 appended filenames for binaries (#51)
* Generate Inventory & Sha7 appended filenames for JRuby Currently the Ruby buildapack is tightly coupled to the URLs that are generated by this repo. I am in the process of introducing an inventory file that the buildpack can use as a lookup. To start that process this commit introduces generating tgz files with the first 7 SHA256 characters appended. This allows us to update the same version number in the future without worrying that it will break future digest checks of the URL. With this change the builder will continue to generate the original URLs, but it will also generate "<filename>-<sha256>.tgz" files as well and append this information to a `jruby_inventory.toml` file. * Use FromStr for converting between arch structs * Refactor and add inventory_check - We now create only one sha named archive for jruby builds since both ARM and AMD point to the same source. - Binary `inventory_check` takes in a file and validates that all checksums are valid. * Use GemVersion * Refactor atomic calls into their own function * Refactor: Prefer composable methods * I did not mean to commit that * Replace older entries by default * Refactor: API to mutate the inventory, not the file * Test logic to preserve/remove artifacts from inventory * Introduce Ruby manifest file * Guard against the case of same sha7 but different sha256 * Fix clippy * Remove accidental inventory addition Sidenote, the check to validate that the URLs are valid works! https://github.com/heroku/docker-heroku-ruby-builder/actions/runs/10102146736/job/27937182426?pr=51 * Auto PR for ruby_inventory.toml * Manual global write permissions Before: ``` drwxr-xr-x 2 root root 4096 Jul 25 22:34 . drwxr-xr-x 3 runner docker 4096 Jul 25 22:32 .. -rw-r--r-- 1 root root 24061018 Jul 25 22:34 ruby-3.2.3.tgz ``` With these permissions we were unable to write to the directory. After: After ``` drwxrwxrwx 2 root root 4096 Jul 27 02:53 . drwxr-xr-x 3 runner docker 4096 Jul 27 02:51 .. -rw-r--r-- 1 root root 24061325 Jul 27 02:53 ruby-3.2.3.tgz ``` Now we can copy the file to a new filename in the same directory. * Prefer inventory::artifact::Arch * Fix clippy and doc tests ``` error: the borrowed expression implements the required traits --> ruby_executable/src/bin/ruby_build.rs:143:24 | 143 | docker_run.arg(&format!( | ________________________^ 144 | | "./make_ruby.sh {} {}", 145 | | input_tar.display(), 146 | | output_tar.display() 147 | | )); | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args = note: `-D clippy::needless-borrows-for-generic-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrows_for_generic_args)]` help: change this to | 143 ~ docker_run.arg(format!( 144 + "./make_ruby.sh {} {}", 145 + input_tar.display(), 146 + output_tar.display() 147 ~ )); | error: could not compile `ruby_executable` (bin "ruby_build" test) due to 1 previous error warning: build failed, waiting for other jobs to finish... ``` --------- Co-authored-by: Rune Soerensen <[email protected]>
- Loading branch information