#!/bin/bash set -ex # Disable device renaming for predictable names between different qemus grubby --update-kernel=ALL --args="net.ifnames=0 biosdevname=0" # HACK - virt-resize might not be able to resize our xfs rootfs, # depending on how it was compiled and which plugins are installed, # and will just silently not do it. So we do it here. # xfs_growfs / df -h / echo foobar | passwd --stdin root # We install all dependencies of the cockpit packages since we want # them to not spontaneously change from one test run to the next when # the distribution repository is updated. # COCKPIT_DEPS="\ atomic \ device-mapper-multipath \ docker \ etcd \ glib-networking \ json-glib \ kexec-tools \ kubernetes \ libssh \ libvirt \ libvirt-client \ NetworkManager-team \ PackageKit \ pcp \ pcp-libs \ qemu \ realmd \ selinux-policy-targeted \ setroubleshoot-server \ sos \ storaged \ storaged-lvm2 \ storaged-iscsi \ subscription-manager \ tuned \ virt-install \ " # We also install the packages necessary to join a FreeIPA domain so # that we don't have to go to the network during a test run. # IPA_CLIENT_PACKAGES="\ freeipa-client \ oddjob \ oddjob-mkhomedir \ sssd \ " TEST_PACKAGES="\ systemtap-runtime-virtguest \ valgrind \ gdb \ targetcli \ " rm -rf /etc/sysconfig/iptables maybe() { if type "$1" >/dev/null 2>&1; then "$@"; fi; } # For the D-Bus test server maybe firewall-cmd --permanent --add-port 8765/tcp echo 'NETWORKING=yes' > /etc/sysconfig/network useradd -c Administrator -G wheel admin echo foobar | passwd --stdin admin dnf config-manager --set-enabled updates-testing dnf $DNF_OPTS -y upgrade dnf $DNF_OPTS -y install $TEST_PACKAGES $COCKPIT_DEPS $IPA_CLIENT_PACKAGES # Prepare for building dnf $DNF_OPTS -y install mock dnf-plugins-core rpm-build useradd -c Builder -G mock builder # Enable updates-testing in mock echo "config_opts['yum.conf'] += '[updates-testing]\nenabled=1'" >>/etc/mock/default.cfg srpm=$(/var/lib/testvm/make-srpm $TEST_SOURCE) # HACK - mock --installdeps is broken, it seems that it forgets to # copy the source rpm to a location that dnf can actually access. A # workaround is to pass "--no-bootstrap-chroot". # # When you remove this hack, also remove it in fedora-testing.install. # # https://bugzilla.redhat.com/show_bug.cgi?id=1447627 su builder -c "/usr/bin/mock --no-bootstrap-chroot --verbose --installdeps \"$PWD/$srpm\"" # HACK: docker fails without /etc/resolv.conf # https://bugzilla.redhat.com/show_bug.cgi?id=1448331 mkdir -p /etc/systemd/system/docker.service.d printf "[Service]\nExecStartPre=/bin/sh -c 'echo -n >> /etc/resolv.conf'\n" > /etc/systemd/system/docker.service.d/resolv.conf systemctl daemon-reload # HACK: docker falls over regularly, print its log if it does systemctl start docker || journalctl -u docker # Setup basics for building images docker build -t cockpit/base /var/tmp/cockpit-base # Configure kubernetes /var/lib/testvm/kubernetes.setup # docker images that we need for integration testing /var/lib/testvm/docker-images.setup # HACK: https://bugzilla.redhat.com/show_bug.cgi?id=1341829 # SELinux breaks coredumping on fedora-25 printf '(allow init_t domain (process (rlimitinh)))\n' > domain.cil semodule -i domain.cil # reduce image size dnf clean all /var/lib/testvm/zero-disk.setup ln -sf ../selinux/config /etc/sysconfig/selinux printf "SELINUX=enforcing\nSELINUXTYPE=targeted\n" > /etc/selinux/config # Prevent SSH from hanging for a long time when no external network access echo 'UseDNS no' >> /etc/ssh/sshd_config touch /.autorelabel # Audit events to the journal rm -f '/etc/systemd/system/multi-user.target.wants/auditd.service' rm -rf /var/log/audit/