-
Notifications
You must be signed in to change notification settings - Fork 44
/
testing_using_container.sh
executable file
·66 lines (53 loc) · 2.02 KB
/
testing_using_container.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Run checked-out Agama in a podman container.
# This is meant to be run from a working copy of the git repo.
# It uses the systemsmanagement:Agama:Devel/agama-testing image as
# a platform and runs /setup.sh
#
# Details:
# - container name: agama
# - SSL port is exposed at https://localhost:10443 so that web UI works
# - 'WITH_RUBY_DBUS=1 $0' will prefer ../ruby-dbus to any ruby-dbus.gem
set -x
set -eu
# https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/agama-testing
CIMAGE=registry.opensuse.org/systemsmanagement/agama/devel/containers/opensuse/agama-testing:latest
# rename this if you test multiple things
CNAME=agama
test -f service/agama-yast.gemspec || { echo "You should run this from a git checkout of Agama"; exit 1; }
# destroy the previous instance, can fail if there is no previous instance
podman stop ${CNAME?} || : no problem if there was nothing to stop
podman rm ${CNAME?} || : no problem if there was nothing to remove
# Update our image
podman pull ${CIMAGE?}
# Optionally use a git version of ruby-dbus
# because Agama pushes its limits so it's better
# to set up for easy testing
MORE_VOLUMES=()
if [ "${WITH_RUBY_DBUS-}" = 1 ]; then
MORE_VOLUMES=(-v ../ruby-dbus:/checkout-ruby-dbus)
fi
podman run --name ${CNAME?} \
--privileged --detach \
-v .:/checkout \
${MORE_VOLUMES[@]} \
-p 10443:443 \
${CIMAGE?}
# shortcut for the following
CEXEC="podman exec ${CNAME?} bash -c"
# Set it up
# but continue in case of failure, the remaining steps (password and shell)
# are useful even then
${CEXEC?} "cd /checkout && ./setup.sh || true"
echo "Set the Agama (root) password:"
podman exec -it ${CNAME?} passwd
set +x
echo "agama-web-server forwarded to https://localhost:10443/"
echo "To attach again to the Agama container run:"
echo " podman exec --tty --interactive ${CNAME?} bash"
echo "To stop and remove the Agama container run:"
echo " podman stop ${CNAME?}"
echo " podman rm ${CNAME?}"
set -x
# Interactive shell in the container
podman exec --tty --interactive ${CNAME?} bash