Skip to content

Refactor ToPack function#26

Merged
cmainas merged 4 commits intomainfrom
ref_Package
Aug 7, 2025
Merged

Refactor ToPack function#26
cmainas merged 4 commits intomainfrom
ref_Package

Conversation

@cmainas
Copy link
Collaborator

@cmainas cmainas commented Aug 1, 2025

Refactor the main function that handles the transformation of bunnyfile to the necessary instructions for the creation of the final image through LLB.

cmainas added 4 commits July 18, 2025 14:16
Rename BaseLLB to slowly reflect better the purpose of the function.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Refactor the ToPack function to improve the readability and remove
complicated logic with complex nested if statements> Instead move some
of the logic in helper functions to assist with
performing all the necessary steps. In particular create the following
functions:
- handleKernel: Which is repsonsible to handle the kernel entry in
  bunnyfile
- handleRootfs: Which is repsonsible to handle the rootfs entry in
  bunnyfile
- makeCopy: which creates a new copy struct with the necessary
  information for a file copy from another state
- SetBaseAndGetPaths: Chooses the base of the final image based on the
  rootfs and kernel entries and returns the respective kernel and rootfs
  paths inside that base image.
- SetAnnotations: Sets up the necessary annotations in the
  PackInstructions struct.

Furthermore, create a new struct PackEntry, which maintains the
necessary information for a processed bunnyfile entry (i.e. rootfs, kernel)

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Adjust the unit tests according to the changes that have been made in
ToPack during the refactoring.

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Add new unit tests for the new functions after the refactor and update
the previous unit tests for ToPack

Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
@cmainas cmainas force-pushed the ref_Package branch 8 times, most recently from cc78c10 to 16c87fd Compare August 7, 2025 07:19
@cmainas cmainas merged commit 0b37e1f into main Aug 7, 2025
7 checks passed
@cmainas cmainas deleted the ref_Package branch August 7, 2025 07:24
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

Successfully merging this pull request may close these issues.

1 participant