cockpit/bots/images/scripts/continuous-atomic.setup

73 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# This file is part of Cockpit.
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
set -ex
# The docker pool should grow automatically as needed, but we grow it
# explicitly here anyway. This is hopefully more reliable.
# HACK: docker falls over regularly, print its log if it does
systemctl start docker || journalctl -u docker
lvresize atomicos/root -l+50%FREE -r
if lvs atomicos/docker-pool 2>/dev/null; then
lvresize atomicos/docker-pool -l+100%FREE
elif lvs atomicos/docker-root-lv; then
lvresize atomicos/docker-root-lv -l+100%FREE
fi
# Get the centos cockpit/ws image
docker pull registry.centos.org/cockpit/ws:latest
docker tag registry.centos.org/cockpit/ws cockpit/ws
# docker images that we need for integration testing
/var/lib/testvm/docker-images.setup
# Configure core dumps
echo "kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e" > /etc/sysctl.d/50-coredump.conf
# Download the libssh RPM plus dependencies which we'll use for
# package overlay. The only way to do this is via a container
. /etc/os-release
REPO="updates"
if [ "$ID" = "rhel" ]; then
subscription-manager repos --enable rhel-7-server-extras-rpms
REPO="rhel-7-server-extras-rpms"
ID="rhel7"
fi
docker run --rm --volume=/etc/yum.repos.d:/etc/yum.repos.d:z --volume=/root/rpms:/tmp/rpms:rw,z "$ID:$VERSION_ID" /bin/sh -cex "yum install -y findutils createrepo_c && yum install -y --downloadonly --enablerepo=$REPO libssh && find /var -name '*.rpm' | while read rpm; do mv -v \$rpm /tmp/rpms; done; createrepo_c /tmp/rpms"
rm -f /etc/yum.repos.d/*
cat >/etc/yum.repos.d/deps.repo <<EOF
[deps]
baseurl=file:///root/rpms
enabled=1
EOF
# Switch to continuous stream
ostree remote add --set=gpg-verify=false centos-atomic-continuous https://ci.centos.org/artifacts/sig-atomic/rdgo/centos-continuous/ostree/repo/
rpm-ostree rebase centos-atomic-continuous:centos-atomic-host/7/x86_64/devel/continuous
ostree checkout centos-atomic-continuous:centos-atomic-host/7/x86_64/devel/continuous /var/local-tree
# reduce image size
/var/lib/testvm/zero-disk.setup
# Prevent SSH from hanging for a long time when no external network access
echo 'UseDNS no' >> /etc/ssh/sshd_config
# Final tweaks
rm -rf /var/log/journal/*