Flatcar: add target for Flatcar-compatible systemd sysext images#973
Flatcar: add target for Flatcar-compatible systemd sysext images#973kartikjoshi21 wants to merge 5 commits intoproject-dalec:mainfrom
Conversation
Signed-off-by: Kartik Joshi <karikjoshi21@gmail.com>
Signed-off-by: Kartik Joshi <karikjoshi21@gmail.com>
Signed-off-by: Kartik Joshi <karikjoshi21@gmail.com>
…ages This PR introduces initial Flatcar support by adding a new flatcar build target that produces Flatcar-compatible systemd system extension images (.raw). Signed-off-by: Kartik Joshi <karikjoshi21@gmail.com>
Signed-off-by: Kartik Joshi <karikjoshi21@gmail.com>
81fcf97 to
fc4ff38
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new Flatcar build target to Dalec, enabling production of Flatcar-compatible systemd system extension (.raw) images. The implementation follows established patterns in the codebase while introducing an optional interface for distro-specific sysext configuration.
Changes:
- Adds new Flatcar target with sysext support using the Flatcar SDK for building
- Introduces optional
sysextEnvProviderinterface allowing targets to supply default DALEC_SYSEXT_* environment variables - Implements smart merging logic that drops default SYSEXT_LEVEL when OS_VERSION_ID is pinned to avoid over-constraining extension matching
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| targets/linux/flatcar/flatcar.go | New Flatcar target implementation using composition pattern, delegating to Ubuntu Noble for base functionality while providing Flatcar-specific SDK worker and sysext defaults |
| targets/linux/distro_handler.go | Adds optional sysextEnvProvider interface and environment merging logic to pass DALEC_SYSEXT_* build args to build_sysext.sh with proper default handling |
| targets/linux/build_sysext.sh | Enhances script to support configurable output naming, OS ID matching, VERSION_ID/SYSEXT_LEVEL parameters, and creates proper symlinks for Flatcar naming conventions |
| targets/linux/sysext_env_test.go | Unit tests for DALEC_SYSEXT_* environment filtering and merging logic including the OS_VERSION_ID/SYSEXT_LEVEL precedence rule |
| targets/plugin/init.go | Registers new Flatcar target in plugin initialization |
| load.go | Allows DALEC_SYSEXT_* build args without requiring spec declaration |
| # systemd-sysext expects extension-release.<IMAGE> where <IMAGE> matches the image basename. | ||
| # Provide a matching entry for the produced image name. | ||
| if [ "${IMAGE_NAME}" != "${NAME}" ]; then | ||
| ln -sf "${BASE_REL}" "${REL_DIR}/extension-release.${IMAGE_NAME}" |
There was a problem hiding this comment.
The indentation here uses spaces instead of tabs, which is inconsistent with the rest of the file that uses tabs for indentation. Please change the leading spaces to a tab to maintain consistency.
| ln -sf "${BASE_REL}" "${REL_DIR}/extension-release.${IMAGE_NAME}" | |
| ln -sf "${BASE_REL}" "${REL_DIR}/extension-release.${IMAGE_NAME}" |
cpuguy83
left a comment
There was a problem hiding this comment.
What's the advantage of this change other than setting flatcar specific vars?
| const TargetKey = "flatcar" | ||
|
|
||
| // Default SDK image. Keep it overrideable by code later if you want. | ||
| const DefaultSDKImage = "ghcr.io/flatcar/flatcar-sdk-all:4593.0.0" |
There was a problem hiding this comment.
Is all we need from this sdk mkfs.erofs (and other basic tools)?
This image is huge (almost 6GB).
This PR adds an initial Flatcar build target to Dalec focused on producing Flatcar-compatible systemd system extension images (.raw).
Default behavior for Flatcar sysext
The Flatcar target provides defaults aligned with Flatcar expectations:
Tests
Adds unit coverage for:
Fixes: #969