|
| 1 | +# This file defines the raw-4k-image pipeline that leverages bootc install. |
| 2 | +version: '2' |
| 3 | +pipelines: |
| 4 | + - name: raw-4k-image |
| 5 | + build: |
| 6 | + mpp-format-string: '{buildroot}' |
| 7 | + stages: |
| 8 | + - type: org.osbuild.truncate |
| 9 | + options: |
| 10 | + filename: disk.img |
| 11 | + size: |
| 12 | + mpp-format-string: '{image4k.size}' |
| 13 | + - type: org.osbuild.sfdisk |
| 14 | + devices: |
| 15 | + device: |
| 16 | + type: org.osbuild.loopback |
| 17 | + options: |
| 18 | + filename: disk.img |
| 19 | + sector-size: |
| 20 | + mpp-format-int: "{four_k_sector_size}" |
| 21 | + options: |
| 22 | + mpp-format-json: '{image4k.layout}' |
| 23 | + # Create EFI filesystem on EFI architectures |
| 24 | + - mpp-if: arch in ['x86_64', 'aarch64', 'riscv64'] |
| 25 | + then: |
| 26 | + type: org.osbuild.mkfs.fat |
| 27 | + devices: |
| 28 | + device: |
| 29 | + type: org.osbuild.loopback |
| 30 | + options: |
| 31 | + filename: disk.img |
| 32 | + start: |
| 33 | + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].start}' |
| 34 | + size: |
| 35 | + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].size}' |
| 36 | + lock: true |
| 37 | + sector-size: |
| 38 | + mpp-format-int: "{four_k_sector_size}" |
| 39 | + options: |
| 40 | + label: EFI-SYSTEM |
| 41 | + volid: 7B7795E7 |
| 42 | + - type: org.osbuild.mkfs.ext4 |
| 43 | + devices: |
| 44 | + device: |
| 45 | + type: org.osbuild.loopback |
| 46 | + options: |
| 47 | + filename: disk.img |
| 48 | + start: |
| 49 | + mpp-format-int: '{image4k.layout[''boot''].start}' |
| 50 | + size: |
| 51 | + mpp-format-int: '{image4k.layout[''boot''].size}' |
| 52 | + lock: true |
| 53 | + sector-size: |
| 54 | + mpp-format-int: "{four_k_sector_size}" |
| 55 | + options: |
| 56 | + uuid: |
| 57 | + mpp-format-string: '{boot_fs_uuid}' |
| 58 | + label: |
| 59 | + mpp-format-string: '{boot_fs_label}' |
| 60 | + # Set manually the metadata_csum_seed ext4 option otherwise changing the |
| 61 | + # filesystem UUID while it's mounted doesn't work. Can remove this when |
| 62 | + # metadata_csum_seed is default in RHEL, which can be checked by looking |
| 63 | + # in /etc/mke2fs.conf. |
| 64 | + metadata_csum_seed: true |
| 65 | + - type: org.osbuild.mkfs.xfs |
| 66 | + devices: |
| 67 | + device: |
| 68 | + type: org.osbuild.loopback |
| 69 | + options: |
| 70 | + filename: disk.img |
| 71 | + start: |
| 72 | + mpp-format-int: '{image4k.layout[''root''].start}' |
| 73 | + size: |
| 74 | + mpp-format-int: '{image4k.layout[''root''].size}' |
| 75 | + lock: true |
| 76 | + sector-size: |
| 77 | + mpp-format-int: "{four_k_sector_size}" |
| 78 | + options: |
| 79 | + agcount: |
| 80 | + mpp-format-int: '{root_fs_agcount}' |
| 81 | + uuid: |
| 82 | + mpp-format-string: '{root_fs_uuid}' |
| 83 | + label: |
| 84 | + mpp-format-string: '{root_fs_label}' |
| 85 | + # We've created the filesystems. Now let's create the mountpoints (directories) |
| 86 | + # on the filesystems and label them with appropriate SELinux labels. This also |
| 87 | + # covers things like filesystem autogenerated files like 'lost+found'. The labeling |
| 88 | + # will happen once with just the root filesystem mounted and once with the boot |
| 89 | + # filesystem mounted too (to make sure we get all potentially hidden mountpoints). |
| 90 | + # https://github.com/coreos/fedora-coreos-tracker/issues/1771 |
| 91 | + - type: org.osbuild.mkdir |
| 92 | + options: |
| 93 | + paths: |
| 94 | + - path: mount://root/boot |
| 95 | + mode: 493 |
| 96 | + # Create /boot/efi mountpoint on EFI architectures |
| 97 | + - mpp-if: arch in ['x86_64', 'aarch64', 'riscv64'] |
| 98 | + then: |
| 99 | + path: mount://boot/efi |
| 100 | + mode: 493 |
| 101 | + devices: |
| 102 | + disk: |
| 103 | + type: org.osbuild.loopback |
| 104 | + options: |
| 105 | + filename: disk.img |
| 106 | + partscan: true |
| 107 | + sector-size: |
| 108 | + mpp-format-int: "{four_k_sector_size}" |
| 109 | + mounts: |
| 110 | + - name: root |
| 111 | + type: org.osbuild.xfs |
| 112 | + source: disk |
| 113 | + partition: |
| 114 | + mpp-format-int: '{image4k.layout[''root''].partnum}' |
| 115 | + target: /root-mount-point |
| 116 | + # Mount boot partition on EFI architectures for /boot/efi creation |
| 117 | + - mpp-if: arch in ['x86_64', 'aarch64', 'riscv64'] |
| 118 | + then: |
| 119 | + name: boot |
| 120 | + type: org.osbuild.ext4 |
| 121 | + source: disk |
| 122 | + partition: |
| 123 | + mpp-format-int: '{image4k.layout[''boot''].partnum}' |
| 124 | + target: /boot-mount-point |
| 125 | + # Set the context of the root of disk so that we avoid unlabeled_t files. |
| 126 | + # Here we make sure to not mount the boot partition because we want to label |
| 127 | + # the directory mount point |
| 128 | + # https://github.com/coreos/fedora-coreos-tracker/issues/1772 |
| 129 | + - type: org.osbuild.selinux |
| 130 | + options: |
| 131 | + file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts |
| 132 | + target: mount://root/ |
| 133 | + inputs: |
| 134 | + tree: |
| 135 | + type: org.osbuild.tree |
| 136 | + origin: org.osbuild.pipeline |
| 137 | + references: |
| 138 | + - name:deployed-tree |
| 139 | + devices: |
| 140 | + disk: |
| 141 | + type: org.osbuild.loopback |
| 142 | + options: |
| 143 | + filename: disk.img |
| 144 | + partscan: true |
| 145 | + sector-size: |
| 146 | + mpp-format-int: "{four_k_sector_size}" |
| 147 | + mounts: |
| 148 | + - name: root |
| 149 | + type: org.osbuild.xfs |
| 150 | + source: disk |
| 151 | + partition: |
| 152 | + mpp-format-int: '{image4k.layout[''root''].partnum}' |
| 153 | + target: / |
| 154 | + # Then we mount the boot parition and label again so the /boot/efi |
| 155 | + # mount point is labeled properly |
| 156 | + - type: org.osbuild.selinux |
| 157 | + options: |
| 158 | + file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts |
| 159 | + target: mount://root/boot/ |
| 160 | + inputs: |
| 161 | + tree: |
| 162 | + type: org.osbuild.tree |
| 163 | + origin: org.osbuild.pipeline |
| 164 | + references: |
| 165 | + - name:deployed-tree |
| 166 | + devices: |
| 167 | + disk: |
| 168 | + type: org.osbuild.loopback |
| 169 | + options: |
| 170 | + filename: disk.img |
| 171 | + partscan: true |
| 172 | + sector-size: |
| 173 | + mpp-format-int: "{four_k_sector_size}" |
| 174 | + mounts: |
| 175 | + - name: root |
| 176 | + type: org.osbuild.xfs |
| 177 | + source: disk |
| 178 | + partition: |
| 179 | + mpp-format-int: '{image4k.layout[''root''].partnum}' |
| 180 | + target: / |
| 181 | + - name: boot |
| 182 | + type: org.osbuild.ext4 |
| 183 | + source: disk |
| 184 | + partition: |
| 185 | + mpp-format-int: '{image4k.layout[''boot''].partnum}' |
| 186 | + target: /boot |
| 187 | + # Use bootc install to-filesystem to install the ostree content from the container image |
| 188 | + # inside our disc image |
| 189 | + - type: org.osbuild.bootc.install-to-filesystem |
| 190 | + inputs: |
| 191 | + images: |
| 192 | + mpp-if: ociarchive != '' |
| 193 | + then: |
| 194 | + type: org.osbuild.containers |
| 195 | + origin: org.osbuild.pipeline |
| 196 | + references: |
| 197 | + name:oci-archive: |
| 198 | + name: coreos.ociarchive |
| 199 | + else: |
| 200 | + type: org.osbuild.containers-storage |
| 201 | + origin: org.osbuild.source |
| 202 | + mpp-resolve-images: |
| 203 | + images: |
| 204 | + - source: $container_repo |
| 205 | + tag: $container_tag |
| 206 | + options: |
| 207 | + kernel-args: |
| 208 | + # '$ignition_firstboot' only works with GRUB, not available on s390x |
| 209 | + - mpp-if: arch != 's390x' |
| 210 | + then: '$ignition_firstboot' |
| 211 | + - mpp-format-string: '{extra_kargs}' |
| 212 | + target-imgref: |
| 213 | + mpp-format-string: '{container_imgref}' |
| 214 | + stateroot: |
| 215 | + mpp-format-string: '{osname}' |
| 216 | + # Empty strings mean mount spec kargs are ommited entirely. |
| 217 | + # See github.com/bootc-dev/bootc/issues/1441 |
| 218 | + boot-mount-spec: "" |
| 219 | + root-mount-spec: "" |
| 220 | + devices: |
| 221 | + disk: |
| 222 | + type: org.osbuild.loopback |
| 223 | + options: |
| 224 | + filename: disk.img |
| 225 | + partscan: true |
| 226 | + sector-size: |
| 227 | + mpp-format-int: "{four_k_sector_size}" |
| 228 | + mounts: |
| 229 | + - name: root |
| 230 | + type: org.osbuild.xfs |
| 231 | + source: disk |
| 232 | + partition: |
| 233 | + mpp-format-int: '{image4k.layout[''root''].partnum}' |
| 234 | + target: / |
| 235 | + - name: boot |
| 236 | + type: org.osbuild.ext4 |
| 237 | + source: disk |
| 238 | + partition: |
| 239 | + mpp-format-int: '{image4k.layout[''boot''].partnum}' |
| 240 | + target: /boot |
| 241 | + # Mount EFI partition on EFI architectures |
| 242 | + - mpp-if: arch in ['x86_64', 'aarch64', 'riscv64'] |
| 243 | + then: |
| 244 | + name: efi |
| 245 | + type: org.osbuild.fat |
| 246 | + source: disk |
| 247 | + partition: |
| 248 | + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}' |
| 249 | + target: /boot/efi |
| 250 | + # set up the `ignition.firstboot` stamp at the end because |
| 251 | + # bootc want empty filesystems |
| 252 | + - type: org.osbuild.ignition |
| 253 | + options: |
| 254 | + target: mount://boot/ |
| 255 | + devices: |
| 256 | + disk: |
| 257 | + type: org.osbuild.loopback |
| 258 | + options: |
| 259 | + filename: disk.img |
| 260 | + partscan: true |
| 261 | + sector-size: |
| 262 | + mpp-format-int: "{four_k_sector_size}" |
| 263 | + mounts: |
| 264 | + - name: root |
| 265 | + type: org.osbuild.xfs |
| 266 | + source: disk |
| 267 | + partition: |
| 268 | + mpp-format-int: '{image4k.layout[''root''].partnum}' |
| 269 | + target: / |
| 270 | + - name: boot |
| 271 | + type: org.osbuild.ext4 |
| 272 | + source: disk |
| 273 | + partition: |
| 274 | + mpp-format-int: '{image4k.layout[''boot''].partnum}' |
| 275 | + target: /boot |
0 commit comments