Commit graph

22 commits

Author SHA1 Message Date
Alexander Larsson
1152edcf31 inputs/org.osbuild.containers: Drop format and file options
We hardcode oci-archive for now and use the first file in the pipeline
tree as the archive. Long term we may want to get this info from the
metadata of the oci-archive stage instead.
2022-02-10 14:43:17 +01:00
Alexander Larsson
46a228df38 Add support for installing containers in images
This adds a stage called org.osbuild.skopeo that installs docker and
oci archive files into the container storage of the tree being
constructed.

The source can either be a file from another pipeline, for example one
created with the existing org.osbuild.oci-archive stage, or it can
be using the new org.osbuild.skopeo source and org.osbuild.containers
input, which will download an image from a registry and install that.

There is an optional option in the install stage that lets you
configure a custom storage location, which allows the use of the
additionalimagestores option in the container storage.conf
to use a read-only image stores (instead of /var/lib/container).

Note: skopeo fails to start if /etc/containers/policy.json is
not available, so we bind mount it from the build tree to the
buildroot if available.
2022-02-10 14:43:17 +01:00
Christian Kellner
ca3941feb6 inputs/ostree.checkout: don't overwrite refs
The `refs` variable is used as parameter to indicate which commits
to checkout, but it also was used as result variable to store the
ids of the commits that actually got checked out; naturally, it
was initialized to the empty array. This of course meant nothing
was ever actually checked out. Doh.
2021-08-24 01:21:03 +02:00
Christian Kellner
3695e22369 inputs: add org.osbuild.ostree.checkout
New input type that takes a ostree repo and checks out any number
of commits inside that repo to a temporary directory. Each commit
will be checked out to a separate sub-directory. The name of the
dir is the commit id of the corresponding commit.
This input can thus be used to access files and directories of
commits in stages.
2021-08-17 13:53:00 +02:00
Christian Kellner
f4a8770e58 inputs/files: support for pipeline origins
Currently the `org.osbuild.files` input only supports the source origin.
Extend support to mapping files from pipelines, using the recently added
sub-tree reading capability of `ObjectStore.reat_at`. Restructure the
JSON schema to keep is as readable as possible.
2021-06-09 18:37:47 +01:00
Christian Kellner
659c139ed1 inputs/files: extract source options schema
This is mostly to prepare the support for pipeline options will be
different for pipeline origins than source origins.
2021-06-09 18:37:47 +01:00
Christian Kellner
e92b24229d inputs/files: extract origin definition
This is mostly to prepare the support for pipeline origins where
this node will get reused in more than one place.
2021-06-09 18:37:47 +01:00
Christian Kellner
a2c926654c inputs/files: rename refs to files
The `org.osbuild.files` input provides individual files to a stage.
Change the `refs` key in the returned dict to `files` to better
reflect that fact. Also adapt the documentation to indicate that
the keys actually paths and not necessarily checksums. This prepares
for future extension of the `files` input to pipeline origins.
2021-06-09 18:37:47 +01:00
Christian Kellner
a3ea8dc748 inputs/files: use os.link instead of ln binary 2021-06-09 18:37:47 +01:00
Christian Kellner
1ed85dc790 inputs: convert to host service
Create a `InputService` class with an abstract method called `map`,
meant to be implemented by all inputs. An `unmap` method may be
optionally overridden by inputs to cleanup resources.
Instantiate a `host.ServiceManager` in the `Stage.run` section and
pass the to the host side input code so it can be used to spawn the
input services.
Convert all existing inputs to the new service framework.
2021-06-09 18:37:47 +01:00
Christian Kellner
08bc9ab7d8 inputs: pre-defined input paths
Instead of bind-mounting each individual input into the container,
create a temporary directory that is used by all inputs and bind-
mount this to the well known location ("/run/osbuild/inputs"). The
temporary directory is then passed to the input so that it can
make the requested resources available relative to that directory.
This is enforced by the common input handling code.
Additionally, pass the well known input path via a new "paths" key
to the arguments dictionary passed to the stage.
2021-06-09 18:37:47 +01:00
Christian Kellner
2b19e534e6 inputs/files: extract sources definition
Make the main portion of the schema more readable by extracting the
two possible reference definitions.
2021-06-09 18:37:47 +01:00
Christian Kellner
d577a306f9 inputs/files: extract metadata schema
Make the schema more readable by extracting the metadata definition.
2021-06-09 18:37:47 +01:00
Christian Kellner
36c7d08f6e inputs/ostree: use ostree prefix for temp dir
Use `ostree-ouput` instead of `files-output` as prefix for the
temporary directory prefix.
Also fix the description of the "origin" to reflect that
pipeline and source origins are supported.
Additionally remove some dead code.
2021-03-22 14:25:23 +01:00
Christian Kellner
5cd139d53a inputs: add noop input for testing
Add a new "noop" input that does nothing but forward all its
data to the stage. Can be useful for testing.
2021-02-12 15:55:43 +01:00
Christian Kellner
7caa263659 inputs/ostree: support pipeline inputs
In addition to pulling ostree commits via sources, the input
now supports pulling commits that were built via an osbuild
pipeline.
2021-02-12 15:55:43 +01:00
Christian Kellner
c9462bf48c inputs: add "type" property to schema
This was missed when `type` was added to the Inputs class.
2021-02-12 15:55:43 +01:00
Christian Kellner
dd50387bbc inputs/tree: remove trailing whitespace
This one is for David. And pylint, but mostly David.
2021-02-11 23:49:18 +01:00
Christian Kellner
17c6446a7c inputs: add org.osbuild.ostree input
Add a new input that can handle ostree commits. For source origins,
it will pull any number of commits specified via `references`. For
pipeline origins it will use the compose.json to obtain the commit
id and pull that. Either way the data passed onto the stage is a
dictionary of commit ids and commit metadata, such as the `ref`
that is an ostree ref that is optionally created in case the `ref`
option for that reference was specified.
2021-02-06 12:04:30 +01:00
Christian Kellner
1f89d2fd9d inputs: add files input
Create a new input for resources of the `org.osbuild.files` type,
i.e. individual files, addressed in the store via their content
hash.
2021-02-06 12:04:30 +01:00
Christian Kellner
eb1d17d8ac input: add references and origin
Currently all options for inputs are totally opaque to osbuild
itself. This is neat from a seperation of concerns point of view
but has one major downside: osbuild can not verify the integrity
of the pipeline graph, i.e. if all inputs that need pipelines or
sources do indeed exists. Therefore intrdouce two generic fields
for inputs: `origin` and `references`. The former can either be
a source or a pipeline. The latter is an array of identifiers or
a dictionary where the keys are the identifiers and the values
are additional options for that id. The identifiers then refer
to either resources obtained via a source or a pipeline that has
already been built.
2021-02-06 12:04:30 +01:00
Christian Kellner
79b192e736 inputs: add new org.osbuild.tree input
This represents the tree-type input, which is the simplest form
of input a stage can consume. For the stage it is just a file
system tree at a specific location and the contents itself is
mostly opaque. An obvious thing to do with such a content is
carbon copy it to a different location.
Currently this input only supports the pipelines as origins,
which are identified via their id.
2021-01-18 17:44:46 +01:00