Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containers/ws: Install our other Cockpit pages #21117

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions containers/ws/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ OSVER=$(. /etc/os-release && echo "$VERSION_ID")
INSTALLROOT=/build
INSTALL="dnf install -y --installroot=$INSTALLROOT --releasever=$OSVER --setopt=install_weak_deps=False"

# keep in sync with test/ostree.install
PACKAGES="
kdump
networkmanager
packagekit
selinux
sosreport
storaged
system
"

dnf install -y 'dnf-command(download)' cpio
$INSTALL coreutils-single util-linux-core sed sscg python3 openssh-clients

Expand All @@ -20,15 +31,14 @@ unpack() {
# -system and -networkmanager are only for beibooting; don't install their dependencies
if [ -n "$rpm" ]; then
$INSTALL /container/rpms/cockpit-ws-*$OSVER.*$arch.rpm /container/rpms/cockpit-bridge-*$OSVER.*$arch.rpm
for rpm in /container/rpms/cockpit-system-*$OSVER.*$arch.rpm \
/container/rpms/cockpit-networkmanager-*$OSVER.*$arch.rpm; do
unpack $rpm
for rpm in $PACKAGES; do
unpack /container/rpms/cockpit-$rpm-*$OSVER.*$arch.rpm
done
else
$INSTALL cockpit-ws cockpit-bridge
dnf download cockpit-networkmanager cockpit-system
for rpm in cockpit-networkmanager*.rpm cockpit-system*.rpm; do
unpack $rpm
for rpm in $PACKAGES; do
dnf download cockpit-$rpm
unpack cockpit-$rpm-*.rpm
done
fi

Expand Down
5 changes: 5 additions & 0 deletions pkg/apps/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"conditions": [
{"path-exists": "/usr/bin/cockpit-bridge"},
{"path-exists": "/lib/systemd/system/packagekit.service"},
{"path-not-exists": "/sysroot/ostree"}
],
"tools": {
"index": {
"label": "Applications",
Expand Down
19 changes: 13 additions & 6 deletions test/ostree.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/sh
set -eu

# keep in sync with containers/ws/install.sh
PACKAGES="
kdump
networkmanager
packagekit
selinux
sosreport
storaged
system
"

cd /var/tmp/

# install/upgrade RPMs that apply to OSTree
Expand All @@ -9,12 +20,8 @@ rpm-ostree install --cache-only cockpit-bridge-*.rpm \
cockpit-networkmanager-*.rpm cockpit-system-*.rpm cockpit-tests-*.rpm

# update cockpit packages and install scripts in the container
for rpm in /var/tmp/cockpit-ws-*.rpm \
/var/tmp/cockpit-bridge-*.rpm \
/var/tmp/cockpit-networkmanager-*.rpm \
/var/tmp/cockpit-system-*.rpm \
/var/tmp/cockpit-tests-*.rpm; do
rpm2cpio "$rpm" | cpio -i --make-directories --directory=/var/tmp/install
for rpm in ws bridge tests $PACKAGES; do
rpm2cpio /var/tmp/cockpit-$rpm-*.rpm | cpio -i --make-directories --directory=/var/tmp/install
done
podman run --name build-cockpit -i \
-v /var/tmp/:/run/build:Z \
Expand Down
14 changes: 14 additions & 0 deletions test/verify/check-apps
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,20 @@ This <is <not XML.
b.wait_not_present(".pf-v5-c-empty-state")
b.wait_visible(".app-list .pf-v5-c-data-list__item-row:contains('Summary 2')")

def testNoPackageKit(self):
b = self.browser
m = self.machine

m.execute("systemctl stop packagekit")
system_service = m.execute("systemctl show -p FragmentPath packagekit.service | cut -f2 -d=").strip()
m.execute(f"mv {system_service} {system_service}.disabled")
self.addCleanup(m.execute, f"mv {system_service}.disabled {system_service}")

self.assertNotIn("\napps", m.execute("cockpit-bridge --packages"))
self.login_and_go(None)
b.wait_in_text("#host-apps", "Terminal")
self.assertNotIn("Applications", b.text("#host-apps"))


if __name__ == '__main__':
testlib.test_main()
12 changes: 12 additions & 0 deletions test/verify/check-ws-bastion
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class TestWsBastionContainer(testlib.MachineCase):

b.wait_visible('#content')
b.wait_text('#current-username', 'admin')
# Our test VM only pre-installs -system and -networkmanager
b.wait_in_text("#host-apps", "Overview")
b.wait_in_text("#host-apps", "Networking")
self.assertNotIn("Kernel dump", b.text("#host-apps"))
# runs the ssh target's bridge (no beiboot)
m.execute("pgrep -f /usr/bin/[c]ockpit-bridge")
b.logout()
Expand All @@ -89,6 +93,14 @@ class TestWsBastionContainer(testlib.MachineCase):
b.try_login()
b.wait_visible('#content')
m.execute("pgrep -f '[p]ython3 -ic # cockpit-bridge'")
# beiboot mode has extra included pages
b.wait_in_text("#host-apps", "Overview")
b.wait_in_text("#host-apps", "Networking")
b.wait_in_text("#host-apps", "Kernel dump")
b.wait_in_text("#host-apps", "SELinux")
# but Storage and Applications are hidden due to failing manifest conditions
self.assertNotIn("Storage", b.text("#host-apps"))
self.assertNotIn("Applications", b.text("#host-apps"))
b.logout()

def testKnownHosts(self):
Expand Down