Skip to content

Commit 43ea3e4

Browse files
committed
osbuild: use bootc install to deploy the container
Instead of deploying the container to the tree then copy all the contents to the disk image, use bootc to directly manage the installation to the target filesystems. We can keep the manifest duplicated until we are confident to roll this to all streams or move to image-builder. Requires: bootc-dev/bootc#1460 bootc-dev/bootc#1451 osbuild/osbuild#2149 osbuild/osbuild#2152 bootc-dev/bootc#1978 bootc-dev/bootc#1909
1 parent fe56a8e commit 43ea3e4

1 file changed

Lines changed: 75 additions & 242 deletions

File tree

src/osbuild-manifests/coreos.osbuild.x86_64.bootc.mpp.yaml

Lines changed: 75 additions & 242 deletions
Original file line numberDiff line numberDiff line change
@@ -150,103 +150,6 @@ pipelines:
150150
images:
151151
- source: $container_repo
152152
tag: $container_tag
153-
- name: tree
154-
build:
155-
mpp-format-string: '{buildroot}'
156-
source-epoch: 1659397331
157-
stages:
158-
# Set the context of the root of the tree so that we avoid unlabeled_t files.
159-
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
160-
- type: org.osbuild.selinux
161-
options:
162-
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
163-
target: tree:///
164-
inputs:
165-
tree:
166-
type: org.osbuild.tree
167-
origin: org.osbuild.pipeline
168-
references:
169-
- name:deployed-tree
170-
- type: org.osbuild.ostree.init-fs
171-
- type: org.osbuild.ostree.os-init
172-
options:
173-
osname:
174-
mpp-format-string: '{osname}'
175-
- type: org.osbuild.ostree.config
176-
options:
177-
repo: /ostree/repo
178-
config:
179-
sysroot:
180-
readonly: true
181-
bootloader: none
182-
# https://github.com/coreos/fedora-coreos-tracker/issues/1333
183-
bls-append-except-default: grub_users=""
184-
# Opt-in to https://github.com/ostreedev/ostree/pull/2705 which will
185-
# add /boot as the prefix on top of BLS config entries. This is OK
186-
# because there is a symlink that is created in the root of the boot
187-
# filesystem by OSTree (boot -> .) that makes it so that /boot paths
188-
# will always work.
189-
bootprefix: true
190-
- type: org.osbuild.mkdir
191-
options:
192-
paths:
193-
- path: /boot/efi
194-
mode: 493
195-
- type: org.osbuild.ignition
196-
# Deploy via ociarchive or container
197-
- mpp-if: ociarchive != ''
198-
then:
199-
type: org.osbuild.ostree.deploy.container
200-
options:
201-
osname:
202-
mpp-format-string: '{osname}'
203-
target_imgref:
204-
mpp-format-string: '{container_imgref}'
205-
mounts:
206-
- /boot
207-
- /boot/efi
208-
kernel_opts:
209-
- rw
210-
- '$ignition_firstboot'
211-
- mpp-format-string: '{extra_kargs}'
212-
inputs:
213-
images:
214-
type: org.osbuild.containers
215-
origin: org.osbuild.pipeline
216-
references:
217-
name:oci-archive:
218-
name: coreos.ociarchive
219-
else:
220-
type: org.osbuild.ostree.deploy.container
221-
options:
222-
osname:
223-
mpp-format-string: '{osname}'
224-
target_imgref:
225-
mpp-format-string: '{container_imgref}'
226-
mounts:
227-
- /boot
228-
- /boot/efi
229-
kernel_opts:
230-
- rw
231-
- '$ignition_firstboot'
232-
- mpp-format-string: '{extra_kargs}'
233-
inputs:
234-
images:
235-
type: org.osbuild.containers-storage
236-
origin: org.osbuild.source
237-
mpp-resolve-images:
238-
images:
239-
- source: $container_repo
240-
tag: $container_tag
241-
- type: org.osbuild.ostree.aleph
242-
options:
243-
coreos_compat: true
244-
deployment:
245-
default: true
246-
- type: org.osbuild.ostree.selinux
247-
options:
248-
deployment:
249-
default: true
250153
- name: raw-image
251154
build:
252155
mpp-format-string: '{buildroot}'
@@ -349,69 +252,37 @@ pipelines:
349252
partition:
350253
mpp-format-int: '{image.layout[''boot''].partnum}'
351254
target: /boot-mount-point
352-
- type: org.osbuild.selinux
353-
options:
354-
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
355-
target: mount://root/
356-
inputs:
357-
tree:
358-
type: org.osbuild.tree
359-
origin: org.osbuild.pipeline
360-
references:
361-
- name:deployed-tree
362-
devices:
363-
disk:
364-
type: org.osbuild.loopback
365-
options:
366-
filename: disk.img
367-
partscan: true
368-
mounts:
369-
- name: root
370-
type: org.osbuild.xfs
371-
source: disk
372-
partition:
373-
mpp-format-int: '{image.layout[''root''].partnum}'
374-
target: /
375-
- type: org.osbuild.selinux
376-
options:
377-
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
378-
target: mount://root/boot/
379-
inputs:
380-
tree:
381-
type: org.osbuild.tree
382-
origin: org.osbuild.pipeline
383-
references:
384-
- name:deployed-tree
385-
devices:
386-
disk:
387-
type: org.osbuild.loopback
388-
options:
389-
filename: disk.img
390-
partscan: true
391-
mounts:
392-
- name: root
393-
type: org.osbuild.xfs
394-
source: disk
395-
partition:
396-
mpp-format-int: '{image.layout[''root''].partnum}'
397-
target: /
398-
- name: boot
399-
type: org.osbuild.ext4
400-
source: disk
401-
partition:
402-
mpp-format-int: '{image.layout[''boot''].partnum}'
403-
target: /boot
404-
- type: org.osbuild.copy
405-
inputs:
406-
tree:
407-
type: org.osbuild.tree
408-
origin: org.osbuild.pipeline
409-
references:
410-
- name:tree
255+
# Use bootc install to-filesystem to install the ostree content from the container image
256+
# inside our disc image
257+
- type: org.osbuild.bootc.install-to-filesystem
258+
inputs:
259+
images:
260+
mpp-if: ociarchive != ''
261+
then:
262+
type: org.osbuild.containers
263+
origin: org.osbuild.pipeline
264+
references:
265+
name:oci-archive:
266+
name: coreos.ociarchive
267+
else:
268+
type: org.osbuild.containers-storage
269+
origin: org.osbuild.source
270+
mpp-resolve-images:
271+
images:
272+
- source: $container_repo
273+
tag: $container_tag
411274
options:
412-
paths:
413-
- from: input://tree/
414-
to: mount://root/
275+
kernel-args:
276+
- '$ignition_firstboot'
277+
- mpp-format-string: '{extra_kargs}'
278+
target-imgref:
279+
mpp-format-string: '{container_imgref}'
280+
stateroot:
281+
mpp-format-string: '{osname}'
282+
# Empty strings mean mount spec kargs are ommited entirely.
283+
# See github.com/bootc-dev/bootc/issues/1441
284+
boot-mount-spec: ""
285+
root-mount-spec: ""
415286
devices:
416287
disk:
417288
type: org.osbuild.loopback
@@ -437,13 +308,11 @@ pipelines:
437308
partition:
438309
mpp-format-int: '{image.layout[''EFI-SYSTEM''].partnum}'
439310
target: /boot/efi
440-
- type: org.osbuild.bootupd
311+
# set up the `ignition.firstboot` stamp at the end because
312+
# bootc want empty filesystems
313+
- type: org.osbuild.ignition
441314
options:
442-
bios:
443-
device: disk
444-
static-configs: true
445-
deployment:
446-
default: true
315+
target: mount://boot/
447316
devices:
448317
disk:
449318
type: org.osbuild.loopback
@@ -463,36 +332,6 @@ pipelines:
463332
partition:
464333
mpp-format-int: '{image.layout[''boot''].partnum}'
465334
target: /boot
466-
- name: efi
467-
type: org.osbuild.fat
468-
source: disk
469-
partition:
470-
mpp-format-int: '{image.layout[''EFI-SYSTEM''].partnum}'
471-
target: /boot/efi
472-
- type: org.osbuild.chattr
473-
options:
474-
items:
475-
mount://root/:
476-
immutable: true
477-
devices:
478-
disk:
479-
type: org.osbuild.loopback
480-
options:
481-
filename: disk.img
482-
partscan: true
483-
mounts:
484-
- name: root
485-
type: org.osbuild.xfs
486-
source: disk
487-
partition:
488-
mpp-format-int: '{image.layout[''root''].partnum}'
489-
target: /
490-
- name: ostree.deployment
491-
type: org.osbuild.ostree.deployment
492-
options:
493-
source: mount
494-
deployment:
495-
default: true
496335
- name: raw-4k-image
497336
build:
498337
mpp-format-string: '{buildroot}'
@@ -605,6 +444,10 @@ pipelines:
605444
partition:
606445
mpp-format-int: '{image4k.layout[''boot''].partnum}'
607446
target: /boot-mount-point
447+
# Set the context of the root of disk so that we avoid unlabeled_t files.
448+
# Here we make sure to not mount the boot partition because we want to label
449+
# the directory mount point
450+
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
608451
- type: org.osbuild.selinux
609452
options:
610453
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
@@ -630,10 +473,12 @@ pipelines:
630473
partition:
631474
mpp-format-int: '{image4k.layout[''root''].partnum}'
632475
target: /
476+
# Then we mount le boot parition and label again so the /boot/efi
477+
# mount point is labeled properly
633478
- type: org.osbuild.selinux
634479
options:
635480
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
636-
target: mount://root/boot/
481+
target: mount://root/boot
637482
inputs:
638483
tree:
639484
type: org.osbuild.tree
@@ -661,17 +506,37 @@ pipelines:
661506
partition:
662507
mpp-format-int: '{image4k.layout[''boot''].partnum}'
663508
target: /boot
664-
- type: org.osbuild.copy
665-
inputs:
666-
tree:
667-
type: org.osbuild.tree
668-
origin: org.osbuild.pipeline
669-
references:
670-
- name:tree
509+
# Use bootc install to-filesystem to install the ostree content from the container image
510+
# inside our disc image
511+
- type: org.osbuild.bootc.install-to-filesystem
512+
inputs:
513+
images:
514+
mpp-if: ociarchive != ''
515+
then:
516+
type: org.osbuild.containers
517+
origin: org.osbuild.pipeline
518+
references:
519+
name:oci-archive:
520+
name: coreos.ociarchive
521+
else:
522+
type: org.osbuild.containers-storage
523+
origin: org.osbuild.source
524+
mpp-resolve-images:
525+
images:
526+
- source: $container_repo
527+
tag: $container_tag
671528
options:
672-
paths:
673-
- from: input://tree/
674-
to: mount://root/
529+
kernel-args:
530+
- '$ignition_firstboot'
531+
- mpp-format-string: '{extra_kargs}'
532+
target-imgref:
533+
mpp-format-string: '{container_imgref}'
534+
stateroot:
535+
mpp-format-string: '{osname}'
536+
# Empty strings mean mount spec kargs are ommited entirely.
537+
# See github.com/bootc-dev/bootc/issues/1441
538+
boot-mount-spec: ""
539+
root-mount-spec: ""
675540
devices:
676541
disk:
677542
type: org.osbuild.loopback
@@ -699,11 +564,11 @@ pipelines:
699564
partition:
700565
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}'
701566
target: /boot/efi
702-
- type: org.osbuild.bootupd
567+
# set up the `ignition.firstboot` stamp at the end because
568+
# bootc want empty filesystems
569+
- type: org.osbuild.ignition
703570
options:
704-
static-configs: true
705-
deployment:
706-
default: true
571+
target: mount://boot/
707572
devices:
708573
disk:
709574
type: org.osbuild.loopback
@@ -725,38 +590,6 @@ pipelines:
725590
partition:
726591
mpp-format-int: '{image4k.layout[''boot''].partnum}'
727592
target: /boot
728-
- name: efi
729-
type: org.osbuild.fat
730-
source: disk
731-
partition:
732-
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}'
733-
target: /boot/efi
734-
- type: org.osbuild.chattr
735-
options:
736-
items:
737-
mount://root/:
738-
immutable: true
739-
devices:
740-
disk:
741-
type: org.osbuild.loopback
742-
options:
743-
filename: disk.img
744-
partscan: true
745-
sector-size:
746-
mpp-format-int: "{four_k_sector_size}"
747-
mounts:
748-
- name: root
749-
type: org.osbuild.xfs
750-
source: disk
751-
partition:
752-
mpp-format-int: '{image4k.layout[''root''].partnum}'
753-
target: /
754-
- name: ostree.deployment
755-
type: org.osbuild.ostree.deployment
756-
options:
757-
source: mount
758-
deployment:
759-
default: true
760593
- mpp-import-pipelines:
761594
path: platform.aliyun.ipp.yaml
762595
- mpp-import-pipelines:

0 commit comments

Comments
 (0)