Support importing preinstallimage as container image #18803
+37
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This PR is trying to download preinstallimage.info when preinstallimage.tar.gz is downloaded and pass it in the package list and allow docker and podman to use preinstallimage as container base image at build time to avoid the extra time that it takes to untar the preinstallimage and install the included packages in build environment.
This change is for my masters thesis. Sorry about not sending an email before starting the process.
I've tried to keep the approach as non invasive as possible. The previous solution still works and if preinstallimage is not found the traditional solution is used even if the option to use preinstallimage as base image for container is enabled.
The last commit should be dropped before merge since it's only for testing purpose.
The combination of this PR and the openSUSE/obs-build#1105 should allow obs to import preinstallimage a container image for docker and podman if the option is enabled.
I've tested it in local obs setup and in local build with
osc buildfor both podman and docker.The change for osc to support preinstallimage.info is at openSUSE/osc@57bdcf2.
For verifying the change in obs please
OBS_VM_TYPE="podman"orOBS_VM_TYPE="docker"andOBS_WORKER_USE_CONTAINER_PREINSTALLIMAGE="yes"in buildhost.config or sysconfig.obs-server.For verifying the change in osc build please run osc build with
--build-opt="--vm-use-container-preinstallimage"and --vm-type of docker or podman.I checked build timestamps for checking how much the build time is reduces. It of course depends on how big the preinstallimage is. I tested a preinstallimage with a sample specfile that was not doing any significant build.
When the option was disabled the build time was 13 seconds for docker and 96 seconds for podman. After using the option for the first time that image is being imported in the container images in the worker host it took 72s for docker and 45s for podman. In second build where the image was already imported it took 7s for docker and 8s for podman. This option would make sense for cases were the preinstallimage and it's dependencies are not changing frequently but there are frequent builds using that preinstallimage.
You can see the preinstallimage and spec file that I tested in couple of lines. Please let me know if there is anything I need to do or if you have any questions.
preinstallimage:
spec file: