Commit Graph

214 Commits

Author SHA1 Message Date
Daniel Zatovic
bfb5ec7d03 eclass/coreos-kernel,sys-kernel/coreos-modules:
Move module signing key to /tmp, so that it stays in RAM. Disable
shredding signing key after coreos-modules finishes, but rather shred it
after coreos-kernel finishes, so that out of tree modules (like ZFS from
upstream portage) can also use the key before it is shreded.
2025-04-30 14:55:32 +02:00
Krzesimir Nowak
39825d59c0 sdk_lib: Silence some docker warnings 2025-03-21 14:16:03 +01:00
Thilo Fromm
433f62c0e0
SDK container: include circular deps pkgs (#2340)
This change builds all packages required to break circular dependencies
and includes these in the SDK image. This way, emerge-<arch> can be used
right away and build_packages only builds packages with production USE
flags.

The change significantly reduces the build time at the cost of a larger
SDK image and longer SDK container build time. Uncompressed:
               Size before       Size after
all arches       7.75GB             9.29GB
arm64            5.7GB              6.58GB
amd64            5.64GB             6.45GB

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2024-09-23 12:20:43 +02:00
James Le Cuirot
a783cc2303
Fix up SDK repo configuration to use new coreos-overlay name on startup
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-07-15 14:28:04 +01:00
Thilo Fromm
7c732919db sdk_lib/sdk_init_selfcontained.sh: fix access rights
This change fixes access rights / file ownership changes in the
self-contained SDK init script.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-12-18 18:58:34 +01:00
Krzesimir Nowak
6b326744d8 sdk_lib,run_sdk_container: Modernize a bit
- Make cosmetic fixes in help output.

- There is usually no need for putting variables inside quotes in
  assignments.

- Use [[ ]] to avoid putting everything into strings.

- Use arrays instead of relying on strings to be split on whitespace
  as it was the case for invoking docker and getting GPG volume flags
  for docker.

- Make sure that some cleanup and trap strings quote variables
  properly.

- Add a "call_docker" function to avoid dealing with "docker" and a
  new "docker_a" variables when willing to invoke docker. The "docker"
  variable rather shouldn't be used, but it is still there in case
  some other scripts were using it.
2023-10-25 14:49:35 +02:00
Krzesimir Nowak
67fa551535 sdk_lib: Workaround docker issue with missing ownership preservation
Just do stuff as root for now.

The workaround can be removed when our builders pick up a stable
release with a fix.
2023-10-10 13:28:51 +02:00
Thilo Fromm
401af830d1 scripts, CI, workflows: remove submodule handling (main) 2023-04-13 12:26:36 +02:00
Krzesimir Nowak
82c7122a15 sdk_lib: Use curl for downloading SDK tarballs
This seems to be the only place where we are using wget for
downloading anything - all other places use curl. Thus switch to curl
here too. This also makes the job output much shorter as previously it
was spammed with progress reporting.
2023-03-17 09:35:35 +01:00
Krzesimir Nowak
e7f02d2fec common: Split binpkg and SDK tarball URLs
Use FLATCAR_DEV_BUILDS only for setting up binpkg URLs, ceding the SDK
tarball URL role to the new FLATCAR_SDK_SERVERS variable. That way we
can still set up binpkg URLs the way we used to do so far and set up
SDK tarball URLs differently.

For two-phase SDK build, we would like to use intermediate SDK as a
seed. This SDK is only available on bincache, but previously only
nightly builds could use bincache as the source of SDK tarballs. Now,
with the URL split, we can set up the builds to use both bincache and
the release server, where release builds will prioritize release
server over bincache, and developer builds - bincache over release
server.
2023-01-11 08:34:20 +01:00
Krzesimir Nowak
30bd70d1e6 SDK container: Sync the forwarded env vars
USE, FEATURES and PORTAGE_NAME were missing. The list is formatted so
to follow the list in 90_env_keep file.
2022-11-09 09:59:26 +01:00
Kai Lueke
df41bc4a75 sdk_lib: Also look at the mirror to download the SDK tar ball
The bootstrap downloads the previous SDK currently only from bincache
but bincache isn't backed up and may be cleaned of old releases.
The SDK tar ball is also available on the mirror and allows the
bootstrap to succeed without copying the seed SDK to bincache first.
2022-09-27 15:04:01 +02:00
Kai Lueke
18627499c1 Annotate a copied function
I found a duplicate function and verified that it's the only one via
comm -12 <(sort ci-automation/ci_automation_common.sh) <(sort sdk_lib/sdk_container_common.sh) | grep function
I'm not sure if this is due to a case where we only import one but
can't import the other, hence I'm not deleting it now.
2022-09-26 15:39:45 +02:00
Kai Lueke
91a26e5e1e Use new github org name "flatcar"
The "flatcar-linux" github org was renamed to "flatcar". There are no
github redirections in place and we have to update all links.
2022-09-14 14:33:27 +02:00
Kai Lueke
edba76c012 Use ghcr.io/flatcar, there are no redirects
The GitHub org rename also moved the ghcr.io container image repo but
in contrast to git repos, there are no redirects!
2022-09-14 14:33:24 +02:00
Kai Lueke
834e0c11d7 Support running under UID 500
When started by the Flatcar core user, the SDK failed to use UID 500
because inside the SDK there already is the core user from nss-altfiles
with the same ID. This way, the SDK user was continuing with UID 1000
and had permission errors.
Allow to reuse an existing ID for the SDK user. However, this only
works when usermod doesn't find a process that uses this ID, and we had
a race between the SDK entry points called by "docker start" and by
"docker exec". The race is unwanted anyway because we don't want to
execute the commands while setup_board is still running. Solve it by
setting the entrypoint for "docker start" directly to "bash -l" in
"docker create" (this is also what the entry point does as last step:
sudo su -l).
2022-08-31 15:16:21 +02:00
Krzesimir Nowak
89e82185d0 sdk: Forward SIGNER environment variable
Some of the signing may happen inside the SDK container, so make sure
to forward the SIGNER environment variable, as it will be used by the
signing function, when it's introduced.
2022-06-03 14:59:26 +02:00
Thilo Fromm
8f2d36025d update_sdk_container_image: work around sandbox permission errors
This change temporarily disables the Gentoo sandbox when updating the
SDK to work around sandbox permission errors some pakage builds (like
e.g. GO) run into.

Fixes e.g.
```
Building Go cmd/dist using /usr/lib/go-bootstrap. (go1.5.3 linux/amd64)
 * /var/tmp/portage/sys-apps/sandbox-2.12/work/sandbox-2.12/libsandbox/trace.c:do_peekstr():125: failure (Operation not permitted):
 * ISE:do_peekstr:process_vm_readv(6863, 0x00007ffe4a502180{0x00007f01abd3e010, 0x570}, 1, 0x00007ffe4a502190{0x000000c820012a90, 0x570}, 1, 0) failed: Operation not permitted
 * ERROR: dev-lang/go-1.17.8::coreos failed (compile phase):
```

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-05-06 11:20:03 +02:00
Kai Lueke
db7220eced ci-automation: set the channel from the git tag
For now we had only "developer" images in the new pipeline.
Based on the git tag like "alpha-1234.0.0" set the channel (group) for
the image and also use this logic when finding the channel in the QEMU
update test.
2022-03-04 13:49:18 +01:00
Thilo Fromm
38d85729bf update_sdk_container_image: update SDK container image
This change introduces update_sdk_container_image, a script to generate
a new SDK container image based on an existing SDK container. The
script is meant to be used for minor / patch level SDK changes (like
test suite updates).

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-02-21 20:06:30 +01: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
Thilo Fromm
ee43062399
Merge pull request #205 from flatcar-linux/t-lo/fix-sdk_entry-setup_board-fallout
fix sdk_entry.sh setup_board fallout
2022-01-07 13:26:38 +01:00
Thilo Fromm
43e8730ffe sdk_container: better docker / podman detection
In bce3bd9031, we added support for podman
for building and running the SDK container. The presence of podman is
auto-detected in sdk_container_common.sh. However, podman is preverred
over docker, requiring users to use *sudo* (which podman requires and
docker does not).

This change uses docker when present, podman otherwise. It also improves
podman detection - 'podman' uses argv[0] in its version string, so if
'docker' is a symlink to 'podman', 'podman --version' output uses
'docker'. This broke the SDK container on hosts which have a 'docker'
symlink to 'podman' since 'podman' is then run w/o 'sudo'.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-07 11:06:30 +01:00
Thilo Fromm
4273b51cd6 sdk_lib/sdk_entry.sh: only call setup_board if /build/... exists
Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-07 09:58:34 +01:00
Thilo Fromm
e6a4349355 sdk_lib/Dockerfile.sdk-import: use root user by default
sdk_entry.sh is expected to be called by the root user, so we set USER
root:root. Also we add a "root" entry to passwd and group since it does
not exist in the SDK tarball.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-06 20:17:19 +01:00
Kai Lueke
38729ac1dc sdk_lib/sdk_entry: handle permission error for target version file
The creation of the target version file failed:
/home/sdk/sdk_entry.sh: line 32: /build/amd64-usr/etc/target-version.txt: Permission denied
Use root permissions to create the file.
2022-01-06 18:52:40 +01:00
Kai Lueke
bce3bd9031 run/build_sdk_container: support Podman
When the docker wrapper script for Podman is used, we need to
explicitly create a root user container with "sudo podman".
Podman also has its own bridge for root user containers which we need
to detect, and it requires to explicitly say to use the Docker Hub
Caddy image.
Add a "$docker" variable that uses sudo podman as needed, and also
check which bridge interface to use. The filter had to be changed
because it didn't work with Podman. Use the Docker Hub Caddy image
explicitly.
2022-01-06 18:05:24 +01:00
Thilo Fromm
8fd5fc8a65 sdk_entry.sh: ensure currect binpkg host
This change ensures the binpkg host is updated if the board (OS) version
differs from the SDK version.

This is to ensure /build/[arch] uses the correct binary package cache.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-05 21:03:42 +01:00
flatcar-ci
459fcb89c6 sdk_lib/sdk_entry.sh: use a login shell to source /etc/profile
For execution of the compiled binaries in /build/arm64-usr we rely on
qemu-user binfmt emulation and have to tell it where the root is with
QEMU_LD_PREFIX because build systems don't chroot into /build/arm64-usr
themselves (which also works just by chance on amd64 because we have
similar glibc versions and so on). The env var setup was done in
/etc/profile.d/qemu-aarch64.sh but is now not read anymore since the
container runs the shell not as login shell.

Add the login options to the bash and su calls when starting the
container.
2022-01-05 18:06:37 +01:00
Thilo Fromm
1d1c6048d4 sdk-container: add @krnowak's suggestions from code review
Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2021-11-26 17:54:43 +01:00
flatcar-ci
7f874e491e sdk-container: address feedback from @krnowak review
Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
2021-11-26 17:54:43 +01:00
Thilo Fromm
b567344234 sdk-container: add scripts for containerised SDK
This change introduces a containerised SDK as a replacement for cork SDK
operations. It also simplifies versioning by removing the need for
manifest repos as well as usage of the "repo" tool by use of git
submodules for coreos-overlay and portage-stable.

The following feature scripts are added:
- run_sdk_container: Run a command in an SDK container, using the
        current scripts repo + ebuild submodules.
        current scripts repo + ebuild submodules.
- bootstrap_sdk_container / build_sdk_container_image: Bootstrap a new
        SDK and create an SDK container from the resulting SDK tarball.

The following additions have been made to SDK scripts:
- setup_board: add --pkgdir parameter to use a custom binary packge
  directory.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2021-11-26 17:54:43 +01:00
Kai Lüke
06c4894f71
SDK: Take environment variable to specify SDK location
The dev build SDKs are not in $FLATCAR_DEV_BUILDS/sdk but published under
$FLATCAR_DEV_BUILDS/developer/sdk.
Add an environment variable to specify where the SDK is to be found
but default to $FLATCAR_DEV_BUILDS/sdk if it is not specified.
From Jenkins this variable is exported as DOWNLOAD_ROOT_SDK.
2020-05-14 16:03:15 +02:00
Flatcar Buildbot
1dad511f69 2317.0.1 2019-11-07 19:40:01 +01:00
Andrew Jeddeloh
118b26d305 sdk_lib: drop obsolete enter/make_chroot 2018-06-08 10:58:29 -07:00
David Michael
45ef8cea91 enter_chroot: Drop special locale-gen handling
The glibc ebuild runs locale-gen itself while installing.
2018-04-04 12:53:20 -04:00
David Michael
7f99054c9d Merge pull request #687 from dm0-/workon-mantle
enter_chroot: initialize with mantle in cros_workon
2017-08-10 17:39:45 -07:00
Benjamin Gilbert
b5f19e5d75 enter_chroot: Fix ownership of /run/user/UID
We were chowning the host directory, not the one in the chroot.

Host gpg >= 2.1.13 puts the gpg-agent socket in /run/user/UID/gnupg,
which is bind-mounted into the chroot, but the SDK gpg was ignoring it
because /run/user/UID was not owned by UID. This broke tag signing with
YubiKeys.
2017-05-31 13:52:16 -07:00
David Michael
cbe102142b enter_chroot: initialize with mantle in cros_workon 2017-05-26 14:43:42 -07:00
Michael Marineau
8e754f9c2b enter_chroot: do not export variables that weren't previously exported
COREOS_BUILD_ID is set to a default value in common.sh if unset in the
environment. When entering the chroot this default value should not then
get promoted into the environment. Doing so causes catalyst to re-use
stale builds and multiple build_image runs to conflict with each other.
2016-05-25 17:04:38 -07:00
Michael Marineau
db5d937aab Merge pull request #491 from marineam/bind-root
enter_chroot: fix chroot root bind command
2015-12-15 16:44:28 -08:00
Michael Marineau
3fdd2033dc enter_chroot: fix chroot root bind command
Commit 09851b84 didn't do a recursive bind by mistake, so if the host
system has anything mounted under the chroot directory for some reason
the bind would hide those mounts. Recursive ensures existing mounts
remain exposed as they did before.
2015-12-15 16:40:00 -08:00
Michael Marineau
2b43e553e3 Merge pull request #490 from marineam/bind-root
enter_chroot: ensure the chroot's root directory is a mount point
2015-12-15 16:34:01 -08:00
Michael Marineau
09851b8460 enter_chroot: ensure the chroot's root directory is a mount point 2015-12-15 16:30:27 -08:00
Michael Marineau
863dda280f enter_chroot: skip calling locale-gen if it isn't installed 2015-12-10 11:33:57 -08:00
Michael Marineau
ec58813496 enter_chroot: always bind $GNUPGHOME to the default path
The path of $GNUPGHOME outside the chroot may not really make sense
inside the chroot. Although that's probably not a big deal there's no
need to keep the outside value. Instead just bind it to the usual spot.
2015-12-01 14:34:43 -08:00
Michael Marineau
14ada5cfe7 Merge pull request #483 from marineam/jenkins
Updates for jenkins builds
2015-12-01 12:03:13 -08:00
Alex Crawford
47d237ecab sdk_lib: cleanup to support non-standard environs 2015-11-30 18:15:42 -08:00
Michael Marineau
39a3a48a18 enter_chroot: add support for passing through GNUPGHOME
When running under jenkins the $GNUPGHOME may be located under the
current build directory instead of $HOME to avoid conflicting with other
jobs on the same build host.
2015-11-29 14:05:08 -08:00
Michael Marineau
aa4ba8b2bb bootstrap_sdk: do not remove make.conf, turns out catalyst runs sed over it 2015-07-06 13:14:51 -07:00