-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support container provisioner in toolbox
For Fedora Silverblue users it is common to run podman via `flatpak-spawn --host` which runs podman on the host system itself. This requires to pass the toolbox container name when running `podman cp` to correctly copy stuff from the toolbox container, where `tmt` is installed to the provisioned container. Fixes #1020 Signed-off-by: Miroslav Vadkerti <[email protected]>
- Loading branch information
Showing
4 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
summary: Test container provisioner in toolbox | ||
description: | ||
Make sure that container provisioner works well | ||
in a toolbox container. | ||
tag+: | ||
- provision-only | ||
- provision-container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
flatpak-spawn --host podman "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
rlJournalStart | ||
rlPhaseStartSetup | ||
rlRun "toolbox_container_name=\$(uuidgen)" 0 "Generate toolbox container name" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Create toolbox container" | ||
rlRun "toolbox create -y $toolbox_container_name" | ||
rlPhaseEnd | ||
|
||
toolbox_run() { | ||
toolbox run --container "$toolbox_container_name" "$@" | ||
} | ||
|
||
if env | grep -q PACKIT_COPR_PROJECT; then | ||
rlPhaseStartTest "Install tmt in from copr repository" | ||
TMT_COMMAND="tmt" | ||
rlRun "toolbox_run dnf -y install dnf-plugins-core" | ||
rlRun "toolbox_run dnf -y copr enable $PACKIT_COPR_PROJECT" | ||
rlRun "toolbox_run dnf -y install tmt-provision-container" | ||
rlPhaseEnd | ||
else | ||
rlPhaseStartTest "Install hatch, expecting local execution" | ||
TMT_COMMAND="hatch run dev:tmt" | ||
rlRun "toolbox_run dnf -y install hatch" | ||
rlPhaseEnd | ||
fi | ||
|
||
rlPhaseStartTest "Print tmt version installed in toolbox" | ||
rlRun "toolbox_run $TMT_COMMAND --version" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Add podman wrapper" | ||
rlRun "podman cp podman_wrapper $toolbox_container_name:/usr/bin/podman" | ||
rlRun "toolbox_run podman --version" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Verify container provisioner works from toolbox" | ||
rlRun -s "toolbox_run tmt run -a -vvv provision -h container execute -h tmt -s 'echo hello from container'" | ||
rlAssertGrep "content: hello from container" $rlRun_LOG | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "toolbox rm -f $toolbox_container_name" 0 "Remove toolbox container" | ||
rlPhaseEnd | ||
rlJournalEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters