Merge "Adding release test job for stable/helium"
[releng/builder.git] / jjb / ovsdb / include-raw-openstack-ci.sh
1 #!/bin/bash
2 #
3 # NOTE: This file takes two jobs from the OpenStack infra and
4 #       puts them here. See here:
5 #
6 # https://github.com/openstack-infra/project-config/blob/master/jenkins/jobs/networking-odl.yaml
7
8 export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
9
10 # *SIGH*. This is required to get lsb_release
11 sudo yum -y install redhat-lsb-core indent python-testrepository
12
13 echo "Making /opt/stack/new jenkins:jenkins"
14 sudo /usr/sbin/groupadd jenkins
15 sudo mkdir -p /opt/stack/new
16 sudo chown -R jenkins:jenkins /opt/stack/new
17 sudo bash -c 'echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'
18
19 # Save existing WORKSPACE
20 SAVED_WORKSPACE=$WORKSPACE
21 export WORKSPACE=~/workspace
22 mkdir -p $WORKSPACE
23 cd $WORKSPACE
24
25 # This is the job which checks out devstack-gate
26 if [[ ! -e devstack-gate ]]; then
27     echo "Cloning devstack-gate"
28     git clone https://git.openstack.org/openstack-infra/devstack-gate
29 else
30     echo "Fixing devstack-gate git remotes"
31     cd devstack-gate
32     git remote set-url origin https://git.openstack.org/openstack-infra/devstack-gate
33     git remote update
34     git reset --hard
35     if ! git clean -x -f ; then
36         sleep 1
37         git clean -x -f
38     fi
39     git checkout master
40     git reset --hard remotes/origin/master
41     if ! git clean -x -f ; then
42         sleep 1
43         git clean -x -f
44     fi
45     cd ..
46 fi
47
48 # Set the pieces we want to test
49 if [ "$GERRIT_PROJECT" == "openstack/neutron" ]; then
50     ZUUL_PROJECT=$GERRIT_PROJECT
51     ZUUL_BRANCH=$GERRIT_REFSPEC
52 elif [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then
53     ZUUL_PROJECT=$GERRIT_PROJECT
54     ZUUL_BRANCH=$GERRIT_REFSPEC
55 fi
56
57 echo "Setting environment variables"
58
59 # Enable ODL debug logs and set memory parameters
60 DEVSTACK_LOCAL_CONFIG=""
61 DEVSTACK_LOCAL_CONFIG+="ODL_NETVIRT_DEBUG_LOGS=True;"
62 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MIN_MEM=512m;"
63 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_MEM=784m;"
64 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_PERM_MEM=784m;"
65
66 # Set ODL_URL_PREFIX if "nexus proxy" is provided
67 if [ -n "$ODLNEXUSPROXY" ] ; then
68     DEVSTACK_LOCAL_CONFIG+="ODL_URL_PREFIX=$ODLNEXUSPROXY;"
69 fi
70
71 ## # Trim down the boot wait time
72 ## export ODL_BOOT_WAIT=30
73
74 # And this runs devstack-gate
75 export PYTHONUNBUFFERED=true
76 export DEVSTACK_GATE_TIMEOUT=120
77 export DEVSTACK_GATE_NEUTRON=1
78 export DEVSTACK_GATE_TEMPEST=1
79 export BRANCH_OVERRIDE=master
80 if [ "$BRANCH_OVERRIDE" != "default" ] ; then
81     export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
82 fi
83 # Because we are testing a non standard project, add
84 # our project repository. This makes zuul do the right
85 # reference magic for testing changes.
86 export PROJECTS="stackforge/networking-odl $PROJECTS"
87 # Note the actual url here is somewhat irrelevant because it
88 # caches in nodepool, however make it a valid url for
89 # documentation purposes.
90 if [ "$GERRIT_PROJECT" == "stackforge/networking-odl" ]; then
91     export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC"
92 else
93     export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://git.openstack.org/stackforge/networking-odl"
94 fi
95
96
97 # Keep localrc to be able to set some vars in pre_test_hook
98 export KEEP_LOCALRC=1
99
100 # Unset this because it's set by the underlying Jenkins node ...
101 unset GIT_BASE
102
103 # Only run certain tempest tests
104 export DEVSTACK_GATE_TEMPEST_REGEX="tempest.api.network.test_networks_negative tempest.api.network.test_networks.NetworksTestJSON"
105
106 # Specifically set the services we want
107 #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
108
109 echo "Copying devstack-vm-gate-wrap.sh"
110 cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
111 echo "Running safe-devstack-vm-gate-wrap.sh"
112 ./safe-devstack-vm-gate-wrap.sh
113 # Save the return value so we can exit with this
114 DGRET=$?
115
116 # Restore WORKSPACE
117 OS_WORKSPACE=$WORKSPACE
118 export WORKSPACE=$SAVED_WORKSPACE
119
120 # Copy all the logs
121 cp -r $OS_WORKSPACE/logs $WORKSPACE
122 cp -a /opt/stack/new/logs/q-odl-karaf* $WORKSPACE/logs
123 mkdir -p $WORKSPACE/logs/opendaylight
124 cp -a /opt/stack/new/opendaylight/distribution*/etc $WORKSPACE/logs/opendaylight
125 # Unzip the logs to make them easier to view
126 gunzip $WORKSPACE/logs/*.gz
127
128 exit $DGRET