Slim down the things we export.

This commit is contained in:
James Pace 2022-12-21 21:08:12 -05:00
parent 39a2d2d417
commit 235b55afcc
6 changed files with 3 additions and 297 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
repo/ repo/
_build/ _build/
*.repo/ *.repo/
*.tar

View File

@ -39,7 +39,7 @@ endif
export CHECKPOINTS=build export CHECKPOINTS=build
IMAGETYPES := regular ostree IMAGETYPES := regular ostree
FORMATS := img qcow2 oci.tar repo rootfs ext4 tar FORMATS := oci.tar repo tar
COMMON_TARGETS := qemu COMMON_TARGETS := qemu
HOST_TARGETS := $(COMMON_TARGETS) $($(HOST_ARCH)_TARGETS) HOST_TARGETS := $(COMMON_TARGETS) $($(HOST_ARCH)_TARGETS)
ALL_TARGETS := $(COMMON_TARGETS) $(foreach a,$(ARCHES), $($(a)_TARGETS)) ALL_TARGETS := $(COMMON_TARGETS) $(foreach a,$(ARCHES), $($(a)_TARGETS))

View File

@ -1,73 +0,0 @@
version: '2'
mpp-vars:
image_rpms:
mpp-join:
- mpp-eval: locals().get('extra_image_rpms', [])
- mpp-eval: boot_rpms
- mpp-eval: locals().get('extra_boot_rpms', [])
- - shim
pipelines:
- name: image-tree
build: name:build
stages:
mpp-join:
- - type: org.osbuild.copy
inputs:
tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:rootfs
options:
paths:
mpp-join:
- - from: input://tree/
to: tree:///
- type: org.osbuild.users
options:
users:
root:
password:
mpp-eval: root_password
key:
mpp-eval: root_ssh_key
- mpp-eval: target_stages
- - type: org.osbuild.dracut
options:
kernel:
- mpp-eval: rpms['rootfs'][kernel_rpm + '-core'].evra
add_modules:
mpp-eval: dracut_add_modules
omit_modules:
mpp-eval: dracut_omit_modules
add_drivers:
mpp-eval: dracut_add_drivers
filesystems:
mpp-eval: dracut_filesystems
install:
mpp-eval: dracut_install
- type: org.osbuild.fstab
options:
filesystems:
mpp-eval: fstab
- type: org.osbuild.grub2
options:
root_fs_uuid:
mpp-eval: rootfs_uuid
boot_fs_uuid:
mpp-eval: bootfs_uuid
kernel_opts:
mpp-eval: ''' '' .join(kernel_opts)'
uefi:
vendor:
mpp-eval: uefi_vendor
unified: false
legacy: true
write_defaults: false
greenboot: true
- type: org.osbuild.fix-bls
options:
prefix: /
- type: org.osbuild.selinux
options:
file_contexts: etc/selinux/targeted/contexts/files/file_contexts

View File

@ -14,135 +14,6 @@ pipelines:
# Some variables need to be written to files, do that here # Some variables need to be written to files, do that here
- mpp-import-pipelines: - mpp-import-pipelines:
path: image-$image_type.ipp.yml path: image-$image_type.ipp.yml
- name: image
build: name:build
stages:
- type: org.osbuild.truncate
options:
filename: disk.img
size:
mpp-eval: image.size
- type: org.osbuild.sfdisk
devices:
device:
type: org.osbuild.loopback
options:
filename: disk.img
options:
mpp-format-json: '{image.layout}'
- type: org.osbuild.mkfs.fat
devices:
device:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['efi'].start
size:
mpp-eval: image.layout['efi'].size
options:
label: ESP
volid: 7B7795E7
- type: org.osbuild.mkfs.ext4
devices:
device:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['boot'].start
size:
mpp-eval: image.layout['boot'].size
options:
uuid:
mpp-eval: bootfs_uuid
label: boot
- type: org.osbuild.mkfs.ext4
devices:
device:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['root'].start
size:
mpp-eval: image.layout['root'].size
options:
uuid:
mpp-eval: rootfs_uuid
label: root
- type: org.osbuild.copy
inputs:
tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:image-tree
build-tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:build
options:
paths:
mpp-join:
- - from: input://tree/
to: mount://root/
- mpp-eval: locals().get('extra_image_copy_' + image_type, [])
devices:
efi:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['efi'].start
size:
mpp-eval: image.layout['efi'].size
boot:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['boot'].start
size:
mpp-eval: image.layout['boot'].size
root:
type: org.osbuild.loopback
options:
filename: disk.img
start:
mpp-eval: image.layout['root'].start
size:
mpp-eval: image.layout['root'].size
mounts:
- name: root
type: org.osbuild.ext4
source: root
target: /
- name: boot
type: org.osbuild.ext4
source: boot
target: /boot
- name: efi
type: org.osbuild.fat
source: efi
target: /boot/efi
- name: qcow2
build: name:build
stages:
- type: org.osbuild.qemu
inputs:
image:
type: org.osbuild.files
origin: org.osbuild.pipeline
references:
name:image:
file: disk.img
options:
filename: disk.qcow2
format:
type: qcow2
compat: '1.1'
- name: container - name: container
build: name:build build: name:build
@ -161,85 +32,6 @@ pipelines:
Cmd: Cmd:
- "/usr/bin/bash" - "/usr/bin/bash"
# We need a smaller fstab for the non-partitioned case
- name: ext4-fstab
build: name:build
stages:
# We copy /etc to get the right selinux context on the new file
- type: org.osbuild.copy
inputs:
image-tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:image-tree
options:
paths:
- from: input://image-tree/etc
to: tree:///etc
- type: org.osbuild.fstab
options:
filesystems:
- uuid:
mpp-eval: rootfs_uuid
vfs_type: ext4
path: /
- name: ext4
build: name:build
stages:
- type: org.osbuild.truncate
options:
filename: rootfs.ext4
size:
mpp-eval: image.size
- type: org.osbuild.mkfs.ext4
devices:
device:
type: org.osbuild.loopback
options:
filename: rootfs.ext4
start: 0
size:
mpp-format-int: "{int(image.size) // 512}"
options:
uuid:
mpp-eval: rootfs_uuid
label: root
- type: org.osbuild.copy
inputs:
tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:image-tree
fstab:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:ext4-fstab
options:
paths:
mpp-join:
- - from: input://tree/
to: mount://root/
- from: input://fstab/etc/fstab
to: mount://root/etc/fstab
- mpp-eval: locals().get('extra_image_copy_' + image_type, [])
devices:
root:
type: org.osbuild.loopback
options:
filename: rootfs.ext4
start: 0
size:
mpp-format-int: "{int(image.size) // 512}"
mounts:
- name: root
type: org.osbuild.ext4
source: root
target: /
- name: tar - name: tar
build: name:build build: name:build
stages: stages:

View File

@ -5,10 +5,4 @@ sudo podman run --rm \
-w /project \ -w /project \
localhost/j7s-os-builder:latest \ localhost/j7s-os-builder:latest \
make cs9-qemu-minimal-ostree.x86_64.repo make cs9-qemu-minimal-ostree.x86_64.repo
echo "========> Building container."
sudo podman run --rm \
--privileged \
-v $PWD:/project:Z \
-w /project \
localhost/j7s-os-builder:latest \
make cs9-qemu-container-ostree.x86_64.repo

View File

@ -25,22 +25,14 @@ EXTENSION="$6"
# Map extension => export pipeline name # Map extension => export pipeline name
declare -A EXPORT_BY_EXT declare -A EXPORT_BY_EXT
EXPORT_BY_EXT[img]=image
EXPORT_BY_EXT[oci.tar]=container EXPORT_BY_EXT[oci.tar]=container
EXPORT_BY_EXT[qcow2]=qcow2
EXPORT_BY_EXT[repo]=ostree-commit EXPORT_BY_EXT[repo]=ostree-commit
EXPORT_BY_EXT[rootfs]=rootfs
EXPORT_BY_EXT[ext4]=ext4
EXPORT_BY_EXT[tar]=tar EXPORT_BY_EXT[tar]=tar
# Map extension to name of exported file by pipeline # Map extension to name of exported file by pipeline
declare -A EXPORT_FILE_BY_EXT declare -A EXPORT_FILE_BY_EXT
EXPORT_FILE_BY_EXT[img]=disk.img
EXPORT_FILE_BY_EXT[qcow2]=disk.qcow2
EXPORT_FILE_BY_EXT[oci.tar]=container.tar EXPORT_FILE_BY_EXT[oci.tar]=container.tar
EXPORT_FILE_BY_EXT[repo]=repo EXPORT_FILE_BY_EXT[repo]=repo
EXPORT_FILE_BY_EXT[rootfs]=
EXPORT_FILE_BY_EXT[ext4]=rootfs.ext4
EXPORT_FILE_BY_EXT[tar]=rootfs.tar EXPORT_FILE_BY_EXT[tar]=rootfs.tar
EXPORT=${EXPORT_BY_EXT[${EXTENSION}]} EXPORT=${EXPORT_BY_EXT[${EXTENSION}]}