Commit graph

557 commits

Author SHA1 Message Date
hexagonrecursion
713f4b866d Update the build requirements
Without this I get an error:
```
$ meson -Dprofile_dir=/etc/profile.d builddir
The Meson build system
Version: 0.55.3
Source dir: /home/user/toolbox
Build dir: /home/user/toolbox/builddir
Build type: native build
Project name: toolbox
Project version: 0.0.97

meson.build:1:0: ERROR: Unknown compiler(s): ['cc', 'gcc', 'clang', 'pgcc', 'icc']
The follow exceptions were encountered:
Running "cc --version" gave "[Errno 2] No such file or directory: 'cc'"
Running "gcc --version" gave "[Errno 2] No such file or directory: 'gcc'"
Running "clang --version" gave "[Errno 2] No such file or directory: 'clang'"
Running "pgcc --version" gave "[Errno 2] No such file or directory: 'pgcc'"
Running "icc --version" gave "[Errno 2] No such file or directory: 'icc'"

A full log can be found at /home/user/toolbox/builddir/meson-logs/meson-log.txt
```
2021-02-12 19:46:21 +01:00
Juanje Ojeda
b27795a03e test/system: Refactor tests using bats-support and bats-assert
The bats-support[0] and bats-assert[1] libraries extend the
capabilities of bats[2]. Mainly, bats-assert is very useful for clean
checking of values/outputs/return codes.

Apart from updating the cases to use the libraries, the test cases have
been restructured in a way that they don't depend on each other anymore.
This required major changes in the helpers.bats file.

Overall, the tests are cleaner to read and easier to extend due to the
test cases being independent.

Some slight changes were made to the test cases themselves. Should not
alter their final behaviour.

There will be a follow up commit that will take care of downloading of
the tested images locally and caching them using Skopeo to speedup the
tests and try to resolve network problems when pulling the images that
we experienced in the past.

[0] https://github.com/bats-core/bats-support
[1] https://github.com/bats-core/bats-assert
[2] https://github.com/bats-core/bats-core
2021-02-12 14:02:08 +01:00
Ondřej Míchal
97daf9f940 Make use of dynamic CI status badge 2021-02-10 14:49:46 +01:00
Debarshi Ray
001390b26d gen-docs-list: Add newline at end of file
https://github.com/containers/toolbox/pull/688
2021-02-08 16:49:58 +01:00
Debarshi Ray
c2f8e19e56 Update copyright notices
https://github.com/containers/toolbox/pull/688
2021-02-08 16:49:54 +01:00
Debarshi Ray
6552274ef1 doc/toolbox: Synchronize with README.md
https://github.com/containers/toolbox/pull/686
2021-01-25 22:37:13 +01:00
Debarshi Ray
bcc8ffcf3a README.md: Make it easier to read
https://github.com/containers/toolbox/pull/685
2021-01-25 21:55:02 +01:00
Debarshi Ray
538e2dd9c5 GOALS.md: Cosmetics
https://github.com/containers/toolbox/pull/684
2021-01-25 21:13:07 +01:00
Debarshi Ray
20a8a0551a GOALS.md, README.md: Move the Goals and Use Cases to a separate file
... to prevent the README.md file from becoming too long.

https://github.com/containers/toolbox/pull/684
2021-01-25 20:36:34 +01:00
Ondřej Míchal
ba1097a6db README.md: Add a section on how to install Toolbox
https://github.com/containers/toolbox/pull/683
2021-01-25 20:21:33 +01:00
Ondřej Míchal
59055cf9eb doc/toolbox-enter: Mention which shell is spawned
https://github.com/containers/toolbox/pull/682
2021-01-25 18:46:56 +01:00
Ondřej Míchal
a8caedbb01 doc/toolbox-enter: Update how toolbox containers are named
The Go implementation prefers a newer syntax for assigning a custom
name to a toolbox container. The --container option is still supported
for backwards compatibility, but the manuals should show the new
workflow.

https://github.com/containers/toolbox/pull/681
2021-01-25 18:22:35 +01:00
Debarshi Ray
4b62648736 doc/toolbox-create: Mention the tags in the default toolbox images
https://github.com/containers/toolbox/pull/681
2021-01-25 18:05:51 +01:00
Ondřej Míchal
eef0d28320 doc/toolbox-create: Update how toolbox containers are named
The Go implementation prefers a newer syntax for assigning a custom
name to a toolbox container. The --container option is still supported
for backwards compatibility, but the manuals should show the new
workflow.

https://github.com/containers/toolbox/pull/678
2021-01-22 18:28:53 +01:00
Ondřej Míchal
257a1d05e3 doc/toolbox-create: Remove reference to user-specific customized image
This should have been part of commit 6543ff6a06.

https://github.com/containers/toolbox/pull/678
2021-01-22 18:28:49 +01:00
Ondřej Míchal
6543ff6a06 doc/toolbox-create, doc/toolbox-init-container: Mention the entry point
Ever since version 0.0.10, all newly created toolbox containers use a
reflexive entry point [1] and don't need a user-specific customized
image. Older containers that don't use a reflexive entry point were
deprecated in version 0.0.17 [2], and aren't even supported in the Go
implementation.

Therefore, it's time to finally update the manuals to document the
current way of doing things. Since the reflexive entry point is a key
feature of toolbox containers, some text was added to explain why it's
necessary and what it does.

[1] Commit 8b84b5e460
    https://github.com/containers/toolbox/pull/160

[2] Commit 9dc5281430
    https://github.com/containers/toolbox/pull/336

https://github.com/containers/toolbox/pull/677
2021-01-22 17:21:49 +01:00
Debarshi Ray
e0267b7315 test/system: Remove unused variables
https://github.com/containers/toolbox/pull/674
2021-01-19 21:50:49 +01:00
Debarshi Ray
16c47c0e82 profile.d: Silence SC2148
While Toolbox's test suite explicitly uses --shell=sh when running
shellcheck(1) on profile.d/toolbox.sh, external tools like Coverity
can't be expected to do the same. So they complain:
  Line 1:
  [ "$BASH_VERSION" != "" ] || [ "$ZSH_VERSION" != "" ] || return 0
  ^-- SC2148: Tips depend on target shell and yours is unknown. Add a
    shebang or a 'shell' directive.

See: https://github.com/koalaman/shellcheck/wiki/SC2148

https://github.com/containers/toolbox/pull/673
2021-01-19 19:01:41 +01:00
Kan Li
69dd701d3a cmd/initContainer: Handle hosts with /etc/localtime as absolute symlink
On Arch Linux and Ubuntu hosts, /etc/localtime is an absolute symbolic
link to /usr/share/zoneinfo/SomeTimeZone. So, inside the container,
/run/host/etc/localtime also has /usr/share/zoneinfo/SomeTimeZone as
its target.

https://github.com/containers/toolbox/issues/622
2021-01-12 21:03:10 +01:00
Debarshi Ray
772451c5e5 Prepare 0.0.99 2021-01-12 14:05:42 +01:00
Debarshi Ray
120eea449e Remove the deprecated reset command
The Go implementation had deprecated the reset command, right from the
beginning, in favour of 'podman system reset'. It's time to finally
remove it.

https://github.com/containers/toolbox/pull/668
2021-01-12 03:21:35 +01:00
Ondřej Míchal
21d25f88e3 Support RHEL hosts by creating containers based on UBI
https://github.com/containers/toolbox/pull/667
2021-01-12 02:37:47 +01:00
Debarshi Ray
6fa2184da5 profile.d: Prevent setting VTE-specific PROMPT_COMMAND without VTE
Fedora's /etc/bashrc sets the PROMPT_COMMAND environment variable to
__vte_prompt_command when running inside a VteTerminal. This becomes a
problem if the __vte_prompt_command shell function is missing because
/etc/profile.d/vte.sh itself is absent [1], which is the case with the
Red Hat Universal Base Image.

This tricks the code in /etc/bashrc into not doing that.

[1] https://pagure.io/setup/pull-request/23

https://github.com/containers/toolbox/pull/667
2021-01-12 02:37:47 +01:00
Ondřej Míchal
32d711cc64 Add a --distro option
This is meant to allow the user to create toolbox containers of
operating system distributions that are different from that of the
host and isn't Fedora.

https://github.com/containers/toolbox/pull/667
2021-01-12 02:37:47 +01:00
Ondřej Míchal
c990fb43ca Introduce the concept of a 'distro' for future non-Fedora containers
This shouldn't have any user-visible effect. However, it parametrizes
various code paths that were currently hard-coded to represent Fedora.
Subsequent commits will build upon this to support toolbox containers
of operating system distributions that aren't Fedora.

A map of supported operating system distributions has been introduced
that lists out the necessary bits of metadata needed to work with them.
In the future, it should just be a matter of adding new entries to this
map to add support for distributions that aren't Fedora.

https://github.com/containers/toolbox/pull/667
2021-01-12 02:37:47 +01:00
Debarshi Ray
20ad4c0429 cmd/enter: Add more information to errors on failing to get the host ID
https://github.com/containers/toolbox/pull/667
2021-01-12 01:07:35 +01:00
Debarshi Ray
26ea367ee8 cmd/create: Shuffle some code around
https://github.com/containers/toolbox/pull/667
2021-01-12 01:07:35 +01:00
Debarshi Ray
3994be4c9c cmd/create: Rename a function for clarity
A subsequent commit will add support for toolbox containers of
operating system distributions that aren't Fedora. That will require a
similar function that resolves a short image name to a fully qualified
one, but by iterating through a list of supported images instead of
using the image's RepoTags.

https://github.com/containers/toolbox/pull/667
2021-01-12 01:07:35 +01:00
Debarshi Ray
289c04aa86 cmd/create: Try to avoid 'latest' tags, when looking at RepoTags
The same image ID can be referred to by multiple names. It's common
that one of the names uses the 'latest' tag, while another uses a
specific version number. It's better to resolve a short image name to
one with a specific version number, because the meaning of the tag is
clear and won't change with time.

https://github.com/containers/toolbox/pull/666
2021-01-12 01:05:52 +01:00
Debarshi Ray
b511a76578 Update the labels used for filtering toolbox containers images
The com.github.debarshiray.toolbox label was introduced in commit
0ab6eb7401 to replace the com.redhat.component label for
filtering toolbox containers and images. This happened right before
the release of Fedora 30, which hasn't been supported for a while [1].
Therefore, it's time to stop using the old label.

It's also time to start using the newer com.github.containers.toolbox
label that was introduced in commit de5e5df9b7 to reflect the
project's new home under the Containers organization on GitHub.

[1] https://fedoraproject.org/wiki/Releases/30/Schedule

https://github.com/containers/toolbox/pull/665
2021-01-11 23:38:48 +01:00
Debarshi Ray
7c02f93d68 completion, pkg/utils: Update the range of supported Fedora releases
Rawhide currently points to Fedora 34, and Fedora 30 reached End of
Life on 24th November:
https://fedoraproject.org/wiki/End_of_life

https://github.com/containers/toolbox/pull/663
2021-01-08 01:54:08 +01:00
Ondřej Míchal
af87ede1db completion, doc/toolbox-create: Remove --candidate-registry
The --candidate-registry is a lesser known option only supported by
the POSIX shell implementation. The Go never implementation never
offered it, and nobody has felt its absence so far. So, it's safe to
assume that there's no urgent need to port it to Go, and it's better to
not confuse users by mentioning it.

https://github.com/containers/toolbox/pull/662
2021-01-07 21:11:25 +01:00
Debarshi Ray
dd4829a33c Prepare 0.0.98.1 2021-01-07 20:17:06 +01:00
Debarshi Ray
0b41cc62f4 doc/toolbox-create: Say that --image & --release are mutually exclusive
https://github.com/containers/toolbox/pull/661
2021-01-07 20:08:01 +01:00
Debarshi Ray
88f2916822 profile.d: Restore compatibility with Z shell
Otherwise, every zsh instance was running into:
  zsh: #: command not found...

Fallout from dcdfa3a1f5

https://github.com/containers/toolbox/pull/660
2021-01-07 20:03:56 +01:00
Kan Li
f850f1efa4 pkg/utils, sh: Pass the USER environment variable to the container
The USER environment variable is set in different ways on different
operating system distributions. It's usually set when logging into a
new user session, but thereafter it may or may not get propagated into
new instances of a shell depending on how it's getting set. eg.,
Fedora sets USER in /etc/profile, but Ubuntu doesn't. This means that
shells running on a Fedora host and a Fedora toolbox container will
automatically have the USER environment variable set. However, it's
only available on Ubuntu hosts, but not on Ubuntu toolbox containers.

Passing the USER environment variable to the container, if it's set on
the host, will avoid such inconsistencies in the environment.

https://github.com/containers/toolbox/pull/609
2021-01-07 15:42:27 +01:00
Debarshi Ray
f92f2182a3 Prepare 0.0.98 2021-01-05 17:59:07 +01:00
Debarshi Ray
d231919f54 cmd/initContainer: Unbreak 'enter' on hosts without a /etc/localtime
It's not mandatory to have a /etc/localtime. If it's absent then it
means that the UTC timezone is being used. One such example of an
operating system is Fedora CoreOS.

Fallout from b9a0bd5f0c

https://github.com/containers/toolbox/pull/656
2021-01-05 00:44:33 +01:00
Ondřej Míchal
a0b59871ef build: Explicitly specify final binary name
In some environments, 'go build' uses the basename of the path passed
to the -o option for the final binary name instead of using the
project's name. eg., in Fedora's build system the binary will be called
src/src, not src/toolbox.

https://github.com/containers/toolbox/pull/584
2021-01-04 21:00:32 +01:00
Ondřej Míchal
1a5acddca2 Correctly check validity of container name
regexp.MatchString() only returns an error if the pattern can't be
parsed. In this case, the pattern is a constant string literal, so
unless there's a programming mistake, the pattern should always be
parsable and there should never be an error.

What really needs to be checked is whether the 'containerName' matched
the pattern or not. That's indicated by the bool return value
'matched'.

https://github.com/containers/toolbox/pull/639
2020-12-27 00:36:59 +01:00
Ondřej Míchal
467492619a cmd/create: Make options --image and --release mutually exclusive
... because that's what they inherently are.

https://github.com/containers/toolbox/pull/637
2020-12-26 23:33:08 +01:00
Ondřej Míchal
db448ed9ce cmd: Remove periods at the end of flag descriptions
Most tools (e.g. git, podman, skopeo, buildah, coreutils, etc.) do not
put periods at the end of descriptions of flags. Let's not deviate :).

https://github.com/containers/toolbox/pull/636
2020-12-26 22:24:53 +01:00
Debarshi Ray
a05830893a playbooks: Don't use a separate file to pull the images
The Ansible playbooks are small enough as they are. Splitting things
across too many files makes it harder to remember which file does what.

https://github.com/containers/toolbox/pull/653
2020-12-21 16:41:17 +01:00
Juanje Ojeda
cf256870ce playbooks: Improve how 'systemd-tmpfiles --create' is invoked
The most important bit is the use of the 'creates' parameter of the
'command' module [1] because it conditionalizes the invocation of
'systemd-tmpfiles' on the presence of /run/media and self-documents its
purpose.

[1] https://docs.ansible.com/ansible/2.4/command_module.html

https://github.com/containers/toolbox/pull/652
2020-12-21 15:01:38 +01:00
Francis Laniel
48fb219ffe Make coredumpctl(1) 'dump' and 'debug' work inside toolbox containers
https://github.com/containers/toolbox/issues/543
2020-12-18 23:38:37 +01:00
Debarshi Ray
969e8c17ed cmd/run: Notify the terminal about the real UID of 'toolbox enter'
This will let GNOME Terminal handle toolbox(1) running as root, by not
trying to preserve the current toolbox container if it's running as
root. This is similar to how terminals don't preserve the current
working directory for interactive shells running as root.

This needs a VTE that supports the UID parameter in the OSC 777 escape
sequence, as given below:
  OSC 777 ; container ; push ; NAME ; RUNTIME ; UID BEL
  OSC 777 ; container ; push ; NAME ; RUNTIME ; UID ST
  OSC 777 ; container ; pop ; NAME ; RUNTIME ; UID BEL
  OSC 777 ; container ; pop ; NAME ; RUNTIME ; UID ST

https://github.com/containers/toolbox/pull/649
2020-12-16 22:23:07 +01:00
Debarshi Ray
0af82ab339 playbooks/fedora-33: Fix the image URLs by adding the version suffix
The system tests for Fedora 33 were failing:
  not ok 21 Remove all images (2 should be present; --force should not
    be necessary)
  # (from function `is' in file test/system/helpers.bash, line 287,
  #  in test file test/system/302-rmi.bats, line 7)
  #   `is "$output" "" "The output should be empty"' failed
  # $ /usr/local/bin/toolbox rmi --all
  # Error: image
    3ac100502d2123aff1cf6314760c7a89c55108b8de6ea3c10ddc79a1479f0fca
    has dependent children
  # Error: image
    4a6adf1f2a96adf5ea0c02b61f9fa574306f77fc522f39c2ce6bb164daead882
    has dependent children
  # #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  # #|     FAIL: The output should be empty
  # #| expected: '[no output]'
  # #|   actual: 'Error: image
    3ac100502d2123aff1cf6314760c7a89c55108b8de6ea3c10ddc79a1479f0fca
    has dependent children'
  # #|         > 'Error: image
    4a6adf1f2a96adf5ea0c02b61f9fa574306f77fc522f39c2ce6bb164daead882
    has dependent children'
  # #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Fallout from ff4e4905da

https://github.com/containers/toolbox/pull/642
2020-12-02 18:45:01 +01:00
Debarshi Ray
dcdfa3a1f5 profile.d: Don't leak all the os-release fields into the shell
All the fields defined in /usr/lib/os-release were being injected into
the shell as environment variables. This is unintentional. Some of the
variables have relatively generic names, and having them in the
environment can lead to unexpected surprises.

Fallout from c6e37cdef3

https://github.com/containers/toolbox/pull/623
2020-11-17 00:30:29 +01:00
Fabiano Fidêncio
f6985abf70 images: Add nss-mdns to all images
The nss-mdns plugin for the GNU Name Service Switch (or NSS)
functionality of the GNU C Library is necessary to resolve the .local
mDNS domain. The plugin talks to the Avahi daemon running on the host
to resolve the names.

https://github.com/containers/toolbox/issues/209

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-11-15 22:50:09 +01:00
Fabiano Fidêncio
29c155f1ac cmd/create: Give access to Avahi to resolve the .local mDNS domain
https://github.com/containers/toolbox/issues/209

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-11-15 22:46:16 +01:00