Commit Graph

1526 Commits

Author SHA1 Message Date
Debarshi Ray 57a4b49d4f Prepare 0.0.99.6
https://github.com/containers/toolbox/pull/1556
2024-09-30 12:29:55 +02:00
Debarshi Ray 13546e45b6 build: Exclude the meson.build files when installing the system tests
... because they serve no purpose.

https://github.com/containers/toolbox/pull/1557
2024-09-30 01:26:21 +02:00
Debarshi Ray 1d943b6c2a build: Remove files duplicated in the list of directories
Fallout from 2594199fef

https://github.com/containers/toolbox/pull/1557
2024-09-30 01:23:10 +02:00
Debarshi Ray 5eb3e85134 pkg/nvidia: Clean up NVIDIA Management Library when no longer in use
The NVIDIA Management Library API expects nvmlShutdown() to be called
once it's no longer in use [1].

Fallout from 8dd2f8e80a

[1] https://docs.nvidia.com/deploy/nvml-api/group__nvmlInitializationAndCleanup.html

https://github.com/containers/toolbox/pull/1555
2024-09-29 23:04:00 +02:00
Jordan Petridis 1d6b0b9136 profile.d: Add whitespace padding to the PS1
Add an extra space after the ⬢ so things are less smooshed together.

https://github.com/containers/toolbox/pull/1542
2024-09-29 13:25:31 +02:00
Ruilong Wu d7bafb82ed build: Make it build on loongarch64
Go 1.19 added support for 64-bit LoongArch on Linux (GOOS=linux,
GOARCH=loong64) [1], and the path of the dynamic linker (ie., PT_INTERP)
was taken from the ABI specification [2].

Tested by the Debian loong64 port [3].

[1] https://tip.golang.org/doc/go1.19#loong64

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

[3] https://buildd.debian.org/status/fetch.php?pkg=golang-github-containers-toolbox&arch=loong64&ver=0.0.99.3%2Bgit20230118%2B446d7bfdef6a-2.1&stamp=1722443115

https://github.com/containers/toolbox/pull/1523
2024-09-28 13:12:52 +02:00
Debarshi Ray fb9e2e7ade test/system: Optimize the resource limits tests
The system tests can be very I/O intensive, because many of them copy
OCI images from the test suite's image cache directory to its local
container/storage store, create containers, and then delete everything
to run the next test with a clean slate.  This makes them slow.

The runtime environment tests, which includes the resource limit tests,
are particularly slow because they don't skip the I/O even when testing
error handling.  This makes them a good target for optimizations.

The resource limit tests query the values for different resources from
the same default container without changing its state.  Therefore, a lot
of disk I/O can be avoided by creating the default container only once
for all the tests.

This can save even 30 minutes.

https://github.com/containers/toolbox/pull/1552
2024-09-28 01:32:12 +02:00
Debarshi Ray 987f5e2592 .zuul, playbooks, test/system: Optimize the CI on Fedora nodes
The test suite has expanded to 415 system tests.  These tests can be
very I/O intensive, because many of them copy OCI images from the test
suite's image cache directory to its local container/storage store,
create containers, and then delete everything to run the next test with
a clean slate.  This makes the system tests slow.

Unfortunately, Zuul's max-job-timeout setting defaults to an upper limit
of 3 hours or 10800 seconds for jobs [1], and this is what Software
Factory uses [2].  So, there comes a point beyond which the CI can't be
prevented from timing out by increasing the timeout.

One way of scaling past this maximum time limit is to run the tests in
parallel across multiple nodes.  This has been implemented by splitting
the system tests into different groups, which are run separately by
different nodes.

First, the tests were grouped into those that test commands and options
accepted by the toolbox(1) binary, and those that test the runtime
environment within the Toolbx containers.  The first group has more
tests, but runs faster, because many of them test error handling and
don't do much I/O.

The runtime environment tests take especially long on Fedora Rawhide
nodes, which are often slower than the stable Fedora nodes.  Possibly
because Rawhide uses Linux kernels that are built with debugging
enabled, which makes it slower.  Therefore, this group of tests were
further split for Rawhide nodes by the Toolbx images they use.  Apart
from reducing the number of tests in each group, this should also reduce
the amount of time spent in downloading the images.

The split has been implemented with Bats' tagging system that is
available from Bats 1.8.0 [3].  Fortunately, commit 87eaeea6f0
already added a dependency on Bats >= 1.10.0.  So, there's nothing to
worry about.

At the moment, Bats doesn't expose the tags being used to run the test
suite to setup_suite() and teardown_suite() [4].  Therefore, the
TOOLBX_TEST_SYSTEM_TAGS environment variable was used to optimize the
contents of setup_suite().

[1] https://zuul-ci.org/docs/zuul/latest/tenants.html

[2] Commit 83f28c52e4
    https://github.com/containers/toolbox/commit/83f28c52e47c2d44
    https://github.com/containers/toolbox/pull/1548

[3] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[4] https://github.com/bats-core/bats-core/issues/1006

https://github.com/containers/toolbox/pull/1551
2024-09-28 01:28:58 +02:00
Debarshi Ray e435704d4a test/system: Simplify line count checks by using Bats >= 1.10.0
Commit 87eaeea6f0 already added a dependency on Bats >= 1.10.0,
which is present on Fedora >= 39.  Therefore, it should be exploited
wherever possible to simplify things.

https://github.com/containers/toolbox/pull/1551
2024-09-27 12:50:16 +02:00
Debarshi Ray cb98871f16 playbooks/system-test: Remove Bats' timing information
They haven't been of any use lately, and they do add some extra noise to
each line in the CI logs.

https://github.com/containers/toolbox/pull/1551
2024-09-26 22:41:48 +02:00
Debarshi Ray 679bf87eb9 .zuul: Enable testing on Fedora 41
https://github.com/containers/toolbox/pull/1550
2024-09-26 21:20:13 +02:00
Debarshi Ray 861cf8546e doc/toolbox: Clarify that Toolbx isn't a security mechanism
Using the word 'containerized' gives the false impression of heightened
security.  As if it's a mechanism to run untrusted software in a
sandboxed environment without access to the user's private data (such as
$HOME), hardware peripherals (such as cameras and microphones), etc..
That's not what Toolbx is for.

Toolbx aims to offer an interactive command line environment for
development and troubleshooting the host operating system, without
having to install software on the host.  That's all.  It makes no
promise about security beyond what's already available in the usual
command line environment on the host that everybody is familiar with.

https://github.com/containers/toolbox/issues/1020
2024-09-26 21:19:26 +02:00
Debarshi Ray ebf693394a doc/toolbox: Tweak
Mention that Toolbx is meant for system administrators to troubleshoot
the host operating system.  The word 'debugging' is often used in the
context of software development, and hence most readers might not
interpret it as 'troubleshooting'.

https://github.com/containers/toolbox/pull/1549
2024-09-26 21:19:26 +02:00
Debarshi Ray d731d8f087 cmd, doc, test/system: Synchronize the summary with the code repository
https://github.com/containers/toolbox/pull/1549
2024-09-26 21:18:31 +02:00
Debarshi Ray 85bed43a40 images/fedora/f39: Synchronize README.md
Only the images for currently maintained Fedoras (ie., 39) were updated.

https://github.com/containers/toolbox/pull/1549
2024-09-26 19:33:55 +02:00
Debarshi Ray 2eccaf8211 README.md, images/fedora/f39: Tweak
Use 'software development' instead of just 'development' when
introducing Toolbx.  The additional context makes it more understandable
to the reader.

https://github.com/containers/toolbox/pull/1549
2024-09-26 19:33:52 +02:00
Debarshi Ray 66280a617a build: Use the same linker flags as NVIDIA Container Toolkit
The previous commit explains how the NVIDIA Container Toolkit is
sensitive to some linker flags.  Therefore, use the same linker flags
that are used by NVIDIA Container Toolkit to build the nvidia-cdi-hook,
nvidia-ctk, etc. binaries, because they use the same Go APIs that
toolbox(1) does [1].  It's better to use the same build configuration to
prevent subtle bugs from creeping in.

[1] NVIDIA Container Toolkit commit 772cf77dcc2347ce
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/772cf77dcc2347ce
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/333

https://github.com/containers/toolbox/pull/1548
2024-09-26 18:54:20 +02:00
Debarshi Ray 83f28c52e4 build: Notify distributors that the '-z now' linker flag is unsupported
The '-z now' flag, which is the opposite of '-z lazy', is unsupported as
an external linker flag [1], because of how the NVIDIA Container Toolkit
stack uses dlopen(3) to load libcuda.so.1 and libnvidia-ml.so.1 at
runtime [2,3].

The NVIDIA Container Toolkit stack doesn't use dlsym(3) to obtain the
address of a symbol at runtime before using it.  It links against
undefined symbols at build-time available through a CUDA API definition
embedded directly in the CGO code or a copy of nvml.h.  It relies upon
lazily deferring function call resolution to the point when dlopen(3) is
able to load the shared libraries at runtime, instead of doing it when
toolbox(1) is started.

This is unlike how Toolbx itself uses dlopen(3) and dlsym(3) to load
libsubid.so at runtime.

Compare the output of:
  $ nm /path/to/toolbox | grep ' subid_init'

... with those from:
  $ nm /path/to/toolbox | grep ' nvmlGpuInstanceGetComputeInstanceProfileInfoV'
          U nvmlGpuInstanceGetComputeInstanceProfileInfoV
  $ nm /path/to/toolbox | grep ' nvmlDeviceGetAccountingPids'
          U nvmlDeviceGetAccountingPids

Using '-z now' as an external linker flag forces the dynamic linker to
resolve all symbols when toolbox(1) is started, and leads to:
  $ toolbox
  toolbox: symbol lookup error: toolbox: undefined symbol:
      nvmlGpuInstanceGetComputeInstanceProfileInfoV

With the recent expansion of the test suite, it's necessary to increase
the timeout for the Fedora nodes to prevent the CI from timing out.

Fallout from 6e848b250b

[1] NVIDIA Container Toolkit commit 1407ace94ab7c150
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/1407ace94ab7c150
    https://github.com/NVIDIA/go-nvml/issues/18
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/49

[2] https://github.com/NVIDIA/nvidia-container-toolkit/tree/main/internal/cuda

[3] https://github.com/NVIDIA/go-nvml/blob/main/README.md
    https://github.com/NVIDIA/go-nvml/tree/main/pkg/dl
    https://github.com/NVIDIA/go-nvml/tree/main/pkg/nvml

https://github.com/containers/toolbox/pull/1548
2024-09-26 18:53:33 +02:00
Debarshi Ray dd23baa29a cmd/initContainer, test/system: Handle NVIDIA's create-symlinks CDI hook
NVIDIA Container Toolkit 0.16.0 started using create-symlinks hooks in
the Container Device Interface specification generated by it [1].  For
example:
  "hookName": "createContainer",
  "path": "/usr/bin/nvidia-cdi-hook",
  "args": [
    "nvidia-cdi-hook",
    "create-symlinks",
    "--link",
    "libnvidia-allocator.so.560.35.03::/usr/lib64/libnvidia-allocator.so.1",
    "--link",
    "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so"
  ]

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/548

https://github.com/containers/toolbox/pull/1545
2024-09-20 17:17:17 +02:00
Debarshi Ray c399243b46 cmd/initContainer: Shuffle some code around
The following commit will handle create-symlinks hooks in the Container
Device Interface specification for the proprietary NVIDIA driver,
because NVIDIA Container Toolkit 0.16.0 started using those [1].  So,
make some space for the new code.

This will make the following commit easier to read.

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/aae3da88c33d9cf2
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/548

https://github.com/containers/toolbox/pull/1545
2024-09-19 13:59:44 +02:00
Debarshi Ray f2dc3b8f63 .zuul, test/system: Simplify line count checks by using Bats >= 1.10.0
Commit 87eaeea6f0 already added a dependency on Bats >= 1.10.0,
which is present on Fedora >= 39.  Therefore, it should be exploited
wherever possible to simplify things.

Currently, the CI has been frequently timing out on stable Fedora nodes.
So, increase the timeout from 1 hour 50 minutes to 2 hours to avoid
that.

For what it's worth, the timeout for Fedora Rawhide nodes is 2 hours 10
minutes and it seems enough.

https://github.com/containers/toolbox/pull/1546
2024-09-19 13:55:55 +02:00
Debarshi Ray 9a87d15188 cmd/initContainer: Unbreak application of CDI hooks for NVIDIA
NVIDIA Container Toolkit 0.16.0 changed the hook arguments in the
Container Device Interface specification generated by it [1].

Fallout from 649d02f8a6

[1] NVIDIA Container Toolkit commit 179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/435

https://github.com/containers/toolbox/pull/1544
2024-09-17 15:18:45 +02:00
Debarshi Ray c386a442f7 cmd/initContainer: Log unknown Container Device Interface hook arguments
NVIDIA Container Toolkit 0.16.0 changed the hook arguments in the
Container Device Interface specification generated by it [1].  Having
the unknown hook arguments show up in the debug logs makes it easier to
understand what happened.

[1] NVIDIA Container Toolkit commit 179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/179d8655f9b5fce6
    https://github.com/NVIDIA/nvidia-container-toolkit/issues/435

https://github.com/containers/toolbox/pull/1543
2024-09-17 14:12:21 +02:00
Debarshi Ray bd19633a87 cmd/initContainer: Simplify code
Fallout from 6e848b250b

https://github.com/containers/toolbox/pull/1543
2024-09-17 14:12:14 +02:00
Debarshi Ray 8dd2f8e80a cmd/run, pkg/nvidia: Detect mismatched NVIDIA kernel & user space driver
The proprietary NVIDIA driver has a kernel space part and a user space
part, and they must always have the same matching version.  Sometimes,
the host operating system might end up with mismatched parts.  One
reason could be that the different third-party repositories used to
distribute the driver might be incompatible with each other.  eg., in
the case of Fedora it could be RPM Fusion and NVIDIA's own repository.

This shows up in the systemd journal as:
  $ journalctl --dmesg
  ...
  kernel: NVRM: API mismatch: the client has the version 555.58.02, but
          NVRM: this kernel module has the version 560.35.03.  Please
          NVRM: make sure that this kernel module and all NVIDIA driver
          NVRM: components have the same version.
  ...

Without any special handling of this scenario, users would be presented
with a very misleading error:
  $ toolbox enter
  Error: failed to get Container Device Interface containerEdits for
      NVIDIA

Instead, improve the error message to be more self-documenting:
  $ toolbox enter
  Error: the proprietary NVIDIA driver's kernel and user space don't
      match
  Check the host operating system and systemd journal.

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray 977c3d98a4 pkg/nvidia: Tweak a debug log to avoid an abbreviation
It's better to avoid abbreviations when the length of the string and the
depth of the indentation are favourable.

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray 09dcdb492a pkg/nvidia: Share the Logrus logger with the info.Interface
A new API was added to github.com/NVIDIA/go-nvlib 0.4.0 to specify a
logger to be used by a info.Interface [1].  Commit 649d02f8a6
already bumped the required go-nvlib version to 0.6.0, so take advantage
of that.

[1] github.com/NVIDIA/go-nvlib commit 21c8f035ca66b29d
    https://github.com/NVIDIA/go-nvlib/commit/21c8f035ca66b29d
    https://github.com/NVIDIA/go-nvlib/pull/28

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Debarshi Ray ce7a0d4ce2 pkg/nvidia: Avoid creating an info.Interface with the nvcdi.Interface
NVIDIA Container Toolkit 0.16.0 added a new API to avoid creating a new
info.Interface when creating a nvcdi.Interface, if an info.Interface
already exists [1].  Commit 649d02f8a6 already bumped the required
NVIDIA Container Toolkit version to 0.16.0, so take advantage of that.

[1] NVIDIA Container Toolkit commit 8fc4b9c742f894ef
    https://github.com/NVIDIA/nvidia-container-toolkit/commit/8fc4b9c742f894ef
    https://github.com/NVIDIA/nvidia-container-toolkit/pull/516

https://github.com/containers/toolbox/pull/1541
2024-09-14 20:01:01 +02:00
Amber Connelly dcd4c4382c Add man pages and progress bars to Arch Linux image
Signed-off-by: Amber Connelly <113668892+ac-z@users.noreply.github.com>
2024-09-14 12:10:28 +02:00
Debarshi Ray a653325279 build: Bump github.com/NVIDIA/nvidia-container-toolkit to 1.16.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-11 13:48:54 +02:00
Debarshi Ray fd5fd49ebf build: Bump github.com/NVIDIA/go-nvlib to 0.6.1
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-11 00:39:23 +02:00
Debarshi Ray 649d02f8a6 build: Bump go-nvlib to 0.6.0 and nvidia-container-toolkit to 1.16.0
Note that github.com/NVIDIA/go-nvlib > 0.2.0 isn't API compatible with
github.com/NVIDIA/nvidia-container-toolkit 1.15.0.  The next release of
nvidia-container-toolkit is 1.16.0 and it requires go-nvlib 0.6.0.

Therefore, these two Go modules need to be updated together.

The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1540
2024-09-10 23:51:25 +02:00
Debarshi Ray a8dd3c691c build: Bump golang.org/x/sys to 0.22.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 23:37:30 +02:00
Debarshi Ray 9196dd6925 build: Bump golang.org/x/sys to 0.21.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 23:14:54 +02:00
Debarshi Ray 3ef85e1c78 build: Bump golang.org/x/sys to 0.20.0
The src/go.sum file was updated with 'go mod tidy'.

https://github.com/containers/toolbox/pull/1539
2024-09-10 22:32:25 +02:00
Debarshi Ray 369781a6d6 test/system: Test attempts to create the same container twice
https://github.com/containers/toolbox/issues/957
2024-09-10 21:17:38 +02:00
Debarshi Ray 26a76f2d7f cmd/run, test/system: Handle exit code 127 in 'run' from forwarded call
When 'toolbox run' is invoked on the host, an exit code of 127 from
'podman exec' means either that the specified command couldn't be found
or that the working directory didn't exist.  The only way to tell these
two scenarios apart is to actually look inside the container.

Secondly, Toolbx containers always have an executable toolbox(1) binary
at /usr/bin/toolbox and it's assumed that /usr/bin is always part of the
PATH environment variable.

When 'toolbox run toolbox ...' is invoked, the inner toolbox(1)
invocation will be forwarded back to the host by the Toolbx container's
/usr/bin/toolbox, which is always present as an executable.  Hence, if
the outer 'podman exec' on the host fails with an exit code of 127,
then it doesn't mean that the container didn't have a toolbox(1)
executable, but that some subordinate process started by the container's
toolbox(1) failed with that exit code.

Therefore, handle this as a special case to avoid losing the exit code.
Otherwise, it leads to:
  $ toolbox run toolbox run non-existent-command
  bash: line 1: exec: non-existent-command: not found
  Error: command non-existent-command not found in container
      fedora-toolbox-40
  $ echo "$?"
  0

Instead, it will now be:
  $ toolbox run toolbox run non-existent-command
  bash: line 1: exec: non-existent-command: not found
  Error: command non-existent-command not found in container
      fedora-toolbox-40
  $ echo "$?"
  127

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 20:35:48 +02:00
Debarshi Ray 1a88195729 cmd/run, test/system: Handle exit code 126 in 'run' from forwarded call
When 'toolbox run' is invoked on the host, an exit code of 126 from
'podman exec' means that the specified command couldn't be invoked
because it's not an executable.  eg., the command was actually a
directory.  Note that this doesn't mean that the command couldn't be
found.  That's denoted by exit code 127.

Secondly, Toolbx containers always have an executable toolbox(1) binary
at /usr/bin/toolbox and it's assumed that /usr/bin is always part of the
PATH environment variable.

When 'toolbox run toolbox ...' is invoked, the inner toolbox(1)
invocation will be forwarded back to the host by the Toolbx container's
/usr/bin/toolbox, which is always present as an executable.  Hence, if
the outer 'podman exec' on the host fails with an exit code of 126,
then it doesn't mean that the container didn't have a working toolbox(1)
executable, but that some subordinate process started by the container's
toolbox(1) failed with that exit code.

Therefore, handle this as a special case to avoid showing an extra error
message.  Otherwise, it leads to:
  $ toolbox run toolbox run /etc
  bash: line 1: /etc: Is a directory
  bash: line 1: exec: /etc: cannot execute: Is a directory
  Error: failed to invoke command /etc in container fedora-toolbox-40
  Error: failed to invoke command toolbox in container fedora-toolbox-40
  $ echo "$?"
  126

Instead, it will now be:
  $ toolbox run toolbox run /etc
  bash: line 1: /etc: Is a directory
  bash: line 1: exec: /etc: cannot execute: Is a directory
  Error: failed to invoke command /etc in container fedora-toolbox-40
  $ echo "$?"
  126

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 20:32:10 +02:00
Debarshi Ray 3ad77e6b2d cmd/run: Re-align
The lines were getting too wide to fit within a vertical 1080x1920
display.  Therefore, restrict them to 120 characters per line.

Fallout from f8e21a31b3

https://github.com/containers/toolbox/pull/1534
2024-09-09 18:26:40 +02:00
Debarshi Ray ca8e62ecf2 pkg/utils, test/system: Test podman(1) invocations forwarded to the host
The test suite uses its own separate local container/storage store to
isolate itself from the default store, so that the tests' interactions
with containers and images don't affect anything else.  This is done by
using the CONTAINERS_STORAGE_CONF environment variable [1] to specify a
separate storage.conf(5) file [2].

Therefore, when running the test suite, the CONTAINERS_STORAGE_CONF
environment variable must be preserved when forwarding toolbox(1)
invocations inside containers to the host.  Otherwise, the initial
toolbox(1) invocation on the host and the forwarded invocation running
on the host won't use the same local container/storage store.

This problem only impacts test cases that cover toolbox(1) code paths
that invoke podman(1).

[1] https://docs.podman.io/en/latest/markdown/podman.1.html

[2] https://manpages.debian.org/testing/containers-storage/containers-storage.conf.5.en.html

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 15:20:57 +02:00
Ondřej Míchal fa2466029d cmd, test/system: Retain exit codes when forwarding to host
Some changes by Debarshi Ray.

https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-09 14:10:31 +02:00
Debarshi Ray 1a3f4ff4c6 test/system: Tweak a name
https://github.com/containers/toolbox/pull/1534
2024-09-06 17:05:50 +02:00
Debarshi Ray d287588f3d cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones
This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found.  However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

https://github.com/containers/toolbox/issues/957
2024-09-05 21:27:53 +02:00
Debarshi Ray ee90bc957b cmd/root: Mark a private member as such
https://github.com/containers/toolbox/pull/1533
2024-09-05 21:27:53 +02:00
Debarshi Ray 76a8508019 test/system: Test the output messages when a container is created
https://github.com/containers/toolbox/pull/1536
2024-09-05 21:25:38 +02:00
Debarshi Ray c6a1de3eee test/system: Remove unnecessary --assumeyes
It shouldn't be necessary to use the --assumeyes option when creating a
Toolbx container, if the corresponding image is already present in the
local containers/storage image store.  It's harmful to test it with the
option, even when it shouldn't be needed, because it's off by default
and most users won't enable it.

Therefore, it's better to test the most common scenario that most users
will encounter.

https://github.com/containers/toolbox/pull/1536
2024-09-05 16:36:39 +02:00
Debarshi Ray 983beb1352 test/system: Test attempts to create the same container twice
https://github.com/containers/toolbox/pull/1536
2024-09-05 14:51:30 +02:00
Ondřej Míchal 62fcc093e7 pkg/utils, test/system: Retain errors without -v when forwarding to host
https://github.com/containers/toolbox/issues/957
https://github.com/containers/toolbox/pull/1052
2024-09-03 16:41:29 +02:00
Debarshi Ray 87eaeea6f0 test/system: Simplify the line count checks by relying on Bats >= 1.10.0
Fedoras 37 and 38 didn't have Bats 1.10.0.  However, they reached End of
Life on 15th November 2023 and 21st May 2024 respectively, and were
dropped from the CI [1,2].  Fedora 39 is the oldest supported Fedora and
it has Bats 1.10.0.

Therefore, there's no need to retain compatibility with Bats < 1.10.0.

[1] Commit 9c2b5e9a4b
    https://github.com/containers/toolbox/pull/1418

[2] Commit b684b190d1
    https://github.com/containers/toolbox/pull/1527

https://github.com/containers/toolbox/pull/1532
2024-09-03 12:08:10 +02:00
Ondřej Míchal c8c9e95ed0 test/system: Test that CLI errors are shown inside Toolbx containers
https://github.com/containers/toolbox/pull/1525
2024-08-30 18:44:28 +02:00