Commit graph

22 commits

Author SHA1 Message Date
Debarshi Ray
ccaa27e034 playbooks: Rename the file with the dependencies
This will be used by the subsequent commit to have a separate set of
dependencies for CentOS Stream 9 builds.  eg., unlike Fedora, CentOS
Stream 9 doesn't have the ShellCheck, bats and fish RPMs.

https://github.com/containers/toolbox/pull/1171
2022-12-14 23:09:55 +01:00
Debarshi Ray
ca966e377c .zuul, playbooks: Add copyright and license notices
https://github.com/containers/toolbox/pull/1179
2022-11-28 22:47:15 +01:00
Debarshi Ray
03922893af playbooks: Highlight failures from 'meson compile' and 'meson install'
Currently, 'meson compile' and 'meson install' were being invoked from
pre-run playbooks.  This meant that a genuine build failure from either
of those commands would be shown as a RETRY_LIMIT failure by the CI.

This was misleading.  It made it look as if the failure was caused by
some transient networking problem or that the CI node was too slow due
to momentary heavy load, whereas the failure was actually due to a
problem in the Toolbx sources.  A genuine problem in the sources should
be reflected as a FAILURE, not RETRY_LIMIT.

However, it's worth noting that 'meson compile' invokes 'go build',
which downloads all the Go modules required by the Toolbx sources.  This
is worth retaining in the pre-run playbooks since it primarily depends
on Internet infrastructure beyond the Toolbx sources.

As a nice side-effect, the CI no longer gets mysteriously stuck like
this while the Go modules are being downloaded:
  TASK [Build Toolbox]
  ci-node-36 | ninja: Entering directory
    `/home/zuul-worker/src/github.com/containers/toolbox/builddir'
  ...
  ci-node-36 | [8/13] Generating doc/toolbox-rmi.1 with a custom command
  ci-node-36 | [9/13] Generating doc/toolbox-run.1 with a custom command
  ci-node-36 | [10/13] Generating doc/toolbox.conf.5 with a custom
    command
  ci-node-36 | [11/13] Generating src/toolbox with a custom command

https://github.com/containers/toolbox/pull/1158
2022-11-16 11:11:01 +01:00
Debarshi Ray
df22010e4f playbooks: Use the same commands as mentioned in the documentation
... at https://containertoolbx.org/install/

There are some minor benefits to always invoking meson(1), as opposed to
directly invoking the underlying build backend, like 'ninja'.

It's one less command to be aware of.  Secondly, in theory, Meson can be
used with backends other than Ninja (see 'meson configure'), even though
Ninja is the most likely option for building Toolbx because it's only
supported on Linux.

https://github.com/containers/toolbox/pull/1142
2022-10-21 20:23:34 +02:00
Debarshi Ray
b864280e42 playbooks: Make all Meson warnings fatal
This should help detect the kind of problem that was fixed in the
previous commit.

https://github.com/containers/toolbox/pull/1096
2022-08-31 19:35:05 +02:00
Debarshi Ray
f3a15c60fe playbooks: Split out the post-configuration steps into a separate file
A subsequent commit will introduce builds performed with the
-Dmigration_path_for_coreos_toolbox option to the CI.  It will be good
to avoid duplicating the build and installation steps for builds with
and without the -Dmigration_path_for_coreos_toolbox option.

https://github.com/containers/toolbox/pull/1095
2022-08-31 13:19:33 +02:00
Debarshi Ray
e965dac9f6 playbooks: Split out the dependencies into a separate file
A subsequent commit will introduce builds performed with the
-Dmigration_path_for_coreos_toolbox option to the CI.  It will be good
to avoid duplicating the installation of RPM packages, Git submodule
handling, and the listing of various debug and version information for
builds with and without -Dmigration_path_for_coreos_toolbox option.

https://github.com/containers/toolbox/pull/1095
2022-08-31 12:46:44 +02:00
Ondřej Míchal
ecd1ced719 cmd/create: Add option --authfile
The option accepts a path to a file that is passed to an internal call
to 'podman pull' via the '--authfile' option. This will make it easier
to pull images from registries with authentication in-place.

Fixes https://github.com/containers/toolbox/issues/689

https://github.com/containers/toolbox/pull/935
2022-03-20 18:08:42 +02:00
Debarshi Ray
be2ba6d2e2 build: Call 'systemd-tmpfiles --create' when installing
It's only necessary to call 'systemd-tmpfiles --create' when building
and installing from source on the host operating system.

It's not needed when using a pre-built binary downstream package,
because:

  * When 'meson install' is called as part of building the package,
    that's not when the temporary files need to be created. They need
    to be created when the binary package is later downloaded and
    installed by the user.

  * Downstream tools can sometimes handle it automatically. eg., on
    Fedora, the systemd RPM installs a trigger that tells RPM to call
    'systemd-tmpfiles --create' automatically when a tmpfiles.d snippet
    is installed.

It's also not needed when installing inside a toolbox container because
the files that 'systemd-tmpfiles --create' is supposed to create are
meant to be on the host.

Downstream distributors set the DESTDIR environment variable when
building their packages. Therefore, it's used to detect when a
downstream package is being built.

Unfortunately, environment variables are messy and, generally, Meson
doesn't support accessing them inside its scripts [1]. Therefore, this
adds a spurious build-time dependency on systemd for downstream
distributors. However, that's probably not a big problem because all
supported downstream operating systems are already expected to use
systemd for the tmpfiles.d(5) snippets to work.

[1] https://github.com/mesonbuild/meson/issues/9

https://github.com/containers/toolbox/issues/955
2022-01-10 22:14:01 +01:00
Debarshi Ray
8dd7ee47c5 build: Drop the use of patchelf(1)
Some downstream distributors like RHEL don't have patchelf(1). Relying
on patchelf(1) during the build will make it difficult for such
downstreams to distribute Toolbox.

Fortunately, the path of the dynamic linker (ie., PT_INTERP) is
hardcoded in the ABI specification of each architecture [1]. This means
that Toolbox's build system can keep it's own architecture to dynamic
linker mapping, and specify it during the build through the GNU ld
linker's --dynamic-linker flag, as opposed to using a tool like
patchelf(1) to change the path of the dynamic linker in the built
binary to the one inside /run/host. Currently, the list of
architectures covers the ones that Fedora builds for.

[1] https://sourceware.org/glibc/wiki/ABIList

https://github.com/containers/toolbox/pull/942
2021-12-09 13:16:27 +01:00
Debarshi Ray
606b37b226 playbooks/setup-env: Restore running ShellCheck in the CI
Fallout from c33075f3e1
2021-10-25 16:12:14 +03:00
Ondřej Míchal
69ffc888ca playbooks: Fix CI for #897
PR #897 made adjustmnets to the Toolbx binary that it requires presence
of /run/host in both the host filesystem and the filesystem in
a container.

The presence of the directory is assured by systemd-tmpfiles by
running it before the binary is started for the first time. For the run
to be effective 'data/tmpfiles.d/toolbox.conf' has to be installed in
a location visible to systemd-tmpfiles. Therefore, the call to
'systemd-tmpfiles --create' had to be placed after the install step.

https://github.com/containers/toolbox/pull/898
2021-10-22 16:43:38 +03:00
Ondřej Míchal
c33075f3e1 playbooks: Unify test setup for system & unit tests
There is no significant benefit in keeping this configuration separated.
Now the to-be installed packages are tracked in a single place and the
test playbooks only call the relevant tests.

This was pointed out by in 6063eb27b9

https://github.com/containers/toolbox/pull/898
2021-10-22 16:43:38 +03:00
Debarshi Ray
6063eb27b9 build: Ensure that binaries are run against their build-time ABI
The /usr/bin/toolbox binary is not only used to interact with toolbox
containers and images from the host. It's also used as the entry point
of the containers by bind mounting the binary from the host into the
container. This means that the /usr/bin/toolbox binary on the host must
also work inside the container, even if they have different operating
systems.

In the past, this worked perfectly well with the POSIX shell
implementation because it got intepreted by whichever /bin/sh was
available. However, the Go implementation, can run into ABI
compatibility issues because binaries built on newer toolchains aren't
meant to be run against older runtimes.

The previous approach [1] of restricting the versions of the glibc
symbols that are linked against isn't actually supported by glibc, and
breaks if the early process start-up code changes. This is seen in
glibc-2.34, which is used by Fedora 35 onwards, where a new version of
the __libc_start_main symbol [2] was added as part of some security
hardening:
  $ objdump -T ./usr/bin/toolbox | grep GLIBC_2.34
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    __libc_start_main
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_detach
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_create
  0000000000000000      DF *UND*	0000000000000000  GLIBC_2.34
    pthread_attr_getstacksize

This means that /usr/bin/toolbox binaries built against glibc-2.34 on
newer Fedoras fail to run against older glibcs in older Fedoras.

Another option is to make the host's runtime available inside the
toolbox container and ensure that the binary always runs against it.

Luckily, almost all supported containers have the host's /usr available
at /run/host/usr. This is exploited by embedding RPATHs or RUNPATHs to
/run/host/usr/lib and /run/host/usr/lib64 in the binary, and changing
the path of the dynamic linker (ie., PT_INTERP) to the one inside
/run/host.

Unfortunately, there can only be one PT_INTERP entry inside the
binary, so there must be a /run/host on the host too. Therefore, a
/run/host symbolic link is created on the host that points to the
host's /.

Based on ideas from Alexander Larsson and Ray Strode.

[1] Commit 6ad9c63180
    https://github.com/containers/toolbox/pull/534

[2] glibc commit 035c012e32c11e84
    https://sourceware.org/git/?p=glibc.git;a=commit;h=035c012e32c11e84
    https://sourceware.org/bugzilla/show_bug.cgi?id=23323

https://github.com/containers/toolbox/issues/821
2021-10-22 01:20:03 +02:00
Ondřej Míchal
0ff01977d6 playbooks: Stop cloning bats libraries
The libraries are now provided as submodules. There's no need to clone
them separately.

https://github.com/containers/toolbox/pull/842
2021-07-22 10:23:53 +02:00
Ondřej Míchal
2e5b6aed3f playbooks/setup-env: Show version of glibc
An upgrade of glibc has caused an issue on Fedora Rawhide[0]. We need a
clear indicator that a change in glibc could cause it.

[0] https://github.com/containers/toolbox/issues/821

https://github.com/containers/toolbox/pull/834
2021-07-08 15:15:57 +02:00
Ondřej Míchal
dd5cd5f25a playbooks/setup-env: Show versions of more packages
https://github.com/containers/toolbox/pull/795
2021-06-22 00:00:57 +02:00
Ondřej Míchal
54a2ca1ead test/system: Decouple image caching from Zuul
Since the rewrite of the system test suite[0] we've relied on the Zuul
playbooks for taking care of caching images using Skopeo for increasing
the reliability of the tests (in the past the instability of the Fedora
registry caused problems). This state is problematic if we want to use
the tests in other environments than the Zuul CI. This moves the caching
from Zuul into the system tests.

Currently, Bats does not support officially suite-wide setup and
teardown functions. The solution I chose was to add two new test files
that are executed before and after all tests. This may complicate the
execution of cherry-picked tests but that is not a very common use case
anyway.

The tests are now to some extent capable of adjusting to the host
environment. This is meant in the sense of: I'm running on RHEL, the
"default image" is UBI; I'm running on Fedora, the "default image" is
fedora-toolbox. This mechanism relies on os-release, which is the same
as what Toolbox itself uses.

[0] https://github.com/containers/toolbox/pull/517

https://github.com/containers/toolbox/pull/774
2021-06-01 00:41:20 +02:00
Ondřej Míchal
a24c2f6dc1 test/system: Bump secondary fedora image from 29 to 32
The fedora-toolbox:32 image is the first of images in the renamed
toolbox image repository[0]. With the change we can drop the
pull_image_old() function because it was kept only for the old image.

Seems like newer version of ShellCheck checks the validity of variable
names (SC2153). This caused a false positive, so I silenced it.

[0] https://github.com/containers/toolbox/pull/615

https://github.com/containers/toolbox/pull/780
2021-05-31 12:28:24 +02:00
Juanje Ojeda
7973181136 playbooks, test/system: Avoid downloading the images multiple times
Since commit b27795a03e, each section of the test suite starts
and ends with a clean Podman state. This includes removing all images
from the local containers storage. Therefore, the images get downloaded
multiple times during the course of the test suite.

This commit restores the earlier behaviour where the images would get
downloaded only once, by copying them to separate directories outside
the local containers storage and then restoring them when the tests
are run.

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/704
2021-02-19 20:18:21 +01:00
Juanje Ojeda
0e8cfe95eb playbooks: Specify the precise versions of bats-assert & bats-support
See:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/703
2021-02-19 19:18:25 +01:00
Juanje Ojeda
2a2fd5baa5 .zuul, playbooks: Unify the setup-env.yaml across all Fedora versions
The playbooks were too fragmented and were hard to maintain. With this
the number of files is significantly lowered.

https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/701
2021-02-19 18:15:55 +01:00
Renamed from playbooks/fedora-32/setup-env.yaml (Browse further)