osbuild: unify libdir handling
We want to run stages and other scripts inside of the nspawn containers
we use to build pipelines. Since our pipelines are meant to be
self-contained, this should imply that the build-root must have osbuild
installed. However, this has not been the case so far for several
reasons including:
1. OSBuild is not packaged for all the build-roots we want to support
and thus we have the chicken-and-egg problem.
2. During testing and development, we want to support using a local
`libdir`.
3. We already provide an API to the container. Importing scripts from
the outside just makes this API bigger, but does not change the
fact that build-roots are not self-contained. Same is true for the
running kernel, and probably much more..
With all this in mind, our strategy probably still is to eventually
package osbuild for the build-root. This would significantly reduce our
API exposure, points-of-failure, and host-reliance. However, this switch
might still be some weeks out.
With this in mind, though, we can expect the ideal setup to have a full
osbuild available in the build-root. Hence, any script we import so far
should be able to access the entire `libdir`. This commit unifies the
libdir handling by installing the symlinks into `libdir` and providing
a single bind-mount of the module-path into `libdir`.
We can always decide to scratch that in the future when we scratch the
libdir-import from the host-root. Until then, I believe this commit
nicely unifies the way we import the module both in a local checkout as
well as in the container.
This commit is contained in:
parent
930dcf670b
commit
58d368df0d
5 changed files with 44 additions and 24 deletions
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
import hashlib
|
||||
import importlib
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
|
@ -89,12 +87,6 @@ class Stage:
|
|||
sources_dir = f"{libdir}/sources" if libdir else "/usr/lib/osbuild/sources"
|
||||
|
||||
ro_binds = [f"{sources_output}:/run/osbuild/sources"]
|
||||
if not libdir:
|
||||
osbuild_module_path = os.path.dirname(importlib.util.find_spec('osbuild').origin)
|
||||
# This is a temporary workaround, once we have a common way to include osbuild in the
|
||||
# buildroot we should remove this because it includes code from the host in the buildroot thus
|
||||
# violating our effort of reproducibility.
|
||||
ro_binds.append(f"{osbuild_module_path}:/run/osbuild/lib/stages/osbuild")
|
||||
|
||||
with API(f"{build_root.api}/osbuild", args, interactive) as api, \
|
||||
sources.SourcesServer(f"{build_root.api}/sources",
|
||||
|
|
@ -151,13 +143,8 @@ class Assembler:
|
|||
binds.append(f"{output_dir}:/run/osbuild/output")
|
||||
args["output_dir"] = "/run/osbuild/output"
|
||||
|
||||
osbuild_module_path = os.path.dirname(importlib.util.find_spec('osbuild').origin)
|
||||
ro_binds = [f"{tree}:/run/osbuild/tree"]
|
||||
if not libdir:
|
||||
# This is a temporary workaround, once we have a common way to include osbuild in the
|
||||
# buildroot we should remove this because it includes code from the host in the buildroot thus
|
||||
# violating our effort of reproducibility.
|
||||
ro_binds.append(f"{osbuild_module_path}:/run/osbuild/lib/assemblers/osbuild")
|
||||
|
||||
with remoteloop.LoopServer(f"{build_root.api}/remoteloop"), \
|
||||
API(f"{build_root.api}/osbuild", args, interactive) as api:
|
||||
r = build_root.run(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue