-
Notifications
You must be signed in to change notification settings - Fork 82
Move OEM sysext build from vms phase to build_image #3619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
danzatt
wants to merge
6
commits into
main
Choose a base branch
from
danzatt/fix-oem-sysexts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3469ef7
overlay profiles: Enable cryptsetup in SDK systemd
danzatt feada25
sysext: Sign OS-dependent sysexts
danzatt ba354f0
sysext: Add OS-dependent sysext compression
danzatt 8cd4f6a
changelog: Add entry for signed OS-dependent sysexts
danzatt dfffe82
sysext: Move OEM sysext build to image phase
danzatt 5b87e64
changelog: Mention OEM sysext signing changes
danzatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # OEM sysexts table mapping OEM IDs to their packages and USE flags. | ||
| # Format: "name|metapackage|useflag|arches" | ||
| # | ||
| # VM types that use each OEM sysext: | ||
| # oem-akamai -> akamai | ||
| # oem-ami -> ami, ami_vmdk | ||
| # oem-azure -> azure | ||
| # oem-digitalocean -> digitalocean | ||
| # oem-gce -> gce | ||
| # oem-hetzner -> hetzner | ||
| # oem-hyperv -> hyperv, hyperv_vhdx | ||
| # oem-kubevirt -> kubevirt | ||
| # oem-nutanix -> nutanix | ||
| # oem-openstack -> openstack, openstack_mini | ||
| # oem-packet -> packet | ||
| # oem-proxmoxve -> proxmoxve | ||
| # oem-qemu -> qemu_uefi | ||
| # oem-scaleway -> scaleway | ||
| # oem-stackit -> stackit | ||
| # oem-vmware -> vmware, vmware_ova, vmware_raw | ||
|
|
||
| OEM_SYSEXTS=( | ||
| "oem-akamai|coreos-base/oem-akamai|akamai|amd64,arm64" | ||
| "oem-ami|coreos-base/oem-ami|ami|amd64,arm64" | ||
| "oem-azure|coreos-base/oem-azure|azure|amd64,arm64" | ||
| "oem-digitalocean|coreos-base/oem-digitalocean|digitalocean|amd64" | ||
| "oem-gce|coreos-base/oem-gce|gce|amd64" | ||
| "oem-hetzner|coreos-base/oem-hetzner|hetzner|amd64,arm64" | ||
| "oem-hyperv|coreos-base/oem-hyperv|hyperv|amd64" | ||
| "oem-kubevirt|coreos-base/oem-kubevirt|kubevirt|amd64,arm64" | ||
| "oem-nutanix|coreos-base/oem-nutanix|nutanix|amd64" | ||
| "oem-openstack|coreos-base/oem-openstack|openstack|amd64,arm64" | ||
| "oem-packet|coreos-base/oem-packet|packet|amd64,arm64" | ||
| "oem-proxmoxve|coreos-base/oem-proxmoxve|proxmoxve|amd64,arm64" | ||
| "oem-qemu|coreos-base/oem-qemu|qemu|amd64,arm64" | ||
| "oem-scaleway|coreos-base/oem-scaleway|scaleway|amd64,arm64" | ||
| "oem-stackit|coreos-base/oem-stackit|stackit|amd64,arm64" | ||
| "oem-vmware|coreos-base/oem-vmware|vmware|amd64" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -170,6 +170,10 @@ EOF | |||||||||||||||||||||||||||||
| # Remove source locale data, only need to ship the compiled archive. | ||||||||||||||||||||||||||||||
| sudo rm -rf ${root_fs_dir}/usr/share/i18n/ | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Inject ephemeral sysext signing certificate | ||||||||||||||||||||||||||||||
| sudo mkdir -p "${root_fs_dir}/usr/lib/verity.d" | ||||||||||||||||||||||||||||||
| sudo cp "${SYSEXT_SIGNING_KEY_DIR}/sysexts.crt" "${root_fs_dir}/usr/lib/verity.d" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Finish image will move files from /etc to /usr/share/flatcar/etc. | ||||||||||||||||||||||||||||||
| # Note that image filesystem contents generated by finish_image will not | ||||||||||||||||||||||||||||||
| # include sysext contents (only the sysext squashfs files themselves). | ||||||||||||||||||||||||||||||
|
|
@@ -269,6 +273,67 @@ create_prod_sysexts() { | |||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| create_oem_sysexts() { | ||||||||||||||||||||||||||||||
| local image_name="$1" | ||||||||||||||||||||||||||||||
| local image_sysext_base="${image_name%.bin}_sysext.squashfs" | ||||||||||||||||||||||||||||||
| local overlay_path | ||||||||||||||||||||||||||||||
| overlay_path=$(portageq get_repo_path / coreos-overlay) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| for sysext in "${OEM_SYSEXTS[@]}"; do | ||||||||||||||||||||||||||||||
| local name metapkg useflags arches | ||||||||||||||||||||||||||||||
| IFS="|" read -r name metapkg useflags arches <<< "$sysext" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if [[ "${name}" != oem-* ]]; then | ||||||||||||||||||||||||||||||
| die "OEM sysext name must start with 'oem-', got '${name}'" | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| local arch_array=(${arches//,/ }) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if [[ -n "$arches" ]]; then | ||||||||||||||||||||||||||||||
| local should_skip=1 | ||||||||||||||||||||||||||||||
| for arch in "${arch_array[@]}"; do | ||||||||||||||||||||||||||||||
| if [[ $arch == "$ARCH" ]]; then | ||||||||||||||||||||||||||||||
| should_skip=0 | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||
| if [[ $should_skip -eq 1 ]]; then | ||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+302
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Check for manglefs script in the package's files directory | ||||||||||||||||||||||||||||||
| local mangle_script="${overlay_path}/${metapkg}/files/manglefs.sh" | ||||||||||||||||||||||||||||||
| if [[ ! -x "${mangle_script}" ]]; then | ||||||||||||||||||||||||||||||
| mangle_script= | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| sudo rm -f "${BUILD_DIR}/${name}.raw" \ | ||||||||||||||||||||||||||||||
| "${BUILD_DIR}/flatcar_test_update-${name}.gz" \ | ||||||||||||||||||||||||||||||
| "${BUILD_DIR}/${name}_"* | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| info "Building OEM sysext ${name} with USE=${useflags}" | ||||||||||||||||||||||||||||||
| # The --install_root_basename="${name}-oem-sysext-rootfs" flag is | ||||||||||||||||||||||||||||||
| # important - it sets the name of a rootfs directory, which is | ||||||||||||||||||||||||||||||
| # used to determine the package target in | ||||||||||||||||||||||||||||||
| # coreos/base/profile.bashrc | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # OEM sysexts use no compression here since they will be stored | ||||||||||||||||||||||||||||||
| # in a compressed OEM partition. | ||||||||||||||||||||||||||||||
| USE="${useflags}" sudo -E "${SCRIPT_ROOT}/build_sysext" --board="${BOARD}" \ | ||||||||||||||||||||||||||||||
| --squashfs_base="${BUILD_DIR}/${image_sysext_base}" \ | ||||||||||||||||||||||||||||||
| --image_builddir="${BUILD_DIR}" \ | ||||||||||||||||||||||||||||||
| --metapkgs="${metapkg}" \ | ||||||||||||||||||||||||||||||
| --install_root_basename="${name}-oem-sysext-rootfs" \ | ||||||||||||||||||||||||||||||
| --compression=none \ | ||||||||||||||||||||||||||||||
| ${mangle_script:+--manglefs_script="${mangle_script}"} \ | ||||||||||||||||||||||||||||||
| "${name}" | ||||||||||||||||||||||||||||||
| delta_generator \ | ||||||||||||||||||||||||||||||
| -private_key "/usr/share/update_engine/update-payload-key.key.pem" \ | ||||||||||||||||||||||||||||||
| -new_image "${BUILD_DIR}/${name}.raw" \ | ||||||||||||||||||||||||||||||
| -out_file "${BUILD_DIR}/flatcar_test_update-${name}.gz" | ||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| sbsign_prod_image() { | ||||||||||||||||||||||||||||||
| local image_name="$1" | ||||||||||||||||||||||||||||||
| local disk_layout="$2" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, you can get the list of OEMs for each architecture via
get_oem_id_list? It looks a bit weird, but maybe it just works, and then you probably wouldn't need this new file. The helper is in the wrong place, under ci-automation, but maybe it could be moved? It doesn't give you the USE flags, but I'm not even sure those are needed, and the common-oem-files ebuild just assumes the flags match the OEM names anyway.