3 # NOTE: This file takes two jobs from the OpenStack infra and
4 # puts them here. See here:
6 # https://github.com/openstack-infra/project-config/blob/master/jenkins/jobs/networking-odl.yaml
8 export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
10 # *SIGH*. This is required to get lsb_release
11 sudo yum -y install redhat-lsb-core indent python-testrepository
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'
19 # We need to install some scripts from openstack-infra/project-config
21 echo "Setting up infra scripts"
22 sudo mkdir -p /usr/local/jenkins/slave_scripts
23 git clone https://git.openstack.org/openstack-infra/project-config
25 sudo cp jenkins/scripts/subunit2html.py /usr/local/jenkins/slave_scripts
27 # Save existing WORKSPACE
28 SAVED_WORKSPACE=$WORKSPACE
29 export WORKSPACE=~/workspace
33 # This is the job which checks out devstack-gate
34 if [[ ! -e devstack-gate ]]; then
35 echo "Cloning devstack-gate"
36 git clone https://git.openstack.org/openstack-infra/devstack-gate
38 echo "Fixing devstack-gate git remotes"
40 git remote set-url origin https://git.openstack.org/openstack-infra/devstack-gate
43 if ! git clean -x -f ; then
48 git reset --hard remotes/origin/master
49 if ! git clean -x -f ; then
56 # Set the pieces we want to test
57 if [ "$GERRIT_PROJECT" == "openstack/neutron" ]; then
58 ZUUL_PROJECT=$GERRIT_PROJECT
59 ZUUL_BRANCH=$GERRIT_REFSPEC
60 elif [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then
61 ZUUL_PROJECT=$GERRIT_PROJECT
62 ZUUL_BRANCH=$GERRIT_REFSPEC
65 echo "Setting environment variables"
67 # Enable ODL debug logs and set memory parameters
68 DEVSTACK_LOCAL_CONFIG=""
69 DEVSTACK_LOCAL_CONFIG+="ODL_NETVIRT_DEBUG_LOGS=True;"
70 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MIN_MEM=512m;"
71 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_MEM=784m;"
72 DEVSTACK_LOCAL_CONFIG+="ODL_JAVA_MAX_PERM_MEM=784m;"
74 # Set ODL_URL_PREFIX if "nexus proxy" is provided
75 if [ -n "$ODLNEXUSPROXY" ] ; then
76 DEVSTACK_LOCAL_CONFIG+="ODL_URL_PREFIX=$ODLNEXUSPROXY;"
79 ## # Trim down the boot wait time
80 ## export ODL_BOOT_WAIT=30
82 # And this runs devstack-gate
83 export PYTHONUNBUFFERED=true
84 export DEVSTACK_GATE_TIMEOUT=120
85 export DEVSTACK_GATE_NEUTRON=1
86 export DEVSTACK_GATE_TEMPEST=1
87 export BRANCH_OVERRIDE=master
88 if [ "$BRANCH_OVERRIDE" != "default" ] ; then
89 export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
91 # Because we are testing a non standard project, add
92 # our project repository. This makes zuul do the right
93 # reference magic for testing changes.
94 export PROJECTS="stackforge/networking-odl $PROJECTS"
95 # Note the actual url here is somewhat irrelevant because it
96 # caches in nodepool, however make it a valid url for
97 # documentation purposes.
98 if [ "$GERRIT_PROJECT" == "stackforge/networking-odl" ]; then
99 export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC"
101 export DEVSTACK_LOCAL_CONFIG+="enable_plugin networking-odl https://git.openstack.org/stackforge/networking-odl"
105 # Keep localrc to be able to set some vars in pre_test_hook
106 export KEEP_LOCALRC=1
108 # Unset this because it's set by the underlying Jenkins node ...
111 # Only run certain tempest tests
112 export DEVSTACK_GATE_TEMPEST_REGEX="tempest.api.network.test_networks_negative tempest.api.network.test_networks.NetworksTestJSON"
114 # Specifically set the services we want
115 #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
117 echo "Copying devstack-vm-gate-wrap.sh"
118 cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
119 echo "Running safe-devstack-vm-gate-wrap.sh"
120 ./safe-devstack-vm-gate-wrap.sh
121 # Save the return value so we can exit with this
125 OS_WORKSPACE=$WORKSPACE
126 export WORKSPACE=$SAVED_WORKSPACE
129 cp -r $OS_WORKSPACE/logs $WORKSPACE
130 cp -a /opt/stack/new/logs/q-odl-karaf* $WORKSPACE/logs
131 mkdir -p $WORKSPACE/logs/opendaylight
132 cp -a /opt/stack/new/opendaylight/distribution*/etc $WORKSPACE/logs/opendaylight
133 # Unzip the logs to make them easier to view
134 gunzip $WORKSPACE/logs/*.gz