X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fovsdb%2Finclude-raw-openstack-ci.sh;h=feabea0b2fc6d20315e88e4eb82eb622e8923bba;hb=f1c447d2e43c59a2587e83d288b1d35741b16a2f;hp=b7be339a8a4b63230646958b82320d882380a01f;hpb=bef6b5bdc92266d1ff101d5bce6c1d02f61ee706;p=releng%2Fbuilder.git diff --git a/jjb/ovsdb/include-raw-openstack-ci.sh b/jjb/ovsdb/include-raw-openstack-ci.sh index b7be339a8..feabea0b2 100644 --- a/jjb/ovsdb/include-raw-openstack-ci.sh +++ b/jjb/ovsdb/include-raw-openstack-ci.sh @@ -1,214 +1,148 @@ #!/bin/bash - -export PATH=$PATH:/bin:/sbin:/usr/sbin -export DEVSTACKDIR=$WORKSPACE/$BUILD_TAG -mkdir $DEVSTACKDIR -cd $DEVSTACKDIR - -cat < firewall.sh -sudo iptables -I INPUT -p tcp --dport 5672 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 9292 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 9696 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 35357 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 6080 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 8773 -j ACCEPT -sudo iptables -I INPUT -p udp --dport 8472 -j ACCEPT -sudo iptables -I INPUT -p udp --dport 4789 -j ACCEPT - -# For the client -sudo iptables -I INPUT -p tcp --dport 5000 -j ACCEPT -sudo iptables -I INPUT -p tcp --dport 8774 -j ACCEPT - -# For ODL -sudo iptables -I INPUT -p tcp --dport 8080 -j ACCEPT -EOL -chmod +x firewall.sh - -env -cat $DEVSTACKDIR/firewall.sh -$DEVSTACKDIR/firewall.sh - -# FIXME: update version of pip being used here -curl -O https://pypi.python.org/packages/source/p/pip/pip-6.0.8.tar.gz -tar xvfz pip-6.0.8.tar.gz -cd pip-6.0.8 -sudo -E python setup.py install -sudo pip install testtools - -sudo mkdir -p /opt/stack -sudo chown $(whoami) /opt/stack -sudo chmod 755 /opt/stack -cd /opt/stack - -# Workaround for bug: -# https://bugs.launchpad.net/devstack/+bug/1276297 -sudo rm -rf /usr/lib/python2.7/site-packages/oslo* - -# Workaround for "keystone not found" issues -sudo rm -rf /usr/lib/python2.7/site-packages/*client* - -# Make sure keystonemiddleware is up to date -sudo pip install --upgrade keystonemiddleware - -# Workaround: Pull neutron first -cd /opt/stack -git clone -q git://git.openstack.org/openstack/neutron.git -cd neutron -sudo python ./setup.py -q install - -cd $DEVSTACKDIR - -sudo yum -y install qemu libvirt-daemon -git clone https://github.com/openstack-dev/devstack.git -cd devstack - -#### -# Specify changeset being worked on if it's networking-odl -#### -if [ "$GERRIT_PROJECT" == "stackforge/networking-odl" ]; then - cat < local.conf -[[local|localrc]] -enable_plugin networking-odl https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC -EOLLC +# +# NOTE: This file takes two jobs from the OpenStack infra and +# puts them here. See here: +# +# https://github.com/openstack-infra/project-config/blob/master/jenkins/jobs/networking-odl.yaml + +export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin + +# *SIGH*. This is required to get lsb_release +sudo yum -y install redhat-lsb-core indent python-testrepository + +echo "Making /opt/stack/new jenkins:jenkins" +sudo /usr/sbin/groupadd jenkins +sudo mkdir -p /opt/stack/new +sudo chown -R jenkins:jenkins /opt/stack/new +sudo bash -c 'echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers' + +# We need to install some scripts from openstack/os-testr project +cd ~ +echo "Setting up infra scripts" +sudo mkdir -p /usr/local/jenkins/slave_scripts +git clone https://github.com/openstack/os-testr.git +cd os-testr/os_testr +sudo cp subunit2html.py /usr/local/jenkins/slave_scripts + +# Save existing WORKSPACE +SAVED_WORKSPACE=$WORKSPACE +export WORKSPACE=~/workspace +mkdir -p $WORKSPACE +cd $WORKSPACE + +# This is the job which checks out devstack-gate +if [[ ! -e devstack-gate ]]; then + echo "Cloning devstack-gate" + git clone https://git.openstack.org/openstack-infra/devstack-gate else - cat < local.conf -[[local|localrc]] -enable_plugin networking-odl https://github.com/stackforge/networking-odl -EOLLC + echo "Fixing devstack-gate git remotes" + cd devstack-gate + git remote set-url origin https://git.openstack.org/openstack-infra/devstack-gate + git remote update + git reset --hard + if ! git clean -x -f ; then + sleep 1 + git clean -x -f + fi + git checkout master + git reset --hard remotes/origin/master + if ! git clean -x -f ; then + sleep 1 + git clean -x -f + fi + cd .. fi -cat <> local.conf -LOGFILE=stack.sh.log -SCREEN_LOGDIR=/opt/stack/data/log -VERBOSE=True -LOG_COLOR=False -RECLONE=yes -GIT_TIMEOUT=0 -GIT_BASE=https://git.openstack.org - -# Only uncomment the below two lines if you are running on Fedora -disable_service swift -disable_service rabbit -enable_service qpid -enable_service n-cpu -enable_service n-cond -disable_service n-net -enable_service q-svc -enable_service q-dhcp -enable_service q-l3 -enable_service q-meta -enable_service quantum -enable_service tempest - -API_RATE_LIMIT=False - -Q_PLUGIN=ml2 -Q_ML2_PLUGIN_MECHANISM_DRIVERS=logger,opendaylight -ENABLE_TENANT_TUNNELS=True - -ODL_MODE=allinone -ODL_NETVIRT_DEBUG_LOGS=True -ODL_MGR_IP=$(ip addr | grep inet | grep eth0 | awk -F" " '{print $2}'| sed -e 's/\/.*$//') -ODL_ARGS="-Xmx1024m -XX:MaxPermSize=512m" -ODL_BOOT_WAIT=90 - -VNCSERVER_LISTEN=0.0.0.0 - -HOST_NAME=$(hostname) -SERVICE_HOST_NAME=$(hostname) -HOST_IP=$(ip addr | grep inet | grep eth0 | awk -F" " '{print $2}'| sed -e 's/\/.*$//') -SERVICE_HOST=$(hostname) - -MYSQL_HOST=$(hostname) -RABBIT_HOST=$(hostname) -GLANCE_HOSTPORT=$(hostname):9292 -KEYSTONE_AUTH_HOST=$(hostname) -KEYSTONE_SERVICE_HOST=$(hostname) - -MYSQL_PASSWORD=mysql -RABBIT_PASSWORD=rabbit -QPID_PASSWORD=rabbit -SERVICE_TOKEN=service -SERVICE_PASSWORD=admin -ADMIN_PASSWORD=admin -EOLLC - -# Add Neutron specific config if required +# Set the pieces we want to test if [ "$GERRIT_PROJECT" == "openstack/neutron" ]; then - cat <> local.conf -NEUTRON_REPO=https://$GERRIT_HOST/$GERRIT_PROJECT -NEUTRON_BRANCH=$GERRIT_REFSPEC -EOLLC + ZUUL_PROJECT=$GERRIT_PROJECT + ZUUL_BRANCH=$GERRIT_REFSPEC +elif [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then + ZUUL_PROJECT=$GERRIT_PROJECT + ZUUL_BRANCH=$GERRIT_REFSPEC fi -cat local.conf +echo "Setting environment variables" + +# Enable ODL debug logs and set memory parameters +DEVSTACK_LOCAL_CONFIG="" +DEVSTACK_LOCAL_CONFIG+="ODL_NETVIRT_DEBUG_LOGS=True;" +DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MIN_MEM=512m;" +DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_MEM=784m;" +DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_PERM_MEM=784m;" -#### -# Clone the changeset being worked on if it's devstack -#### -if [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then - git fetch https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD +# Set ODL_URL_PREFIX if "nexus proxy" is provided +URL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org} +if [ -n "$ODLNEXUSPROXY" ] ; then + DEVSTACK_LOCAL_CONFIG+="ODL_URL_PREFIX=$ODLNEXUSPROXY;" fi -# Run devstack -./stack.sh - -if [ "$?" != "0" ]; then - echo "stack.sh failed" - # Copy logs off - mkdir -p $WORKSPACE/logs/devstack - mkdir -p $WORKSPACE/logs/opendaylight - cp -r /opt/stack/data/log/* $WORKSPACE/logs/devstack - cp -r $DEVSTACKDIR/devstack/stack.sh.log* $WORKSPACE/logs - cp -r $DEVSTACKDIR/devstack/local.conf $WORKSPACE/logs - cp -r /opt/stack/opendaylight/*/logs $WORKSPACE/logs/opendaylight - cp -r /opt/stack/opendaylight/*/data/log $WORKSPACE/logs/opendaylight - cp -r /opt/stack/opendaylight/*/etc $WORKSPACE/logs/opendaylight - tar cvzf $WORKSPACE/opendaylight-full-logs.tgz $WORKSPACE/logs - exit 1 +## # Trim down the boot wait time +## export ODL_BOOT_WAIT=30 + +# Use specific build, if asked to do so +if [ "${ODL_VERSION}" == "beryllium" ] ; then + DEVSTACK_LOCAL_CONFIG+="ODL_RELEASE=beryllium-snapshot-0.4.0;" +elif [ "${ODL_VERSION}" == "lithium" ] ; then + DEVSTACK_LOCAL_CONFIG+="ODL_RELEASE=lithium-snapshot-0.3.1;" +elif [ "${ODL_VERSION}" == "helium" ] ; then + DEVSTACK_LOCAL_CONFIG+="ODL_RELEASE=helium;" fi -# running tempest -if [[ -n ${BUILD_ID} ]]; then - cd /opt/stack/tempest +# And this runs devstack-gate +export PYTHONUNBUFFERED=true +export DEVSTACK_GATE_TIMEOUT=120 +export DEVSTACK_GATE_NEUTRON=1 +export DEVSTACK_GATE_TEMPEST=1 +export BRANCH_OVERRIDE=master +if [ "$BRANCH_OVERRIDE" != "default" ] ; then + export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE +fi +# Because we are testing a non standard project, add +# our project repository. This makes zuul do the right +# reference magic for testing changes. +export PROJECTS="openstack/networking-odl $PROJECTS" +# Note the actual url here is somewhat irrelevant because it +# caches in nodepool, however make it a valid url for +# documentation purposes. +if [ "$GERRIT_PROJECT" == "openstack/networking-odl" ]; then + export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC" +else + export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://git.openstack.org/openstack/networking-odl" +fi - # put all the info in the following file for processing later - log_for_review=odl_tempest_test_list.txt - echo "Running tempest tests:" > /tmp/${log_for_review} - echo "" >> /tmp/${log_for_review} - testr init > /dev/null 2>&1 || true - cmd="testr run tempest.api.network.test_networks" - echo "opendaylight-test:$ "${cmd} >> /tmp/${log_for_review} - ${cmd} >> /tmp/${log_for_review} - echo "" >> /tmp/${log_for_review} - echo "" >> /tmp/${log_for_review} +# Keep localrc to be able to set some vars in pre_test_hook +export KEEP_LOCALRC=1 - x=$(grep "id=" /tmp/${log_for_review}) - y="${x//[()=]/ }" - z=$(echo ${y} | awk '{print $3}' | sed 's/\,//g') +# Unset this because it's set by the underlying Jenkins node ... +unset GIT_BASE - #echo "x ($x) y ($y) z ($z)" +# By default, only run certain tempest tests +export DEVSTACK_GATE_TEMPEST_REGEX=${TEMPEST_REGEX:-"tempest.api.network.test_networks_negative tempest.api.network.test_networks.NetworksTestJSON"} - echo "List of tempest tests ran (id="${z}"):" >> /tmp/${log_for_review} - echo "" >> /tmp/${log_for_review} +# Specifically set the services we want +#OVERRIDE_ENABLED_SERVICES=q-svc,q-dhcp,q-l3,q-meta,quantum,key,g-api,g-reg,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-xvnc,n-cauth,h-eng,h-api,h-api-cfn,h-api-cw,rabbit,tempest,mysql - grep -ri successful .testrepository/${z} | awk '{ gsub(/\[/, "\ "); print $1 " " $2}' >> /tmp/${log_for_review} -fi +echo "Copying devstack-vm-gate-wrap.sh" +cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh +echo "Running safe-devstack-vm-gate-wrap.sh" +./safe-devstack-vm-gate-wrap.sh +# Save the return value so we can exit with this +DGRET=$? +# Restore WORKSPACE +OS_WORKSPACE=$WORKSPACE +export WORKSPACE=$SAVED_WORKSPACE -# Copy logs off -mkdir -p $WORKSPACE/logs/devstack -mkdir -p $WORKSPACE/logs/tempest +# Copy and display all the logs +cat /opt/stack/new/devstacklog* +ls /opt/stack/; ls /opt/stack/new; ls /opt/stack/new/opendaylight; +cp -r $OS_WORKSPACE/logs $WORKSPACE +cp -a /opt/stack/new/logs/screen-odl-karaf* $WORKSPACE/logs mkdir -p $WORKSPACE/logs/opendaylight -cp -r /opt/stack/tempest/tempest.log* $WORKSPACE/logs/tempest -cp -r /opt/stack/data/log/* $WORKSPACE/logs/devstack -cp -r /opt/stack/opendaylight/*/logs $WORKSPACE/logs/opendaylight -cp -r /opt/stack/opendaylight/*/data/log $WORKSPACE/logs/opendaylight -cp -r /opt/stack/opendaylight/*/etc $WORKSPACE/logs/opendaylight -cp -r /tmp/${log_for_review} $WORKSPACE/logs -cp -r /tmp/${log_for_review} $WORKSPACE -cp -r $DEVSTACKDIR/devstack/stack.sh.log* $WORKSPACE/logs -cp -r $DEVSTACKDIR/devstack/local.conf $WORKSPACE/logs -tar cvzf $WORKSPACE/opendaylight-full-logs.tgz $WORKSPACE/logs +cp -a /opt/stack/new/opendaylight/distribution*/etc $WORKSPACE/logs/opendaylight +# Unzip the logs to make them easier to view +gunzip $WORKSPACE/logs/*.gz + +exit $DGRET