Commit Graph

23 Commits

Author SHA1 Message Date
Mathieu Tortuyaux
5a8ecab5ed
build_sysext: override FLATCAR_VERSION only for non-official builds
Without this, official builds are failing:
```
This is a dev rebuild of an official release tag: No BUILD ID set in '/mnt/host/source/.repo/manifests/version.txt'.  Will use base squasfs BUILD ID for version check.
Repo root FLATCAR_VERSION is '4081.0.0', squashfs build ID is '2024-09-03-2245'
Setting FLATCAR_VERSION to '4081.0.0+2024-09-03-2245'
Base squashfs version: 4081.0.0
SDK board packages version: 4081.0.0+2024-09-03-2245
Version mismatch between board flatcar release and SDK container flatcar release.
```

The "base squashfs version" is the actual version for official release builds.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2024-09-04 15:24:44 +02:00
Mathieu Tortuyaux
69d6efe414
build_sysext: apply comments from PR 2259
this is from commit: 5b70e8399a

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2024-09-04 10:47:31 +02:00
Jeremi Piotrowski
247fcc2e93 build_sysext: Add check for invalid file permissions in sysext
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-08-30 09:42:34 +02:00
Thilo Fromm
1b7c0c2ecc build_sysext: Detect dev rebuild of release tag, fix build ID issue
build_sysext uses a base squashfs (basically a full snapshot of the
Flatcar OS image) to build custom sysexts on top. Before building it
ensures the base image actualy matches the OS version in the repository
root.

The version string includes a BUILD_ID which might be auto-generated (by
including common.sh) if it is not present in the version file - e.g.
when the version is an official release (tag). This build ID
auto-generation causes issues with the version check when image build
and sysext build scripts run independently - each will generate its own
build ID, and this will cause build_sysext's version check to fail.

build_sysext will now use the build id from the base squashfs when it is
not set in the source tree's version.txt to work around that issue. This
is a more general solution than 361eda220b
(which this patch reverts) as it directly addresses the issue in
build_sysext instead of working around it in sysext_prod_builder.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2024-08-29 10:39:07 +02:00
Kai Lueke
dcd7ee6fc4 Silence mksquashfs warnings by excluding btrfs attributes
When mksquashfs encounters btrfs attributes which indicate that the file
is transparently compressed, it can't embed this info in the squashfs
and prints a warning about that.
Silence the warnings by excluding btrfs attributes as done already in
the rest of the code base. This aligns the mksquashfs invocation in this
regard.
2024-04-15 20:15:05 +09:00
Jeremi Piotrowski
54c8545eec build_sysext: Set SOURCE_DATE_EPOCH for reproducibility
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 10:18:17 +00:00
Jeremi Piotrowski
fa418896eb build_sysext: Use parallel jobs
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 10:18:17 +00:00
Kai Lueke
5aecc0a802 build_sysext: Remove any opaque directory markers
The Flatcar extension images built with build_sysext created directories
in the overlay in a way that masked contents from other layers.
Instead of fixing the way we create directories, make use of
postprocessing to avoid any similar problems show up again in the
future.
2024-03-05 17:01:43 +01:00
Thilo Fromm
691a57c77e
Merge pull request #1682 from flatcar/t-lo/build-sysext-fix-release-oem-build
build_sysext: enable build of OEM images for releases
2024-02-21 09:56:38 +01:00
Thilo Fromm
2807002222 build_sysext: enable build of OEM images for releases
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2024-02-20 16:52:03 +01:00
Krzesimir Nowak
e3f817aef5 build_sysext: Use strict mode
Using strict mode install a trap handler that prints backtraces in
case of errors. This will be useful to print some additional debugging
information.
2023-11-29 13:15:13 +01:00
Thilo Fromm
c522b04f2a build_sysext: let strip_binaries default to false
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-30 17:21:26 +01:00
Thilo Fromm
9f45ea05e9 app-containers: use upstream docker, containerd, runc
This change removes Flatcar specific builds of docker[-cli], containerd,
runc, and cri-tools and instead switches to upstream Gentoo ebuilds
added to portage-stable.

The change updates docker to 24.0.6.

NOTE that there currently is no upstream ebuild for containerd-1.7.7, so
this change adds that ebuild based on the upstream containerd-1.7.6
ebuild.

Flatcar customisations like systemd units etc. are now applied in the
manglefs script of the respective sysexts, based on file system trees in
coreos-overlay/coreos/sysext/(containerd|docker).

The build_sysext script has been extended by an option to strip all
binaries in a sysext; the option is active by default. This takes care
of removing debug symbols from docker and containerd - which are not
removed by the default Gentoo build. The overall size of both containerd
and docker sysext is reduced by ~50%.

Lastly, the sysext command line syntax of build_image has been extended
to allow specifying multiple packages for a sysext. This was necessary
because docker-cli and docker do not have any runtime relationships and
therefore must both be specified for installation to correctly mirror
Flatcar's own docker packaging.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-30 17:21:26 +01:00
Thilo Fromm
f81bbebddf build_sysext: run package inventorisation before mangle script
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:46 +02:00
Thilo Fromm
d744d32733 build_sysext: optimise squashfs for size
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:46 +02:00
Thilo Fromm
b775036a62 torcx removal: address PR comments
- updated github actions for runc, containerd, and docker to not handle
  nonexistent ebuilds in app-torcx/ anymore
- removed spurious package_run_dependencies from build_image_util.sh
- build_sysext: generate pkginfo before mangle script runs
  use zstd for compression; add cli flag to select compression
- ci_automation_common.sh: remove spurious `/` from match string
- coreos, board-packages, bootengine: bump ebuild revisions
- kernel commonconfig: add squashfs zstd support

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
89555ed2bd base OS sysexts: separate build script, inventory generation
This change refactors base OS sysext builds to use a separate build
script `build_library/sysext_prod_builder`, which is called from
`build_library/prod_image_util.sh` when `build_image` runs.

This allows for better separation of cleanup traps: prod image sysext
builds need its own trap / cleanup function for temporary build
directories and loopback mounts.

Prod sysext builds properly generate lincense and SBOM information, and
provide detailed file listings and disk space usage stats.

- SBOM / licenses JSON now include all packages of the
  final image, i.e. a combined list of base image and all base OS
  sysexts.
- Packages lists, files list and detailed files list include the sysext
  squashfs files for the base image, and separate sections with files /
  packages lists for each sysext.
- Disk usage contains both final disk image usage as well as usage of
  each individual sysext squashfs.
2023-10-23 16:05:45 +02:00
Thilo Fromm
9837c35ec4 build_sysext: add sysext dependency handling
This change adds 2 optional command line parameters to build_sysext to
handle dependencies in stacked sysexts. The command line parameters
allow exporting portage package db information into a separate squashfs
image as well as using package db information exported by a previous
sysext build.

--generate_pkginfo will generate a separate squashfs
   <sysextname>_pkginfo.raw which contains the sysext's /var/db/pkgs.

--base_pkginfo=<pkginfo>[:<pkginfo>[:...]] will use the supplied paths
   to pkginfo squashfses as additional lowerdirs when creating a sysext.

Useage example:
./build_sysext --generate_pkginfo containerd app-containers/containerd
./build_sysext --base_pkginfo=containerd_pkginfo.raw docker app-containers/docker

will create a containerd.raw sysext and a dependent docker.raw sysext
that does not have the containerd dependency installed. Both sysexts
must be merged together in order for docker to work.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
1f2706d44e build_sysext: guess image build dir and auto-create it
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-07-07 14:49:50 +02:00
Thilo Fromm
657a276cc2 build_sysext: fix hard-coded arch, add -noappend
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-07-07 13:26:37 +02:00
Thilo Fromm
190fd2c38e build_sysext: bugfixes, QoL changes, help updated
This change improves build_sysext by sourcing a missing lib dependency,
adding a number of comfort / quality-of-life options, and updating the
output of '--help' accordingly.

The OEM sysext finction in build_library/vm_image_util.sh is also
updated to use new command line format.

1. Include missing dependency toolchain_util.sh to fix an error in
   board_options.sh (get_board_arch undefined).
2. Use positional parameters for mandatory arguments.
   build_dir and sysext_name are mandatory and are now positional
   arguments instead of options.
   binary_package is the third positional argument but can be omitted
   if --metapkgs was specified.
3. --squashfs_base is now guessed better and will use the most recent
   build by default.
4. A new boolean flag --ignore_version_mismatch for the more daring
   developer was added. The flag will cause the script to continue if a
   version mismatch between SDK board packages and squashfs base is
   detected.
5. Error messages were improved for when mandatory parameters were not
   provided.
6. The '--help' message was improved and adjusted to the new parameters.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-07-07 11:44:39 +02:00
Krzesimir Nowak
e69801b982 build_sysext: Generate reports 2023-07-05 08:43:25 +02:00
krishjainx
6380a43b4f Add script to enable sysext builds in the OS image build process
Included a script to enable generating systemd-sysexts. Successfully
tested sysext generation with a fresh Flatcar image (e.g., Python and
Neofetch system extension). Part of my internship work.

The current OS images we provide are not OK as base for flatcar specific
sysext images: it lacks the package metadata and portage configuration,
in order to keep end user OS image clean. This script retains this
information and allows you to produce systemd-sysexts to extend the
system. This script can be used to build a Flatcar sysext image.
Recommended to run from image build folder.

Signed-off-by: Krish Jain <kjain7@u.rochester.edu>
2023-07-04 13:30:48 +02:00