Commit Graph

986 Commits

Author SHA1 Message Date
Kai Lueke
80e49d190f Use new website flatcar.org
The flatcar-linux.org domain has redirects but it's better to use the
current domain directly.
2022-09-14 14:32:49 +02:00
Kai Lueke
e171ecd69d Fix broken docs link 2022-09-14 14:32:49 +02:00
Krzesimir Nowak
3f242c05eb build_library/toolchain_util: Drop workaround for building stable gdb
This is fixed in crossdev now.
2022-08-22 15:19:54 +02:00
Jeremi Piotrowski
dc21dda002
Merge pull request #378 from flatcar-linux/slsa-provenance-by-default
Generate SLSA provenance by default
2022-08-15 13:39:13 +02:00
Jeremi Piotrowski
6f1d7976f4
Merge pull request #385 from flatcar-linux/jepio/spdx-sbom
add SPDX SBOM generation using syft
2022-07-27 13:55:00 +02:00
Jeremi Piotrowski
3f39f48389 build_library: install initramfs/torcx SLSA reports into rootfs
Some packages are currently missing from the /usr/share/SLSA directory
compared to flatcar_production_image_packages.txt. For torcx packages,
extract the reports from the torcx bundle when adding it to the rootfs.
For initramfs packages, as a substitute we enumerate build dependencies
of coreos-kernel (image_packages_implicit()). At this time these are
bootengine and intel-microcode.
2022-07-27 13:00:20 +02:00
Jeremi Piotrowski
e20cf95bcb prod_image_util: unpack SLSA report along with gcc when building image
Prod images need libstdc++.so and other libraries produced by
sys-devel/gcc build, but because we don't want all of gcc in the image,
the binpkg is manually unpacked instead of installed with emerge. Make
sure to preserve SLSA metadata when unpacking as well.
2022-07-27 13:00:19 +02:00
Jeremi Piotrowski
7c87bb611f enable GENERATE_SLSA_PROVENANCE for board ROOT
This needs to be done in setup_board for ROOT=/build/$BOARD, but also in
toolchain_util because basic toolchains packages are built through
catalyst.
2022-07-27 12:59:49 +02:00
Jeremi Piotrowski
a66bded4ce install_cross_libs: fix toolchain dependency installation
`./setup_board --nousepkg --nogetbinpkg` currently fails with a
circular dependency due to pulling in the whole systemd-cryptsetup-udev
dependency chain. This is due to several issue:

* `emerge --root=$ROOT --emptytree` considers ROOT=/ to also be empty,
  so it pulls in all host packages. This must've not always been the case.
  So we need to pipe the dependency package list through `egrep $ROOT`
  to filter only those that would get installed into the desired ROOT
* if SYSROOT=/ and not SYSROOT=ROOT, then virtual/os-headers is missing
  from $ROOT package list
* the final filter expression tries to previously looked like this:
  (=sys-devel/gcc|sys-devel/binutils-0.9) which also matches
  sys-devel/gcc-config and sys-devel/binutils-config, which are
  necessary dependencies. Rework the match expression to not filter
  those out.
2022-07-27 12:59:49 +02:00
Jeremi Piotrowski
6735a6d5c0
prod_image_util: extract gcc libs to /usr/lib64
This made no difference back when lib was a symlink to lib64, but now that they are separate,
libs belongs in /usr/lib64. This  mostly doesn't show up because ldconfig configures the ld.so cache
to include both locations, but when updating from an older release ld.so.cache is out of date.
Unfortunately ld.so.cache does not get updated until after multipathd, which causes
multipathd to dump core. This may also affect other packages that need access to
libgcc early.

See also: https://github.com/flatcar-linux/Flatcar/issues/809
2022-07-25 17:33:08 +02:00
Jeremi Piotrowski
d3edc97063 build_image: use syft to generate SBOM for prod image
Since v0.51.0 syft supports generating parsing the gentoo package
database. This is a first go at integrating that into our image build
process. This doesn't yet include packages inside torcx packages, or the
kernel, or initramfs-only packages.
2022-07-15 11:52:33 +00:00
Krzesimir Nowak
e65072910d build_library: Try to clean up unused stuff
There is some cruft left after grub hashes generation. After the
contents are zipped into archive, they don't need to be around any
more.

Try to remove the rootfs directory after unmounting the
image. disk_util can recreate it again if there is a need for it.

Remove the build directory used for generating ACI images - it's not
needed after successful installation.
2022-07-14 15:08:12 +02:00
Kai Lueke
ef9b0ff820 ci-automation: Only store compressed images
The new build pipeline compresses images already but uploaded both the
compressed and uncompressed files because the whole build folder gets
uploaded.
Add a new flag "--only_store_compressed" to the image generation which
deletes the uncompressed file after compression is done. Uncompressed
images are still supported if specified in the flag
"image_compression_formats".

Closes https://github.com/flatcar-linux/Flatcar/issues/793
2022-07-05 16:13:22 +02:00
Martin Borgman
1a42fd4a5f Make qemu_template.sh work on MacOS
Make qemu_template.sh work on MacOS

Line 14; The nproc command is only available on systems with GNU coreutils installed. The getconf _NPROCESSORS_ONLN alternative will work on a wider range of UNIX systems.
Line 114; The mktemp syntax used only works on GNU implementation.
Line 159; added hvf (MacOS) and tcg (no acceleration) options as a fallback. By doing this qemu-system-x86_64 will try to use kvm, but when it fails try hvf, and when that fails switch to the tcg accelerator.
2022-06-22 15:18:09 +02:00
Jeremi Piotrowski
2937db11e5
Merge pull request #286 from flatcar-linux/jepio/run-binutils-config
build_library/toolchain_util: set binutils to the latest version
2022-05-10 09:54:58 +02:00
Kai Lueke
6648df57a2 Remove unused image variants
There is no difference anymore between the regular and Pro images.
Remove the definitions and stop building extra images.
2022-05-03 20:30:42 +09:00
jenkins
4c71bf789c build_library/toolchain_util: set binutils to the latest version
This was already being done for gcc but not for binutils. Binutils is
also slotted and when we run the sdk (stage3/stage4) job in the CI, the
seed sdk already contains crossdev packages that we may want to update.
2022-04-21 07:48:18 +00:00
Kai Lueke
e2759a3e67 build_library/set_lsb_release: create compatibility symlink
The os-release file was not only accessible through /usr/lib/ but
also through /usr/lib64 because "lib" was just a symlink.
Now that we split them up into two directories, add a compatibility
symlink in case /usr/lib64 was used to access os-release. A check
is added to also work without the split which is useful if the split
is not done for the SDK at the same time.
2022-03-17 11:58:12 +01:00
Kai Lueke
ee46cf104b build_library/check_root: use the new location for kernel modules
The standard location is /usr/lib/modules but on Flatcar "lib" was a
symlink to "lib64". Now this is going to be split up in separate
directories but with compatibility symlinks.
Add the new location to the ignore list.
2022-03-17 11:56:26 +01:00
Kai Lueke
7fafef2084 set_lsb_release: define Flatcar sysext level
Sysext images have a compatibility matching mechanism that searches for
the matching OS version or custom sysext level setting. On Flatcar
there is just the OS version set in /etc/os-release until now which
means that sysext images can't easily be used together with autoupdates
that change the OS version.

Define a sysext level for Flatcar so that users can refer to it instead
of the OS version when they have images that don't rely on a particular
Flatcar version.
Here an example of the now possible metadata:
/etc/extensions/NAME/usr/lib64/extension-release.d/extension-release.NAME
  ID=flatcar
  SYSEXT_LEVEL=1.0
and a symlink /etc/extensions/NAME/usr/lib → /etc/extensions/NAME/usr/lib64
to work around the problem that using lib/ as path destroys Flatcar's
lib → lib64 symlink.
In the future the matching logic hopefully gets more flexible because
now it is just a string comparison. Also, the architecture is not
matched either for now - we should work with upstream to improve this.

Closes: https://github.com/flatcar-linux/Flatcar/issues/643
2022-03-10 18:15:04 +01:00
Gabriel Adrian Samfira
e88f12c69c Rename zstd to zst
Rename sztd to zst and amend the changelog. The zstd binary generates a
compressed file with the .zst extension by default.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-08 14:02:37 +00:00
Gabriel Adrian Samfira
71e4f1c660 Remove commented code 2022-03-08 08:07:47 +00:00
Gabriel Adrian Samfira
f126debb37 Allow specifying multiple compression formats
Add the ability to specify a comma separated list of compression formats.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-07 12:01:21 +00:00
Gabriel Adrian Samfira
571de4064b Make image compression format configurable
This change adds a new flag called --image_compression_format which
allows us to output the final VM image as one of the supported formats:

bz2 (default), gz, zip or none

if the compression format is "none" or "", the image will not be compressed.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-07 12:01:21 +00:00
Sayan Chowdhury
ee7e48cb14
Merge pull request #241 from flatcar-linux/sayan/merge-pro-in-regular
build_library/vm_image_util.sh: Pro image to use non-pro package & use flag
2022-03-02 20:44:03 +05:30
Jeremi Piotrowski
f8efad73bf
Merge pull request #231 from flatcar-linux/jepio/build-image-disable-ebuild-locks
build_library/build_image_util: disable ebuild-locks when merging binary packages.
2022-02-22 13:52:46 +01:00
Jeremi Piotrowski
4cdacf5ae4 build_library/build_image_util: disable ebuild-locks when merging binary packages
Disable ebuild-locks for the emerge command that creates the image.
Ebuild-locks protect unsandboxed ebuild phases from running
concurrently, but also slow things down greatly when a lot of
concurrency would otherwise be possible. The image build phase merges a
big amount of binary packages, and I am not aware of us having any
phases that risk concurrently modifying shared files.

I have been testing this for the last months and have not seen any
failures. The time savings are significant: this cuts image build time
from 20m to 10m for me.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-02-22 09:42:42 +00:00
Kai Lüke
ce43f1e001
Merge pull request #227 from flatcar-linux/kai/use-package-users
build_library: move package sysusers to /usr database
2022-02-18 18:16:12 +01:00
Kai Lueke
cc509e77d3 build_library: move package sysusers to /usr database
Package users nowadays get created through systemd-sysuser files.
Gentoo uses the acct-user|groups packages to allocate stable IDs for
these users. Since they get created at runtime, we have the problem
that they end up in /etc/passwd at boot time which would be fine if
they follow the acct-user allocations but it could also be that there
is a package that uses its own sysuser files, leading to dynamic ID
allocation which we can't control and may result in ugly user ID
mismatches that are hard to resolve again. Normally we intend to ship
all system users under /usr/share/baselayout/passwd so that /etc/passwd
is really left to the user's own entries.
Generate the /etc/passwd sysuser entries at image build time and move
these entries over to /usr/share/baselayout/passwd so that all
system users reside in this database. We should still ensure to have
acct-user packages for all system users or at least hardcoded user
IDs, therefore, add a check for that.
2022-02-18 16:57:42 +01:00
Sayan Chowdhury
560122f49d
build_library/vm_image_util.sh: Pro image to use non-pro package & use flag 2022-02-17 19:42:05 +05:30
Dongsu Park
580a5c6852 build_library: update GLSA allowlist
201908-24: polkit 0.120-r2, so not affected
201909-01: perl 5.34.0, so not affected
202003-26: python 3.9.8, so not affected
202005-09: python 3.9.8, so not affected
202006-03: perl 5.34.0, so not affected
202008-01: python 3.9.8, so not affected
202101-18: python 3.9.8, so not affected
202104-04: python 3.9.8, so not affected
202105-34: bash 5.1_p8, so not affected
202107-31: polkit 0.120-r2, so not affected
202107-48: systemd 250.3, so not affected
2022-02-17 10:44:28 +01:00
Dongsu Park
a900d579c4 *: blacklist/whitelist to denylist/allowlist
Replace blacklist with denylist, and whitelist with allowlist.
Use proper vocabulary in all over the code.
2022-02-17 10:44:25 +01:00
Jeremi Piotrowski
07568fb418 build_library: vm_image_util: create fixed-size VHDs for Azure
Azure requires disks to be fixed-size VHD files when uploading to blob storage
in order to create image/gallery objects from them. This is documented here[1].
To prevent mistakes from happening create disks in that format directly so that
any azure compatible tool can upload them, though azcopy is recommend because
it handles their sparseness best.

This has not been an issue for us so far because kola uses code from an older
utility that transparently handled the dynamic-to-fixed-size conversion for VHD
files (azure-vhd-utils). But people working with these things for the first
time fall into this trap.

[1]: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic#resizing-vhds.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-02-01 17:52:09 +00:00
Jeremi Piotrowski
3af02e323c build_library/torcx_manifest.sh: list all component pkgs in sources_on_disk()
source_on_disk() so far relied on the 'sourcePackage' field, which contains the
primary dependency of a torcx packge (app-torcx/docker ->
app-emulation/docker). Now the 'metaPackage' field (app-torcx/docker) is used,
which lets us look at RDEPENDS and figure out all packages that are indirectly
installed when installing a torcx package. torcx_dependencies() does just that,
so move it's definition to torcx_manifest.sh.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-14 16:00:51 +00:00
Jeremi Piotrowski
499fade8d3 build_torcx_store: store additional 'metaPackage' field in torcx manifest
The torcx_manifest.json file currently has a 'sourcePackage' field which is
extracted from the first runtime dependency of the torcx package ebuild. This
is a convention, and causes sourcePackage to hold 'app-emulation/docker' for
the 'app-torcx/docker' package. This does not carry enough information to be
able to figure out what other packages are part of the torcx package.

Store an additional field, 'metaPackage', in the manifest which contains the
name of the torcx package. With the right ebuild it is then possible to figure
out what other packages are part of a given torcx package. This can then be
used to add that information to the image packages list.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-14 15:46:08 +00:00
Thilo Fromm
719689992c SDK container: enable binpkg cache for nightly builds
Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-12 15:44:30 +01:00
Kai Lüke
f9b51461ab
Merge pull request #212 from flatcar-linux/kai/set-group-only-in-usr
set_lsb_release: only set update-engine GROUP in /usr, not /etc
2022-01-11 15:01:34 +01:00
Kai Lueke
0c9804a9a4 set_lsb_release: only set update-engine GROUP in /usr, not /etc
The default image group is already encoded in
/usr/share/flatcar/update.conf but it was written to
/etc/flatcar/update.conf as well. This can cause problems when the user
switches channels by forcing an update to a specific release from the
different channel (e.g., through the flatcar-update tool) as it leaves
the file under /etc/flatcar/update.conf out of sync with the new
channel version in /usr/share/flatcar/update.conf.

Since we don't really need to write a specific channel to /etc on new
images as we can rely on the value from /usr, we now leave any possible
overwriting of the value in /etc entirely to the user.
2022-01-11 15:00:43 +01:00
Jeremi Piotrowski
7caafa6cd6 build_library/check_root: ignore dangling '*egg-info' symlink
Since the update of dev-python/certifi, running the command
`./image_to_vm.sh --format gce --board=amd64-usr` fails due to a
dangling symlink. This symlink is located in
/usr/lib64/python3.9/site-packages and is not supposed to be installed
in the first place because of this INSTALL_MASK entry in
coreos-overlay/profiles/coreos/targets/generic/oem-aci/make.defaults:

  INSTALL_MASK="${INSTALL_MASK}
    /usr/*/python3*
  "

There is an open upstream bug that INSTALL_MASK doesn't work correctly on
symlinks (https://bugs.gentoo.org/678462).
The best we can do at this time is to ignore the dangling symlink.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-11 10:02:53 +00:00
Thilo Fromm
a6ddcda88e ci-automation: Apply suggestions from PR review
Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2022-01-10 11:41:03 +01:00
flatcar-ci
7d76cfedf7 ci-automation + setup_board: publish and use binpkgs
This change adds a job for publishing binary packages to the build cache
server to the ci automation.

Also, setup_board is updated to use the buildcache package cache if a
nightly build version is detected.

Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
2022-01-07 17:16:44 +01:00
Krzesimir Nowak
96b37b89f8 *: Replace kinvolk github org with flatcar-linux
Stop relying on github redirects, they are a mixed blessing and using
them broke emerge-gitclone inside dev-container in silent way. The
script could not find a desired revision of portage-stable or
coreos-overlay, because it tried to pull from kinvolk instead of
flatcar-linux github org. The redirects seem to hinder fetching a
specific commit, so the script pulled something else (HEAD or main?).
2021-12-21 17:22:48 +01:00
Krzesimir Nowak
89b5505fe6 build_library/catalyst_sdk.sh: Try different way of picking python as default intepreter
Let's see if `eselect python update` would work. It's certainly nicer,
because there would be one place less to change on the next python
update.
2021-12-10 20:06:40 +01:00
Krzesimir Nowak
790fd0fd2c build_library/catalyst_sdk.sh: Select python 3.9 as a default interpreter
At this point nothing pulls python2 anymore, so it became an invalid
target.
2021-12-10 20:06:40 +01:00
Krzesimir Nowak
186f1de4fa update_chroot: Add a way to remove hard blockers
And set it to remove some old version of dev-python/setuptools_scm
package.
2021-12-10 20:06:40 +01:00
Mathieu Tortuyaux
dc0f93015b
build_library/set_release: add CPE_NAME - v2.3
Flatcar is in the NIST CPE dictionary. Let's programmatically build the
`CPE_NAME` in the build process in order to be scanned.

`CPE_NAME` is part of `/etc/os-release` with the following manual entry:

```
CPE_NAME=
  A CPE name for the operating system, in URI binding syntax, following the Common Platform Enumeration Specification[2] as proposed by the NIST.
  This field is optional. Example: "CPE_NAME="cpe:/o:fedoraproject:fedora:17""
...
[^2]: Common Platform Enumeration Specification
           http://scap.nist.gov/specifications/cpe/
```

Which indicates that the current version of CPE is 2.3.

Closes: https://github.com/flatcar-linux/Flatcar/issues/536

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2021-11-23 18:22:16 +01:00
Thilo Fromm
7f80cb138b
Merge pull request #159 from flatcar-linux/t-lo/use-new-bincache-mirror
setup_board, update_chroot, dev container: use new bincache mirror
2021-10-07 11:57:30 +02:00
Thilo Fromm
cc469d2f47
build_library/release_util.sh: improve ssh opts for rsync
Co-authored-by: Kai Lüke <pothos@users.noreply.github.com>
2021-10-07 11:17:33 +02:00
Thilo Fromm
0aad4b9dd1
release_util.sh: script improvements
Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2021-10-07 10:48:26 +02:00
Thilo Fromm
9c3ba12936 release_util.sh: add rsync:// upload 2021-10-07 09:27:49 +02:00