1
+ //! # Implementation of "logically bound" container images
2
+ //!
3
+ //! This module implements the design in <https://github.com/containers/bootc/issues/128>
4
+ //! for "logically bound" container images. These container images are
5
+ //! pre-pulled (and in the future, pinned) before a new image root
6
+ //! is considered ready.
7
+
1
8
use crate :: task:: Task ;
2
9
use anyhow:: { Context , Result } ;
3
10
use camino:: Utf8Path ;
@@ -7,8 +14,11 @@ use fn_error_context::context;
7
14
use ostree_ext:: ostree:: Deployment ;
8
15
use ostree_ext:: sysroot:: SysrootLock ;
9
16
17
+ /// The path in a root for bound images; this directory should only contain
18
+ /// symbolic links to `.container` or `.image` files.
10
19
const BOUND_IMAGE_DIR : & str = "usr/lib/bootc-experimental/bound-images.d" ;
11
20
21
+ /// Given a deployment, pull all container images it references.
12
22
pub ( crate ) fn pull_bound_images ( sysroot : & SysrootLock , deployment : & Deployment ) -> Result < ( ) > {
13
23
let sysroot_fd = crate :: utils:: sysroot_fd ( & sysroot) ;
14
24
let sysroot_fd = Dir :: reopen_dir ( & sysroot_fd) ?;
@@ -111,6 +121,11 @@ fn pull_images(_deployment_root: &Dir, bound_images: Vec<BoundImage>) -> Result<
111
121
Ok ( ( ) )
112
122
}
113
123
124
+ /// A subset of data parsed from a `.image` or `.container` file with
125
+ /// the minimal information necessary to fetch the image.
126
+ ///
127
+ /// In the future this may be extended to include e.g. certificates or
128
+ /// other pull options.
114
129
#[ derive( PartialEq , Eq ) ]
115
130
struct BoundImage {
116
131
image : String ,
@@ -131,6 +146,10 @@ impl BoundImage {
131
146
}
132
147
}
133
148
149
+ /// Given a string, parse it in a way similar to how systemd would do it.
150
+ /// The primary thing here is that we reject any "specifiers" such as `%a`
151
+ /// etc. We do allow a quoted `%%` to appear in the string, which will
152
+ /// result in a single unquoted `%`.
134
153
fn parse_spec_value ( value : & str ) -> Result < String > {
135
154
let mut it = value. chars ( ) ;
136
155
let mut ret = String :: new ( ) ;
0 commit comments