Commit Graph

29 Commits

Author SHA1 Message Date
stevenhorsman
ed8347c868 shellcheck: Fix shellcheck SC2070
> -n doesn't work with unquoted arguments. Quote or use [[ ]]

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-03-04 09:35:46 +00:00
Manuel Huber
4b2e725d03 rootfs: Install Rust only when necessary
For docker-based builds only install Rust when necessary.
Further, execute the detect Rust version check only when
intending to install Rust.
As of today, this is the case when we intend to build the
agent during rootfs build.

Signed-off-by: Manuel Huber <mahuber@microsoft.com>
2024-06-28 22:19:46 +00:00
Manuel Huber
62fd84dfd8 build: allow rootfs builds w/o git or VERSION file deps
We set the VERSION variable consistently across Makefiles to
'unknown'  if the file is empty or not present.
We also use git commands consistently for calculating the COMMIT,
COMMIT_NO variables, not erroring out when building outside of
a git repository.
In create_summary_file we also account for a missing/empty VERSION
file.
This makes e.g. the UVM build process in an environment where we
build outside of git with a minimal/reduced set of files smoother.

Signed-off-by: Manuel Huber <mahuber@microsoft.com>
2024-06-13 22:46:52 +00:00
Manabu Sugimoto
a75f99d20d osbuilder: Create guest image for SELinux
Create a guest image to support SELinux for containers inside the guest
if `SELINUX=yes` is specified. This works only if the guest rootfs is
CentOS and the init service is systemd, not the agent init. To enable
labeling the guest image on the host, selinuxfs must be mounted on the
host. The kata-agent will be labeled as `container_runtime_exec_t` type.

Fixes: #4812

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-11-29 13:32:26 +09:00
Manabu Sugimoto
92f7d6bf8f ci: Use versions.yaml for the libseccomp
It would be nice to use `versions.yaml` for the maintainability.
Previously, we have been specified the `libseccomp` and the `gperf` version
directly in this script without using the `versions.yaml` because the current
snap workflow is incomplete and fails.
This is because snap CI environment does not have kata-cotnainers repository
under ${GOPATH}. To avoid the failure, the `rootfs.sh` extracts the libseccomp
version and url in advance and pass them to the `install_libseccomp.sh` as
environment variables.

Fixes: #4941

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-08-19 09:05:08 +09:00
James O. D. Hunt
3edf25b6c9
Merge pull request #3682 from Jakob-Naucke/cross
Multistrap Ubuntu & enable cross-building guest
2022-03-21 11:11:47 +00:00
James O. D. Hunt
5d6d39be48 scripts: Change here document delimiters
Fix the outstanding scripts using non standard shell here document delimiters.

This should have been caught by
https://github.com/kata-containers/tests/pull/3937, but there is a bug
in the checker which is fixed on
https://github.com/kata-containers/tests/pull/4569.

Fixes: #3864.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-10 09:23:37 +00:00
Jakob Naucke
72f7e9e300
osbuilder: Multistrap Ubuntu
Use `multistrap` for building Ubuntu rootfs. Adds support for building
for foreign architectures using the `ARCH` environment variable.
In the process, the Ubuntu rootfs workflow is vastly simplified.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
2c86b956fa
osbuilder: Simplify Rust installation
no double export, direct target

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
0072cc2b66
osbuilder: Remove musl installations
Remove a lot of cruft of musl installations -- we needed those for the
Go agent, but Rustup just takes care of everything. aarch64 on
Debian-based & Alpine is an exception -- create a symlink
`aarch64-linux-musl-gcc` to `musl-tools`'s `musl-gcc` or `gcc` on
Alpine. This is unified -- arch-specific Dockerfiles are removed.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
573a37b33b
osbuilder: Add CentOS Stream rootfs
to cover a Red Hat (adjacent) rootfs with great cross-platform compatibility
and a workable release cadence. The previous CentOS & Fedora workflows are
simplified.

Also remove unnecessary `/usr/share` files as on Ubuntu and mark Alpine
as unuspported on ppc64le (due to musl, for a while already).

Fixes: #3340
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-14 15:06:07 +01:00
luodaowen.backend
2d9f89aec7 feature(nydusd): add nydusd support to introduse lazyload ability
Pulling image is the most time-consuming step in the container lifecycle. This PR
introduse nydus to kata container, it can lazily pull image when container start. So it
can speed up kata container create and start.

Fixes #2724

Signed-off-by: luodaowen.backend <luodaowen.backend@bytedance.com>
2022-02-11 21:41:17 +08:00
Sebastian Hasler
adffd3f8b6 scripts: Use shebang /usr/bin/env bash
Not all distros have `/bin/bash`, e.g. NixOS.

Fixes: #3450

Signed-off-by: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
2022-01-13 22:53:28 +01:00
Francesco Giudici
0f8c0dbc52 osbuilder/scripts: add support to yq version 4 and above
yq changed syntax in an incompatible way starting from version 4 and
above. Deal with that.

Fixes: #2297

Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2021-07-22 16:01:57 +02:00
bin
b12b21f337 osbuilder: Skip installing golang for building rootfs
Building rootfs does not depend on golang, delete intalling
golang may save build time.

And there is only rust agent now, the code for golang agent should
be deleted too.

Fixes: #2170

Signed-off-by: bin <bin@hyper.sh>
2021-07-15 23:59:15 +08:00
Jakob Naucke
a484d6db87
osbuilder: Streamline s390x CMake & musl handling
- Merge codepath in lib.sh with ppc64le -- do not install CMake
- Like ppc64le, do not install musl rather than just not using it

Fixes: #1975

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-06-07 17:39:31 +02:00
Chelsea Mafrica
8c1abc3b57
Merge pull request #1418 from Amulyam24/fix-docker-ppc64le
osbuiler: fixing USE_DOCKER for ppc64le
2021-03-19 17:22:12 -07:00
Jianyong Wu
f580d33cc9 musl/arm64: decompression before use the tarball.
In the last fix, the decompression ops is deleted by mistake and need
add it back.

Fixes: #1490
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2021-03-04 10:12:29 +08:00
Jianyong Wu
2da058ed7b osbuild: build musl toolchain from source if needed
Currently, musl toolchain installation on arm64 is just downloading from
a website. It's unsafe in case the website corrupts. So build musl
toolchain from source if it can't be downloaded.

Fixes: #1481
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2021-03-03 17:22:39 +08:00
Amulya Meka
5096103e7e osbuiler: fixing USE_DOCKER for ppc64le
For building rootfs with docker, glibc based rust target should be installed on ppc64le.
Additionally, protobuf-compiler would be required on ppc64le as it is not present by default.

Fixes: #1417

Signed-off-by: Amulya Meka <amulmek1@in.ibm.com>
2021-02-18 05:33:51 +00:00
Jakob-Naucke
11fe6a3552
osbuilder: Fix USE_DOCKER on s390x
- Install the required protobuf-compiler on Ubuntu
- Install correct libc Rust target (glibc on s390x)
- Do not skip Rust installation on s390x

Fixes: #1266

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-02-09 12:37:24 +01:00
David Gibson
3718df69c2 osbuilder: Remove leftover pieces related to cmake
The osbuilder scripts include a bunch of code for installing cmake, even
though cmake is never invoked.  versions.yaml claims it's needed to build
grpc-rs, but that doesn't appear to be in our dependency graph.

Presumably, we used to need this, but don't any more.  So, remove all cmake
references.

Fixes #1309

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-23 15:24:25 +11:00
Julio Montes
faed2369a0 rootfs-builder: add functions to run before and after the container
Define `before_starting_container` and `after_stopping_container`
functions, these functions run before and after the container that
builds the rootfs respectively.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-12-08 10:14:00 -06:00
zhanghj
ca501e5478 osbuilder: specify default toolchain verion in rust-init.
Specify default toolchain version in rust-init.

Fixes: #799

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2020-09-24 23:20:43 -04:00
Peng Tao
76c18aa345 osbuilder: fix alpine agent build
Since we always build musl kata-agent, there is no need to build
it inside a musl container. We can just build on the host and then
copy the binary to the target rootfs.

There are still a lot to clean up and it should be made so for ALL
target distros instead of just alpine. But this is at least working
for alpine first.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-31 22:09:37 +08:00
Gabriela Cervantes
f879acd6e7 scripts: Foward port osbuilder scripts to update yq
This PR ports kata-containers/osbuilder#454 to kata 2.0

Fixes #576

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2020-08-27 15:00:03 -05:00
Peng Tao
ebfbca031b osbuilder: use newest golang
Instead of the oldest one.

Fixes: #345
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:42:30 -07:00
Salvador Fuentes
81e11c9f7c osbuilder: remove references to agent and runtime repos
tools/osbuilder/scripts/lib.sh was making references to agent and
runtime repositories to get golang, rust, cmake and musl versions.
Since runtime and agent repos are consolidating, we only need to
make reference to our versions.yaml in this (kata-containers) repo.

Fixes: #234.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2020-05-28 10:33:25 -05:00
Salvador Fuentes
715d342519 osbuilder: move code into tools directory
move all osbuilder files into `tools` directory to be able
to merge this into kata-containers repo.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2020-04-29 16:45:00 -05:00