Skip to content

Commit 9ad237c

Browse files
committed
osbuild: conditionally use bootc install
This adds raw-{,4k}-image-bootc manifests that are alternative versions of the raw-{,4k}-image manifests. This will allow to keep the legacy build path with a new path that leverages bootc install to filesystem. In this mode 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 conditionalize this 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 a643e23 commit 9ad237c

12 files changed

Lines changed: 728 additions & 124 deletions

src/cmd-osbuild

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ generate_runvm_osbuild_config() {
182182
# Grab a few values from $image_json
183183
extra_kargs="$(python3 -c 'import sys, json; args = json.load(sys.stdin)["extra-kargs"]; print(" ".join(args))' < "${image_json}")"
184184

185+
# Use the bootc install to-filesystem manifest if applicable.
186+
use_bootc_install=$(getconfig_def "bootc-install-to-fs" "false" "${image_json}")
187+
185188
# OStree container ociarchive file path
186189
ostree_container="${builddir}/$(meta_key images.ostree.path)"
187190
# If no container_imgref was set let's just set it to some professional
@@ -229,6 +232,7 @@ rootfs-size: "${rootfs_size_mb}"
229232
# "localhost/${name}:${build}" was the default name:tag used by cmd-build-with-buildah
230233
container-repo: "localhost/${name}"
231234
container-tag: "${build}"
235+
use-bootc-install: "${use_bootc_install}"
232236
EOF
233237
}
234238

@@ -415,10 +419,10 @@ main() {
415419
# osbuild can then be started with `bash tmp/build.<artifact>/cmd.sh`
416420
# See comment about checkpoints in runvm-osbuild
417421
# RUNVM_SHELL=1 \
418-
$cmd -- /usr/lib/coreos-assembler/runvm-osbuild \
419-
--config "${runvm_osbuild_config_json}" \
420-
--mpp "/usr/lib/coreos-assembler/osbuild-manifests/coreos.osbuild.${basearch}.mpp.yaml" \
421-
--outdir "${outdir}" \
422+
$cmd -- /usr/lib/coreos-assembler/runvm-osbuild \
423+
--config "${runvm_osbuild_config_json}" \
424+
--mpp "/usr/lib/coreos-assembler/osbuild-manifests/coreos.osbuild.${basearch}.mpp.yaml" \
425+
--outdir "${outdir}" \
422426
--platforms "$(IFS=,; echo "${platforms[*]}")"
423427

424428
for platform in "${platforms[@]}"; do

src/osbuild-manifests/build.common.ipp.yaml

Lines changed: 114 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -55,121 +55,125 @@ pipelines:
5555
- source: $container_repo
5656
tag: $container_tag
5757
# Build up the filesystem tree used to construct disk images later.
58-
- name: tree
59-
build:
60-
mpp-format-string: '{buildroot}'
61-
source-epoch: 1659397331
62-
stages:
63-
# Set the context of the root of the tree so that we avoid unlabeled_t files.
64-
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
65-
- type: org.osbuild.selinux
66-
options:
67-
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
68-
target: tree:///
69-
inputs:
70-
tree:
71-
type: org.osbuild.tree
72-
origin: org.osbuild.pipeline
73-
references:
74-
- name:deployed-tree
75-
- type: org.osbuild.ostree.init-fs
76-
- type: org.osbuild.ostree.os-init
77-
options:
78-
osname:
79-
mpp-format-string: '{osname}'
80-
- type: org.osbuild.ostree.config
81-
options:
82-
repo: /ostree/repo
83-
config:
84-
sysroot:
85-
readonly: true
86-
bootloader: none
87-
# https://github.com/coreos/fedora-coreos-tracker/issues/1333
88-
# no grub_users="" on s390x
89-
bls-append-except-default:
90-
mpp-if: arch != 's390x'
91-
then: 'grub_users=""'
92-
# Opt-in to https://github.com/ostreedev/ostree/pull/2705 which will
93-
# add /boot as the prefix on top of BLS config entries. This is OK
94-
# because there is a symlink that is created in the root of the boot
95-
# filesystem by OSTree (boot -> .) that makes it so that /boot paths
96-
# will always work.
97-
bootprefix: true
98-
# Create /boot/efi mountpoint on EFI architectures
99-
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
100-
then:
101-
type: org.osbuild.mkdir
58+
# This is only needed for the non-bootc path; when using bootc install
59+
# the tree construction is handled by bootc install-to-filesystem.
60+
- mpp-if: use_bootc_install != 'true'
61+
then:
62+
name: tree
63+
build:
64+
mpp-format-string: '{buildroot}'
65+
source-epoch: 1659397331
66+
stages:
67+
# Set the context of the root of the tree so that we avoid unlabeled_t files.
68+
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
69+
- type: org.osbuild.selinux
10270
options:
103-
paths:
104-
- path: /boot/efi
105-
mode: 493
106-
- type: org.osbuild.ignition
107-
# Deploy via ociarchive or container
108-
- type: org.osbuild.ostree.deploy.container
109-
options:
110-
osname:
111-
mpp-format-string: '{osname}'
112-
target_imgref:
113-
mpp-format-string: '{container_imgref}'
114-
mounts:
115-
- /boot
116-
# Mount /boot/efi on EFI architectures
117-
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
118-
then: /boot/efi
119-
kernel_opts:
120-
- rw
121-
# '$ignition_firstboot' only works with GRUB, not available on s390x
122-
- mpp-if: arch != 's390x'
123-
then: '$ignition_firstboot'
124-
- mpp-format-string: '{extra_kargs}'
125-
inputs:
126-
images:
127-
mpp-if: ociarchive != ''
128-
then:
129-
type: org.osbuild.containers
71+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
72+
target: tree:///
73+
inputs:
74+
tree:
75+
type: org.osbuild.tree
13076
origin: org.osbuild.pipeline
13177
references:
132-
name:oci-archive:
133-
name: coreos.ociarchive
134-
else:
135-
type: org.osbuild.containers-storage
136-
origin: org.osbuild.source
137-
mpp-resolve-images:
138-
images:
139-
- source: $container_repo
140-
tag: $container_tag
141-
# Drop the immutable bit here (we add it back later) because it
142-
# causes failures when cleaning up tmp dirs.
143-
- mpp-if: arch in ['ppc64le', 's390x']
144-
then:
145-
type: org.osbuild.chattr
78+
- name:deployed-tree
79+
- type: org.osbuild.ostree.init-fs
80+
- type: org.osbuild.ostree.os-init
14681
options:
147-
items:
148-
tree:///:
149-
immutable: false
150-
mounts:
151-
- name: ostree.deployment
152-
type: org.osbuild.ostree.deployment
153-
options:
154-
deployment:
155-
default: true
156-
# On s390x set the bootloader to zipl. We need to do it here
157-
# rather than in the ostree.config stage above because we don't want
158-
# OSTree to invoke zipl during the deploy. It's done later in zipl.inst.
159-
- mpp-if: arch == 's390x'
160-
then:
161-
type: org.osbuild.ostree.config
82+
osname:
83+
mpp-format-string: '{osname}'
84+
- type: org.osbuild.ostree.config
16285
options:
16386
repo: /ostree/repo
16487
config:
16588
sysroot:
166-
bootloader: zipl
167-
- type: org.osbuild.ostree.aleph
168-
options:
169-
coreos_compat: true
170-
deployment:
171-
default: true
172-
- type: org.osbuild.ostree.selinux
173-
options:
174-
deployment:
175-
default: true
89+
readonly: true
90+
bootloader: none
91+
# https://github.com/coreos/fedora-coreos-tracker/issues/1333
92+
# no grub_users="" on s390x
93+
bls-append-except-default:
94+
mpp-if: arch != 's390x'
95+
then: 'grub_users=""'
96+
# Opt-in to https://github.com/ostreedev/ostree/pull/2705 which will
97+
# add /boot as the prefix on top of BLS config entries. This is OK
98+
# because there is a symlink that is created in the root of the boot
99+
# filesystem by OSTree (boot -> .) that makes it so that /boot paths
100+
# will always work.
101+
bootprefix: true
102+
# Create /boot/efi mountpoint on EFI architectures
103+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
104+
then:
105+
type: org.osbuild.mkdir
106+
options:
107+
paths:
108+
- path: /boot/efi
109+
mode: 493
110+
- type: org.osbuild.ignition
111+
# Deploy via ociarchive or container
112+
- type: org.osbuild.ostree.deploy.container
113+
options:
114+
osname:
115+
mpp-format-string: '{osname}'
116+
target_imgref:
117+
mpp-format-string: '{container_imgref}'
118+
mounts:
119+
- /boot
120+
# Mount /boot/efi on EFI architectures
121+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
122+
then: /boot/efi
123+
kernel_opts:
124+
- rw
125+
# '$ignition_firstboot' only works with GRUB, not available on s390x
126+
- mpp-if: arch != 's390x'
127+
then: '$ignition_firstboot'
128+
- mpp-format-string: '{extra_kargs}'
129+
inputs:
130+
images:
131+
mpp-if: ociarchive != ''
132+
then:
133+
type: org.osbuild.containers
134+
origin: org.osbuild.pipeline
135+
references:
136+
name:oci-archive:
137+
name: coreos.ociarchive
138+
else:
139+
type: org.osbuild.containers-storage
140+
origin: org.osbuild.source
141+
mpp-resolve-images:
142+
images:
143+
- source: $container_repo
144+
tag: $container_tag
145+
# Drop the immutable bit here (we add it back later) because it
146+
# causes failures when cleaning up tmp dirs.
147+
- mpp-if: arch in ['ppc64le', 's390x']
148+
then:
149+
type: org.osbuild.chattr
150+
options:
151+
items:
152+
tree:///:
153+
immutable: false
154+
mounts:
155+
- name: ostree.deployment
156+
type: org.osbuild.ostree.deployment
157+
options:
158+
deployment:
159+
default: true
160+
# On s390x set the bootloader to zipl. We need to do it here
161+
# rather than in the ostree.config stage above because we don't want
162+
# OSTree to invoke zipl during the deploy. It's done later in zipl.inst.
163+
- mpp-if: arch == 's390x'
164+
then:
165+
type: org.osbuild.ostree.config
166+
options:
167+
repo: /ostree/repo
168+
config:
169+
sysroot:
170+
bootloader: zipl
171+
- type: org.osbuild.ostree.aleph
172+
options:
173+
coreos_compat: true
174+
deployment:
175+
default: true
176+
- type: org.osbuild.ostree.selinux
177+
options:
178+
deployment:
179+
default: true

0 commit comments

Comments
 (0)