[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Ovirt-devel] [PATCH] [ovirt-appliance] autobuild.sh



---
 autobuild.sh |  101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100755 autobuild.sh

diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..0228fde
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+#oVirt appliance autobuild script
+#
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+set -e
+set -v
+
+ME=$(basename "$0")
+warn() { printf "$ME: $ \n" >&2; }
+die() { warn "$@"; exit 1; }
+
+test -n "$1" && RESULTS=$1 || RESULTS=results.log
+
+SSHKEY=~/.ssh/id_autobuild
+remote_target="root 192 168 50 2"
+ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \
+             -o UserKnownHostsFile=/dev/null $remote_target"
+scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+
+# implant Autobuild SSH key into appliance
+if [ ! -r $SSHKEY ]; then
+   mkdir -p $(dirname "$SSHKEY")
+   ssh-keygen -q -t rsa -N "" -f $SSHKEY
+fi
+
+cat >> common-post.ks << KS
+mkdir -p /root/.ssh
+chmod 700 /root/.ssh
+cat > /root/.ssh/authorized_keys << \EOF
+$(ssh-keygen -y -f $SSHKEY)
+EOF
+chmod 600 /root/.ssh/authorized_keys
+KS
+
+# move sshd to start last (after ovirt*first-run scripts)
+cat >> common-post.ks << \KS
+mkdir -p /etc/chkconfig.d
+cat > /etc/chkconfig.d/sshd << \EOF
+# chkconfig: 2345 99 01
+EOF
+chkconfig --override sshd
+KS
+
+echo "Running oVirt Appliance Autobuild"
+make publish
+
+# make resulting rpms publically available
+ln -f rpm-build/*.rpm $AUTOBUILD_PACKAGE_ROOT/rpm
+
+# install the rpm, create appliance, and start the appliance / node3
+rpm -qi ovirt-appliance
+if [ "$?" -eq 0 ]; then
+  rpm -e ovirt-appliance
+fi
+rpm -ivh rpm-build/ovirt-appliance-0.92-1.fc9.x86_64.rpm
+/usr/sbin/create-ovirt-appliance
+virsh start node3 \
+  || die "virsh start failed, node3 not started"
+virsh start ovirt-appliance \
+  || die "virsh start failed, appliance not started"
+
+# wait until started
+for i in $(seq 1 60); do
+    $ssh_cmd exit && break
+    sleep 10
+done
+
+SELENIUM_RB=/var/selenium/selenium.rb
+if [ -f $SELENIUM_RB ]; then
+    $scp_cmd $SELENIUM_RB $remote_target:/usr/share/ovirt-server/test/
+else
+    echo "$SELENIUM_RB not found, will not run interface tests"
+fi
+
+echo "Running the server tests"
+$ssh_cmd \
+  "sed -i \"s/#RAILS_ENV=production/RAILS_ENV=test/g\" /etc/sysconfig/ovirt-rails && \
+   sed -i \"s/development/test/\" /usr/share/ovirt-server/dutils/active_record_env.rb && \
+   service ovirt-taskomatic restart && \
+   service ovirt-mongrel-rails restart && \
+   service httpd restart && \
+   curl -i http://management.priv.ovirt.org/ovirt/ | \
+      grep 'HTTP/1.1 200 OK' && \
+   cd /usr/share/ovirt-server && rake test" > "$RESULTS" 2>&1 \
+   || die "server tests failed"
-- 
1.5.4.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]