Commit graph

1096 commits

Author SHA1 Message Date
Alex Jia
26ae0bb896 test/system: fix typo in 102-list.bats
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2021-09-10 10:42:16 +01:00
Oliver Gutierrez
075b9a8d27 tests: Fix tests to setup the XDG_RUNTIME_DIR variable when empty
https://github.com/containers/toolbox/pull/857

When the XDG_RUNTIME_DIR variable is empty toolbox is not able to
initialize the container correctly and fails to run.
2021-08-09 19:57:41 +02:00
Oliver Gutierrez
09fb237727 tests: Changed container image source for busybox
Due to docker rate limiting we can not rely in docker.io for
retrieving the images.

This was detected when executing our tests for podman fedora
gating pipeline. Our busybox image was not downloaded and
one of the list tests was failing.
2021-08-09 17:09:29 +02:00
Ondřej Míchal
04c673dd06 test/system: Test pull failure
Follow-up to https://github.com/containers/toolbox/pull/852

https://github.com/containers/toolbox/pull/854
2021-07-29 10:10:02 +02:00
Ondřej Míchal
9820550c82 test/system: Use BATS_RUN_TMPDIR for image cache
Using the current working directory for cache is not a good solution
since the test files may reside in a location that is unwritable (e.g.,
/usr/share). The `BATS_RUN_TMPDIR` variable should point to a location
that is sure to be writeable from the test suite.

https://github.com/containers/toolbox/pull/850
2021-07-28 09:31:35 +02:00
Debarshi Ray
660b6970e9 cmd/create: Mention that private images require 'podman login'
It's not possible to programmatically detect when an image requires
logging into the registry [1]. Therefore, instead of trying to handle
'podman pull' failures due to lack of authorization, just mention that
private images require 'podman login' and that further details of the
failure can be found by using the --verbose option.

[1] https://github.com/containers/podman/issues/10858

https://github.com/containers/toolbox/issues/754
https://github.com/containers/toolbox/pull/852
2021-07-23 04:00:20 +02:00
Ondřej Míchal
20f4f68c4e cmd/root, pkg/utils: Add support for configuration files
It looks like there are some oddities with Viper [1]. The errors can't
be examined with errors.As [2] and Viper doesn't actually throw
ConfigFileNotFoundError if a configuration file is not found. Secondly,
there's no way to find out if a key was actually specified in a
configuration file. The InConfig API doesn't return 'true' even if a
key was mentioned in a configuration file, and the IsSet API returns
'true' even if the key was only set via SetDefault in the code.

Some changes by Debarshi Ray.

[1] https://pkg.go.dev/github.com/spf13/viper
[2] https://blog.golang.org/go1.13-errors

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:56:03 +02:00
Ondřej Míchal
ffdfaa7410 data/config: Add reference configuration file
The file format is TOML[0] but the file extension is .conf to follow the
convention set by Podman.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:56:03 +02:00
Debarshi Ray
5824f0adcb cmd/create, pkg/utils: Simplify hint after creating a container
A subsequent commit will add support for configuration files, which can
override the default toolbox image. Since this override affects all
commands, it effectively ends up adding a fourth option to the 'enter'
command, other than the existing options to change the distribution,
release and container. This makes it a lot more difficult to reason
when only 'toolbox enter --release N' is enough to enter the created
container.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:49:08 +02:00
Debarshi Ray
6a37695086 pkg/utils: Mark a private function as such
Figuring out the default toolbox image for a given distribution only
needs to happen as part of resolving the final toolbox image name from
the given command line options.

Fallout from c990fb43ca

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/851
2021-07-23 03:49:08 +02:00
Ondřej Míchal
b0beb68255 test/system: Fix flaky test
This is a naive attempt to solve the flaking. It could be caused by what
is going inside of the run function.
2021-07-22 11:19:02 +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
2594199fef test/system: Track bats libs as submodules & install them better
This will make it easier to work with system tests.

https://github.com/containers/toolbox/pull/842
2021-07-22 10:23:53 +02:00
Jens Petersen
d9945a6505 utils: bump the fallback Fedora version to 34
https://github.com/containers/toolbox/pull/845
2021-07-21 23:44:20 +02:00
Ondřej Míchal
6c2cd0e929 test/system: Drop hack around unknown dirs in containers
This hack should not be needed since v0.0.99.2[0].

[0] https://github.com/containers/toolbox/releases/tag/0.0.99.2

https://github.com/containers/toolbox/pull/843
2021-07-21 23:43:41 +02:00
Ondřej Míchal
16b0c5d88f test/system: Check whole lines instead of partials
The 'toolbox run' command has one downside: all newlines contain
a carriage return (CR). This is caused by the unconditional use of the
--tty option in `podman exec`[0]. In these particular tests this can be
worked around by not printing a newline at all.

Another quirk around partial is to check the last line of the output.

[0] https://github.com/containers/podman/issues/9718

https://github.com/containers/toolbox/pull/843
2021-07-21 23:43:41 +02:00
Ondřej Míchal
d9147fff8c pkg/utils: Streamline functions
https://github.com/containers/toolbox/pull/847
2021-07-21 21:12:09 +02:00
Oliver Gutierrez
1f0c6d5100 tests: Added a verbose test for container starting
https://github.com/containers/toolbox/pull/831
2021-07-21 19:56:07 +02:00
Ondřej Míchal
259afdf815 test/system: Adjust asserts for broken test
The output of `podman build` has changed a bit. Each line of log
describing the build is now in the format of:

- STEP i/n: msg

instead of:

- STEP i: msg

where i is the current step and n the maximum number of steps.

The exact format is not important for the purpose of testing Toolbox, so
we may fallback to partial string testing.

Also the latest step ("COMMIT") seems to no longer be considered a step,
so just check for the word.

https://github.com/containers/toolbox/pull/846
2021-07-21 18:21:14 +02:00
Ondřej Míchal
f7617912e5 pkg/utils: Rename parameter in ParseRelease
It was not apparent on first glance that the second parameter
represented a release (resp. tag).

https://github.com/containers/toolbox/pull/835
2021-07-16 18:00:01 +02:00
Ondřej Míchal
b0b9b8e960 pkg/utils: Test ParseRelease
https://github.com/containers/toolbox/pull/841
2021-07-16 17:32:09 +02:00
Ondřej Míchal
fd756089ef pkg/utils: Separate container & image name resolution
The ResolveContainerAndImageNames() function does too much work. It
makes more sense to have two functions: one for resolving the image
name and another for resolving the container name.

https://github.com/containers/toolbox/pull/828
https://github.com/containers/toolbox/pull/838
2021-07-13 13:07:40 +02:00
Ondřej Míchal
d03a5fee80 cmd/create: Expose the host's entire / in the container at /run/host
Having the entire host file system hierarchy mounted inside a toolbox
container gives the containers a more complete environment that's
resilient against future changes in the layout of the file system
hierarchy and the need for giving access to new paths to support new
use-cases. Otherwise, one would have to create a new container to get
access to any path that lies outside the /boot, /etc, /run, /tmp, /usr
and /var directories.

As a nice side-effect, this also simplifies the bind mount handling
code.

https://github.com/containers/toolbox/pull/827
2021-07-09 17:32:52 +02:00
Eveline Raine
94917b729e images: Add iproute to Fedoras 33, 34 and 35
https://github.com/containers/toolbox/pull/314
2021-07-08 20:54:20 +02:00
Ondřej Míchal
37291db161 pkg/utils: Drop redundant functions
https://github.com/containers/toolbox/pull/833
2021-07-08 16:46:51 +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
b27b41eff8 pkg/utils: Test ImageReferenceCanBeID
https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:48 +02:00
Ondřej Míchal
781c433a8d pkg/utils: Fix regular expression used to find IDs in image references
Turns out the braces do not need to be escaped.

The equivalent code in the POSIX shell implementation was:
  echo "$image" | grep "^[a-f0-9]\{6,64\}$"

There the braces had to be escaped because it was using grep(1) with
basic regular expressions (ie., without the --extended-regexp flag),
where the meta-characters ?, +, {, |, ( and ) lose their special
meaning unless they are escaped.

However, that was grep(1), and this is Go's regexp package.

Fallout from dd947016b3

https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:48 +02:00
Ondřej Míchal
b166a1f13f cmd/create: pkg/utils: Fix wrong use of regexp.MatchString return value
The regexp.MatchString [1] API returns an error only when the regular
expression is faulty, and the boolean return value tells if a match was
found. In this case, the regular expression is baked into the code as a
string literal. So, unless there's a programmer error, it should always
be valid.

Fallout dd947016b3

[1] https://golang.org/pkg/regexp/#MatchString

https://github.com/containers/toolbox/pull/825
2021-07-07 18:45:15 +02:00
Ondřej Míchal
210eded9a3 test/system: Update README
https://github.com/containers/toolbox/pull/824
2021-07-07 12:27:41 +02:00
Randall Mason
a733357053 build: Allow overriding the path to tmpfilesdir
When installing to a non-system-wide prefix as a non-root user, the
tmpfilesdir path defined by systemd might not be accessible. Overriding
the path helps to prevent the installation from failing.

https://github.com/containers/toolbox/pull/717
2021-07-05 03:46:07 +02:00
Oliver Gutierrez
8b51901eb1 README.md: Update to reflect label deprecation
https://github.com/containers/toolbox/pull/820
2021-07-02 18:21:11 +02:00
Oliver Gutierrez
cb2ccbb594 images: Removed deprecated com.github.debarshiray.toolbox tag
https://github.com/containers/toolbox/pull/820
2021-07-02 18:21:04 +02:00
Ondřej Míchal
6c86cabbe5 cmd/root: Make 'toolbox' create or fall back to a container if possible
This makes 'toolbox', without any commands specified, behave a lot like
'toolbox enter'. When there aren't any toolbox containers, it will
offer to create a new container matching the same parameters passed to
the command. If there's just one toolbox container available, then it
will fall back to it.

This makes the command line interface a lot similar to that of
github.com/coreos/toolbox, which makes things easier for those
switching over from it.

Some changes by Debarshi Ray.

https://github.com/containers/toolbox/pull/811
2021-06-29 15:27:56 +02:00
Debarshi Ray
73450bd8ac images: Add bc to Fedora 33, 34 and 35
https://github.com/containers/toolbox/pull/817
2021-06-28 14:40:37 +02:00
Debarshi Ray
e55f866c53 images: Add fedora-toolbox image definition for Fedora 35
https://github.com/containers/toolbox/pull/817
2021-06-28 14:40:34 +02:00
Debarshi Ray
0bdfa53bb2 Prepare 0.0.99.2 2021-06-26 19:48:32 +02:00
Debarshi Ray
d66c560a04 images: Synchronize README.md
https://github.com/containers/toolbox/pull/815
2021-06-26 19:33:42 +02:00
Debarshi Ray
2b317b94b5 doc/toolbox-init-container: Style fixes
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
23256cb443 doc/toolbox-init-container: Avoid mentioning an implementation detail
SELinux is always meant to be disabled. The exact location of the code
is a historical accident and isn't meant to imply that SELinux might
be optionally enabled.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
963219b2da doc/toolbox-enter: Restore text about the default naming scheme
This reverts parts of commit ea452d7ced.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
a0457c8fdb doc/toolbox-run: Style fix
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
52880eefc9 doc/toolbox-init-container: Synchronize with doc/toolbox-create
Avoid phrases like "shortcoming of container configuration", because
it makes one wonder why a known shortcoming is even being used or not
being fixed. Immutability also has its advantages for certain
use-cases, and it's beyond the scope of this manual to have a full
blown discussion about the pros and cons of OCI containers. Interested
readers can research that on their own.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
637e90c75d README.md, doc/toolbox: Synchronize with doc/toolbox-create
https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
55952c8605 doc/toolbox-create: Put toolbox set-up before entry point & tweak them
This builds upon commit ea452d7ced.

The configuration of a toolbox container is a higher level topic than
the entry point, and the entry point is mentioned as one part of it.
Therefore, putting the section on toolbox set-up earlier in the text
makes it nicely flow from the DESCRIPTION section into the Entry Point
sub-section.

Emphasize the user-visible features of a toolbox container, and not
the underlying implementation details, and avoid using too much jargon
about container technology.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:16:42 +02:00
Debarshi Ray
4b70754a24 doc/toolbox-create: Restore the Entry Point sub-section
It was a deliberate decision to have entry point documented in both
toolbox-create(1) and toolbox-init-container(1). For technical
documentation it's sometimes good to repeat the same thing if it's
sufficiently important. Either to refresh the user's memory or to draw
their attention to it. Having to traverse too many references can get
disorienting. eg., parts of README.md are already repeated in
toolbox(1).

In this case, the entry point is very directly related to the create
command because the command sets it up, and unlike HTML documents,
it's awkward to follow links from manuals.

This reverts parts of commit ea452d7ced.

https://github.com/containers/toolbox/pull/814
2021-06-26 13:15:13 +02:00
Debarshi Ray
eaa59e9759 doc/toolbox-create: Generalize the text for the --image option
The DESCRIPTION already explains the details of the set-up on Fedora,
so there's no need to be so specific here. Plus, conceptually, it's not
meant to be Fedora-specific. Fedora is just an example and happens to
be the most well-supported one at the moment, but that will change.

https://github.com/containers/toolbox/pull/814
2021-06-26 09:14:49 +02:00
Debarshi Ray
3f14358dc6 doc/toolbox-create: Use singular for consistency
The rest of the DESCRIPTION section refers to toolbox containers in the
singular, not plural.

https://github.com/containers/toolbox/pull/814
2021-06-26 09:01:10 +02:00
Debarshi Ray
596d5c42b3 doc/toolbox-create: Explain host integration & don't mention security
https://github.com/containers/toolbox/pull/814
2021-06-26 08:55:27 +02:00
Debarshi Ray
ec1503fe9a doc/toolbox-create: Keep image details in the same paragraph
https://github.com/containers/toolbox/pull/814
2021-06-26 08:49:39 +02:00