Commit Graph

21 Commits

Author SHA1 Message Date
Daniel Zatovic
25b0c1583d run_sdk_container: mount tmpfs on /tmp 2025-04-30 14:55:32 +02:00
Krzesimir Nowak
c526b41729 run_sdk_container: Bail out on unknown flags
The script would pass unknown flags further as a container
command. This normally is not desired, but in case it actually is, the
user can use the newly added `--` parameter to stop parameter handling
and pass the following parameters as the container command.

I was tripped by using -u instead of -U and I got a rather confusing
error message suggesting something going wrong inside the container.
2025-01-09 15:07:14 +01:00
Krzesimir Nowak
81457884fc run_sdk_container: Allow mounting custom volumes into SDK container 2023-10-25 14:51:51 +02: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
Thilo Fromm
c2d1c13abd Apply bash scripting suggestions from code review
Thank you Krzesimir!

Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
428503083f run_sdk_container: Add -U flag to use the version file unchanged
This change adds a -U flag to run_sdk_container. If provided, the script
will not regenerate version.txt but instead use the existing file as-is.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
401af830d1 scripts, CI, workflows: remove submodule handling (main) 2023-04-13 12:26:36 +02:00
Kai Lueke
89495373d9 ci-automation: Ensure to use latest container image
The container image was only created if it didn't exist locally. This
would result in fixes not being in a downstream job that is scheduled
to a different worker node on Jenkins that has a stale copy.
For the build automation we will now always download the latest
container tar ball based on comparing the image ID from a new artifact,
and for registry images we pull the container image to make sure that
we don't use a stale copy when we rebuild.
2022-09-29 10:04:23 +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
Kai Lueke
d0ef3dace7 run_sdk_container: Use sdk_entry.sh from repo instead of inbuilt copy
The SDK container has a copy of sdk_entry.sh for standalone use. This
was also used by run_sdk_container which required creating new SDK
container images for changes to take effect.
Use the repository's version from run_sdk_container for fixes to take
effect without requiring new SDK containers.
2022-08-31 14:46:40 +02:00
Krzesimir Nowak
158a5c934a run_sdk_container: Do not mention nonexistent flag
Looks like it was either never implemented, or was implemented and
dropped before the script was added to the repo.
2022-08-24 13:48:35 +02:00
Kai Lueke
677343ca2e run_sdk_container: Workaround for write-protected /etc/hosts bind-mount
The baselayout package wants to manage the /etc/hosts file and thus
fails to emerge in the SDK container. One would have to build a new
SDK container instead.
To unblock the LTS 3033.3.1 release we can add a workaround to make the
SDK container environment more similar to how cork worked by removing
the /etc/hosts bind mount. This action has to be added to
run_sdk_container instead of sdk_lib/sdk_entry.sh because the existing
SDK's copy of sdk_lib/sdk_entry.sh won't have the change.
2022-06-01 14:21:07 +09:00
Jeremi Piotrowski
afbee30067 run_sdk_container: skip fetching image if custom_image is requested
In our CI most uses of run_sdk_container pass the '-C image' flag, which broke
with the last change, due to unbound docker_sdk_vernum variable. Skip fetching
the image when custom_image is passed.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-03-17 09:07:31 +01:00
Kai Lueke
cc9d43b01e run_sdk_container: add remove flag
At the moment one must remove the leftover containers manually.
Add a flag to do so when stopping the container.
2022-03-16 15:55:14 +01:00
Kai Lueke
a0574bcf37 run_sdk_container: recognize --help flag
When the user passes --help we should not start a container and throw a
late error message afterwards but show the help directly.
2022-03-16 15:36:32 +01:00
Kai Lueke
c149d24ced run_sdk_container: Fall back to tar ball download for SDK image
The nightly SDK image is not pushed to a registry but has to be
downloaded from the build server as tar ball.
Fall back to the tar ball import for a better user experience.
To reuse the ci logic it had to support the "docker" env variable.
The use of the pigz container is not always needed if the user has
pigz available.
2022-03-16 15:31:03 +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
Thilo Fromm
2c8d09192d run_sdk_container: use exact match for existing containers
run_sdk_container uses the sourcetree version to decide whether to
re-use existing containers or create new ones. However, containers were
not matched by exact name - instead, plain --filter name="..." was used,
leading to prefix matching. This change updates name="..." to use
regular expressions for exact matching.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-05 09:10:29 +01:00
Thilo Fromm
2324c5eeff sdk_container: fix submodules parent path in container
Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
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