Skip to content

Commit

Permalink
final schema update
Browse files Browse the repository at this point in the history
<containers source="registry.suse.com" backend="podman">
    <container name="some" tag="some" path="/some/path"/>
</containers>
  • Loading branch information
schaefi committed Oct 18, 2024
1 parent cb66fdb commit de330f5
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 268 deletions.
55 changes: 19 additions & 36 deletions doc/source/image_description/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1235,64 +1235,47 @@ For details see: :ref:`installmedia_customize`

.. _sec.registry:

<registry>
----------
<containers>
------------

Setup containers to fetch from one or more registry elements
Setup containers to fetch from a registry assigned to one
of the supported container backends

.. code:: xml
<registry source="registry.opensuse.org">
<containers backend="podman">
<container name="some"/>
</containers>
</registry>
<containers source="registry.opensuse.org" backend="podman">
<container name="some"/>
</containers>
The optional registry element specifies the location of one ore
The optional containers element specifies the location of one ore
more containers on a registry `source` server. {kiwi} will take
this information and fetch the containers as OCI archives to
the image. On first boot those container archives will be loaded
into the local container backend store for the selected
backend and the archive files gets deleted.

<registry><containers>
----------------------

Details about the container backend

.. code:: xml
<registry source="registry.opensuse.org">
<containers backend="podman">
<container name="some"/>
</containers>
</registry>
Supported `backend` values as of today are `docker` and `podman`.
The `backend` attribute is mandatory and specifies for which
container backend the image should be available in the system.
The `container` element has the following optional attribute:

path="some/path"
The path to the container in the registry. If not specified
the value defaults to `/`

<registry><containers><container>
---------------------------------
<containers><container>
-----------------------

Details about the container to fetch from a given source registry
Details about the container

.. code:: xml
<registry source="registry.opensuse.org">
<containers backend="podman">
<container name="some"/>
</containers>
</registry>
<containers source="registry.opensuse.org" backend="podman">
<container name="some"/>
</containers>
The `name` attributes is mandatory and specifies
the name of the container as it exists in the registry.
The `container` element has the following optional attributes
The `container` element has the following optional attributes:

path="some/path"
The path to the container in the registry. If not specified
the value defaults to `/`

fetch_only="true|false"
If set to `true` kiwi will only fetch the container but does not
Expand Down
42 changes: 16 additions & 26 deletions kiwi/schema/kiwi.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ div {
k.drivers* &
k.strip* &
k.repository* &
k.registry* &
k.containers* &
k.packages* &
k.extension?
}
Expand Down Expand Up @@ -1049,52 +1049,40 @@ div {
}

#==========================================
# common element <registry>
# common element <containers>
#
div {
k.registry.profiles.attribute = k.profiles.attribute
k.registry.arch.attribute = k.arch.attribute
k.registry.source.attribute =
k.containers.profiles.attribute = k.profiles.attribute
k.containers.arch.attribute = k.arch.attribute
k.containers.source.attribute =
## Name of registry source server
attribute source { text }
k.registry.attlist =
k.registry.profiles.attribute? &
k.registry.arch.attribute? &
k.registry.source.attribute
k.registry =
element registry {
k.registry.attlist,
k.containers+
}
}

#==========================================
# common element <containers>
#
div {
k.containers.backend.attribute =
## Use container with specified container backend
attribute backend { "podman" | "docker" }
k.containers.path.attribute =
## Container path, default to '/' if not specified
attribute path { text }
k.containers.attlist =
k.containers.backend.attribute &
k.containers.path.attribute?
k.containers.profiles.attribute? &
k.containers.arch.attribute? &
k.containers.source.attribute &
k.containers.backend.attribute
k.containers =
element containers {
k.containers.attlist,
k.container*
k.container+
}
}

#==========================================
# common element <container>
#
div {
k.container.arch.attribute = k.arch.attribute
k.container.name.attribute =
## Container name
attribute name { text }
k.container.path.attribute =
## Container path, default to '/' if not specified
attribute path { text }
k.container.tag.attribute =
## Container tag, defaults to 'latest' if not specified
attribute tag { text }
Expand All @@ -1104,6 +1092,8 @@ div {
attribute fetch_only { xsd:boolean }
k.container.attlist =
k.container.name.attribute &
k.container.arch.attribute? &
k.container.path.attribute? &
k.container.tag.attribute? &
k.container.fetch_only.attribute?
k.container =
Expand Down
67 changes: 27 additions & 40 deletions kiwi/schema/kiwi.rng
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ named /etc/ImageID</a:documentation>
<ref name="k.repository"/>
</zeroOrMore>
<zeroOrMore>
<ref name="k.registry"/>
<ref name="k.containers"/>
</zeroOrMore>
<zeroOrMore>
<ref name="k.packages"/>
Expand Down Expand Up @@ -1606,47 +1606,21 @@ definition can be composed by other existing profiles.</a:documentation>
</div>
<!--
==========================================
common element <registry>
common element <containers>
-->
<div>
<define name="k.registry.profiles.attribute">
<define name="k.containers.profiles.attribute">
<ref name="k.profiles.attribute"/>
</define>
<define name="k.registry.arch.attribute">
<define name="k.containers.arch.attribute">
<ref name="k.arch.attribute"/>
</define>
<define name="k.registry.source.attribute">
<define name="k.containers.source.attribute">
<attribute name="source">
<a:documentation>Name of registry source server</a:documentation>
</attribute>
</define>
<define name="k.registry.attlist">
<interleave>
<optional>
<ref name="k.registry.profiles.attribute"/>
</optional>
<optional>
<ref name="k.registry.arch.attribute"/>
</optional>
<ref name="k.registry.source.attribute"/>
</interleave>
</define>
<define name="k.registry">
<element name="registry">
<ref name="k.registry.attlist"/>
<oneOrMore>
<ref name="k.containers"/>
</oneOrMore>
</element>
</define>
</div>
<!--
==========================================
common element <containers>
-->
<div>
<define name="k.containers.backend.attribute">
<attribute name="backend">
<a:documentation>Use container with specified container backend</a:documentation>
Expand All @@ -1656,25 +1630,24 @@ definition can be composed by other existing profiles.</a:documentation>
</choice>
</attribute>
</define>
<define name="k.containers.path.attribute">
<attribute name="path">
<a:documentation>Container path, default to '/' if not specified</a:documentation>
</attribute>
</define>
<define name="k.containers.attlist">
<interleave>
<ref name="k.containers.backend.attribute"/>
<optional>
<ref name="k.containers.path.attribute"/>
<ref name="k.containers.profiles.attribute"/>
</optional>
<optional>
<ref name="k.containers.arch.attribute"/>
</optional>
<ref name="k.containers.source.attribute"/>
<ref name="k.containers.backend.attribute"/>
</interleave>
</define>
<define name="k.containers">
<element name="containers">
<ref name="k.containers.attlist"/>
<zeroOrMore>
<oneOrMore>
<ref name="k.container"/>
</zeroOrMore>
</oneOrMore>
</element>
</define>
</div>
Expand All @@ -1684,11 +1657,19 @@ definition can be composed by other existing profiles.</a:documentation>
-->
<div>
<define name="k.container.arch.attribute">
<ref name="k.arch.attribute"/>
</define>
<define name="k.container.name.attribute">
<attribute name="name">
<a:documentation>Container name</a:documentation>
</attribute>
</define>
<define name="k.container.path.attribute">
<attribute name="path">
<a:documentation>Container path, default to '/' if not specified</a:documentation>
</attribute>
</define>
<define name="k.container.tag.attribute">
<attribute name="tag">
<a:documentation>Container tag, defaults to 'latest' if not specified</a:documentation>
Expand All @@ -1704,6 +1685,12 @@ loading of the container at first boot</a:documentation>
<define name="k.container.attlist">
<interleave>
<ref name="k.container.name.attribute"/>
<optional>
<ref name="k.container.arch.attribute"/>
</optional>
<optional>
<ref name="k.container.path.attribute"/>
</optional>
<optional>
<ref name="k.container.tag.attribute"/>
</optional>
Expand Down
Loading

0 comments on commit de330f5

Please sign in to comment.