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.
- 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.
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>
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.
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).
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.
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.
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>
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.
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.
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>
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>
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>