Browse code

Merge pull request #192 from cloudbuilders/jenkins

Jenkins

Jesse Andrews authored on 2011/11/15 04:32:15
Showing 18 changed files
... ...
@@ -90,9 +90,10 @@ GUEST_CORES=${GUEST_CORES:-1}
90 90
 
91 91
 # libvirt.xml configuration
92 92
 NET_XML=$vm_dir/net.xml
93
+NET_NAME=${NET_NAME:-devstack-$GUEST_NETWORK}
93 94
 cat > $NET_XML <<EOF
94 95
 <network>
95
-  <name>devstack-$GUEST_NETWORK</name>
96
+  <name>$NET_NAME</name>
96 97
   <bridge name="stackbr%d" />
97 98
   <forward/>
98 99
   <ip address="$GUEST_GATEWAY" netmask="$GUEST_NETMASK">
... ...
@@ -104,9 +105,9 @@ cat > $NET_XML <<EOF
104 104
 EOF
105 105
 
106 106
 if [[ "$GUEST_RECREATE_NET" == "yes" ]]; then
107
-    virsh net-destroy devstack-$GUEST_NETWORK || true
107
+    virsh net-destroy $NET_NAME || true
108 108
     # destroying the network isn't enough to delete the leases
109
-    rm -f /var/lib/libvirt/dnsmasq/devstack-$GUEST_NETWORK.leases
109
+    rm -f /var/lib/libvirt/dnsmasq/$NET_NAME.leases
110 110
     virsh net-create $vm_dir/net.xml
111 111
 fi
112 112
 
... ...
@@ -134,7 +135,7 @@ cat > $LIBVIRT_XML <<EOF
134 134
     </disk>
135 135
 
136 136
     <interface type='network'>
137
-      <source network='devstack-$GUEST_NETWORK'/>
137
+      <source network='$NET_NAME'/>
138 138
     </interface>
139 139
         
140 140
     <!-- The order is significant here.  File must be defined first -->
... ...
@@ -170,7 +171,7 @@ instance-type: m1.ignore
170 170
 local-hostname: $GUEST_NAME.local
171 171
 EOF
172 172
 
173
-# set metadata
173
+# set user-data
174 174
 cat > $vm_dir/uec/user-data<<EOF
175 175
 #!/bin/bash
176 176
 # hostname needs to resolve for rabbit
... ...
@@ -186,6 +187,33 @@ cat > localrc <<LOCAL_EOF
186 186
 ROOTSLEEP=0
187 187
 `cat $TOP_DIR/localrc`
188 188
 LOCAL_EOF
189
+# Disable byobu
190
+/usr/bin/byobu-disable
191
+EOF
192
+
193
+# Setup stack user with our key
194
+CONFIGURE_STACK_USER=${CONFIGURE_STACK_USER:-yes}
195
+if [[ -e ~/.ssh/id_rsa.pub  && "$CONFIGURE_STACK_USER" = "yes" ]]; then
196
+    PUB_KEY=`cat  ~/.ssh/id_rsa.pub`
197
+    cat >> $vm_dir/uec/user-data<<EOF
198
+mkdir -p /opt/stack
199
+useradd -U -G sudo -s /bin/bash -d /opt/stack -m stack
200
+echo stack:pass | chpasswd
201
+mkdir -p /opt/stack/.ssh
202
+echo "$PUB_KEY" > /opt/stack/.ssh/authorized_keys
203
+chown -R stack /opt/stack
204
+chmod 700 /opt/stack/.ssh
205
+chmod 600 /opt/stack/.ssh/authorized_keys
206
+
207
+grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
208
+    echo "#includedir /etc/sudoers.d" >> /etc/sudoers
209
+( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \
210
+    > /etc/sudoers.d/50_stack_sh )
211
+EOF
212
+fi
213
+
214
+# Run stack.sh
215
+cat >> $vm_dir/uec/user-data<<EOF
189 216
 ./stack.sh
190 217
 EOF
191 218
 
192 219
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+Getting Started With Jenkins and Devstack
1
+=========================================
2
+This little corner of devstack is to show how to get an Openstack jenkins
3
+environment up and running quickly, using the rcb configuration methodology.
4
+
5
+
6
+To create a jenkins server
7
+--------------------------
8
+
9
+    cd tools/jenkins/jenkins_home
10
+    ./build_jenkins.sh
11
+
12
+This will create a jenkins environment configured with sample test scripts that run against xen and kvm.
13
+
14
+Configuring XS
15
+--------------
16
+In order to make the tests for XS work, you must install xs 5.6 on a separate machine,
17
+and install the the jenkins public key on that server.  You then need to create the
18
+/var/lib/jenkins/xenrc on your jenkins server like so:
19
+
20
+    MYSQL_PASSWORD=secrete
21
+    SERVICE_TOKEN=secrete
22
+    ADMIN_PASSWORD=secrete
23
+    RABBIT_PASSWORD=secrete
24
+    # This is the password for your guest (for both stack and root users)
25
+    GUEST_PASSWORD=secrete
26
+    # Do not download the usual images yet!
27
+    IMAGE_URLS=""
28
+    FLOATING_RANGE=192.168.1.224/28
29
+    VIRT_DRIVER=xenserver
30
+    # Explicitly set multi-host
31
+    MULTI_HOST=1
32
+    # Give extra time for boot
33
+    ACTIVE_TIMEOUT=45
34
+    #  IMPORTANT: This is the ip of your xenserver
35
+    XEN_IP=10.5.5.1
36
+    # IMPORTANT: The following must be set to your dom0 root password!
37
+    XENAPI_PASSWORD='MY_XEN_ROOT_PW'
0 38
new file mode 100755
... ...
@@ -0,0 +1,8 @@
0
+#!/bin/bash
1
+# Echo commands, exit on error
2
+set -o xtrace
3
+set -o errexit
4
+
5
+TOP_DIR=$(cd ../../.. && pwd)
6
+HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
7
+ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises &&  ./euca.sh'
0 8
new file mode 100755
... ...
@@ -0,0 +1,8 @@
0
+#!/bin/bash
1
+# Echo commands, exit on error
2
+set -o xtrace
3
+set -o errexit
4
+
5
+TOP_DIR=$(cd ../../.. && pwd)
6
+HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
7
+ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises &&  ./floating_ips.sh'
0 8
new file mode 100755
... ...
@@ -0,0 +1,21 @@
0
+#!/bin/bash
1
+
2
+EXECUTOR_NUMBER=$1
3
+CONFIGURATION=$2
4
+ADAPTER=$3
5
+RC=$4
6
+
7
+function usage() {
8
+    echo "Usage: $0 -  Build a configuration"
9
+    echo ""
10
+    echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
11
+    exit 1
12
+}
13
+
14
+# Validate inputs
15
+if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = ""  || "$ADAPTER" = "" ]]; then
16
+    usage
17
+fi
18
+
19
+# Execute configuration script
20
+cd configurations && ./$CONFIGURATION.sh $EXECUTOR_NUMBER $CONFIGURATION $ADAPTER "$RC"
0 21
new file mode 100755
... ...
@@ -0,0 +1,56 @@
0
+#!/bin/bash
1
+
2
+EXECUTOR_NUMBER=$1
3
+CONFIGURATION=$2
4
+ADAPTER=$3
5
+RC=$4
6
+
7
+function usage() {
8
+    echo "Usage: $0 - Build a test configuration"
9
+    echo ""
10
+    echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
11
+    exit 1
12
+}
13
+
14
+# Validate inputs
15
+if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = ""  || "$ADAPTER" = "" ]]; then
16
+    usage
17
+fi
18
+
19
+# This directory
20
+CUR_DIR=$(cd $(dirname "$0") && pwd)
21
+
22
+# devstack directory
23
+cd ../../..
24
+TOP_DIR=$(pwd)
25
+
26
+# Name test instance based on executor
27
+BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER`
28
+GUEST_NAME=$BASE_NAME.$ADAPTER
29
+virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true
30
+virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
31
+
32
+# Configure localrc
33
+cat <<EOF >localrc
34
+RECLONE=yes
35
+GUEST_NETWORK=$EXECUTOR_NUMBER
36
+GUEST_NAME=$GUEST_NAME
37
+FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27
38
+GUEST_CORES=1
39
+GUEST_RAM=12574720
40
+MYSQL_PASSWORD=chicken
41
+RABBIT_PASSWORD=chicken
42
+SERVICE_TOKEN=chicken
43
+ADMIN_PASSWORD=chicken
44
+USERNAME=admin
45
+TENANT=admin
46
+NET_NAME=$BASE_NAME
47
+ACTIVE_TIMEOUT=45
48
+BOOT_TIMEOUT=45
49
+$RC
50
+EOF
51
+cd tools
52
+sudo ./build_uec.sh
53
+
54
+# Make the address of the instances available to test runners
55
+echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses
0 56
new file mode 100755
... ...
@@ -0,0 +1,53 @@
0
+#!/bin/bash
1
+set -o errexit
2
+set -o xtrace
3
+
4
+
5
+EXECUTOR_NUMBER=$1
6
+CONFIGURATION=$2
7
+ADAPTER=$3
8
+RC=$4
9
+
10
+function usage() {
11
+    echo "Usage: $0 - Build a test configuration"
12
+    echo ""
13
+    echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
14
+    exit 1
15
+}
16
+
17
+# Validate inputs
18
+if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = ""  || "$ADAPTER" = "" ]]; then
19
+    usage
20
+fi
21
+
22
+# Configuration of xenrc
23
+XENRC=/var/lib/jenkins/xenrc
24
+if [ ! -e $XENRC ]; then
25
+    echo "/var/lib/jenkins/xenrc is not present! See README.md"
26
+    exit 1
27
+fi
28
+
29
+# Move to top of devstack
30
+cd ../../..
31
+
32
+# Use xenrc as the start of our localrc
33
+cp $XENRC localrc
34
+
35
+# Set the PUB_IP
36
+PUB_IP=192.168.1.1$EXECUTOR_NUMBER
37
+echo "PUB_IP=$PUB_IP" >> localrc
38
+
39
+# Overrides
40
+echo "$RC" >> localrc
41
+
42
+# Source localrc
43
+. localrc
44
+
45
+# Make host ip available to tester
46
+echo "HEAD=$PUB_IP" > addresses
47
+
48
+# Build configuration
49
+REMOTE_DEVSTACK=/root/devstack
50
+ssh root@$XEN_IP "rm -rf $REMOTE_DEVSTACK"
51
+scp -pr . root@$XEN_IP:$REMOTE_DEVSTACK
52
+ssh root@$XEN_IP "cd $REMOTE_DEVSTACK/tools/xen && ./build_domU.sh"
0 53
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+builds
1
+workspace
2
+*.sw*
0 3
new file mode 100755
... ...
@@ -0,0 +1,108 @@
0
+#!/bin/bash
1
+
2
+# Echo commands, exit on error
3
+set -o xtrace
4
+set -o errexit
5
+
6
+# Make sure only root can run our script
7
+if [[ $EUID -ne 0 ]]; then
8
+   echo "This script must be run as root"
9
+   exit 1
10
+fi
11
+
12
+# Make sure user has configured an ssh pubkey
13
+if [ ! -e /root/.ssh/id_rsa.pub ]; then
14
+   echo "Public key is missing.  This is used to ssh into your instances."
15
+   echo "Please run ssh-keygen before proceeding"
16
+   exit 1
17
+fi
18
+
19
+# This directory
20
+CUR_DIR=$(cd $(dirname "$0") && pwd)
21
+
22
+# Configure trunk jenkins!
23
+echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list
24
+wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
25
+apt-get update
26
+
27
+
28
+# Clean out old jenkins - useful if you are having issues upgrading
29
+CLEAN_JENKINS=${CLEAN_JENKINS:-no}
30
+if [ "$CLEAN_JENKINS" = "yes" ] then;
31
+    apt-get remove jenkins jenkins-common
32
+fi
33
+
34
+# Install software
35
+DEPS="jenkins cloud-utils"
36
+apt-get install -y --force-yes $DEPS
37
+
38
+# Install jenkins
39
+if [ ! -e /var/lib/jenkins ]; then
40
+   echo "Jenkins installation failed"
41
+   exit 1
42
+fi
43
+
44
+# Setup sudo
45
+JENKINS_SUDO=/etc/sudoers.d/jenkins
46
+cat > $JENKINS_SUDO <<EOF
47
+jenkins ALL = NOPASSWD: ALL
48
+EOF
49
+chmod 440 $JENKINS_SUDO
50
+
51
+# Setup .gitconfig
52
+JENKINS_GITCONF=/var/lib/jenkins/hudson.plugins.git.GitSCM.xml
53
+cat > $JENKINS_GITCONF <<EOF
54
+<?xml version='1.0' encoding='UTF-8'?>
55
+<hudson.plugins.git.GitSCM_-DescriptorImpl>
56
+  <generation>4</generation>
57
+  <globalConfigName>Jenkins</globalConfigName>
58
+  <globalConfigEmail>jenkins@rcb.me</globalConfigEmail>
59
+</hudson.plugins.git.GitSCM_-DescriptorImpl>
60
+EOF
61
+
62
+# Add build numbers
63
+JOBS=`ls jobs`
64
+for job in ${JOBS// / }; do
65
+    if [ ! -e jobs/$job/nextBuildNumber ]; then
66
+        echo 1 > jobs/$job/nextBuildNumber
67
+    fi
68
+done
69
+
70
+# Set ownership to jenkins
71
+chown -R jenkins $CUR_DIR
72
+
73
+# Make sure this directory is accessible to jenkins
74
+if ! su -c "ls $CUR_DIR" jenkins; then
75
+    echo "Your devstack directory is not accessible by jenkins."
76
+    echo "There is a decent chance you are trying to run this from a directory in /root."
77
+    echo "If so, try moving devstack elsewhere (eg. /opt/devstack)."
78
+    exit 1
79
+fi
80
+
81
+# Move aside old jobs, if present
82
+if [ ! -h /var/lib/jenkins/jobs ]; then
83
+    echo "Installing jobs symlink"
84
+    if [ -d /var/lib/jenkins/jobs ]; then
85
+        mv /var/lib/jenkins/jobs /var/lib/jenkins/jobs.old
86
+    fi
87
+fi
88
+
89
+# Set up jobs symlink
90
+rm -f /var/lib/jenkins/jobs
91
+ln -s $CUR_DIR/jobs /var/lib/jenkins/jobs
92
+
93
+# List of plugins
94
+PLUGINS=http://hudson-ci.org/downloads/plugins/build-timeout/1.6/build-timeout.hpi,http://mirrors.jenkins-ci.org/plugins/git/1.1.12/git.hpi,http://hudson-ci.org/downloads/plugins/global-build-stats/1.2/global-build-stats.hpi,http://hudson-ci.org/downloads/plugins/greenballs/1.10/greenballs.hpi,http://download.hudson-labs.org/plugins/console-column-plugin/1.0/console-column-plugin.hpi
95
+
96
+# Configure plugins
97
+for plugin in ${PLUGINS//,/ }; do
98
+    name=`basename $plugin`   
99
+    dest=/var/lib/jenkins/plugins/$name
100
+    if [ ! -e $dest ]; then
101
+        curl -L $plugin -o $dest
102
+    fi
103
+done
104
+
105
+# Restart jenkins
106
+/etc/init.d/jenkins stop || true
107
+/etc/init.d/jenkins start
0 108
new file mode 100755
... ...
@@ -0,0 +1,21 @@
0
+#!/bin/bash
1
+# This script is not yet for general consumption.
2
+
3
+set -o errexit
4
+
5
+if [ ! "$FORCE" = "yes" ]; then
6
+    echo "FORCE not set to 'yes'.  Make sure this is something you really want to do.  Exiting."
7
+    exit 1
8
+fi
9
+
10
+virsh list | cut -d " " -f1 | grep -v "-" | egrep -e "[0-9]" | xargs -n 1 virsh destroy || true
11
+virsh net-list | grep active | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
12
+killall dnsmasq || true
13
+if [ "$CLEAN" = "yes" ]; then
14
+    rm -rf jobs
15
+fi
16
+rm /var/lib/jenkins/jobs
17
+git checkout -f
18
+git fetch
19
+git merge origin/jenkins
20
+./build_jenkins.sh
0 21
new file mode 100644
... ...
@@ -0,0 +1,82 @@
0
+<?xml version='1.0' encoding='UTF-8'?>
1
+<matrix-project>
2
+  <actions/>
3
+  <description></description>
4
+  <keepDependencies>false</keepDependencies>
5
+  <properties>
6
+    <hudson.model.ParametersDefinitionProperty>
7
+      <parameterDefinitions>
8
+        <hudson.model.StringParameterDefinition>
9
+          <name>RC</name>
10
+          <description></description>
11
+          <defaultValue></defaultValue>
12
+        </hudson.model.StringParameterDefinition>
13
+      </parameterDefinitions>
14
+    </hudson.model.ParametersDefinitionProperty>
15
+  </properties>
16
+  <scm class="hudson.plugins.git.GitSCM">
17
+    <configVersion>2</configVersion>
18
+    <userRemoteConfigs>
19
+      <hudson.plugins.git.UserRemoteConfig>
20
+        <name>origin</name>
21
+        <refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
22
+        <url>git://github.com/cloudbuilders/devstack.git</url>
23
+      </hudson.plugins.git.UserRemoteConfig>
24
+    </userRemoteConfigs>
25
+    <branches>
26
+      <hudson.plugins.git.BranchSpec>
27
+        <name>jenkins</name>
28
+      </hudson.plugins.git.BranchSpec>
29
+    </branches>
30
+    <recursiveSubmodules>false</recursiveSubmodules>
31
+    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
32
+    <authorOrCommitter>false</authorOrCommitter>
33
+    <clean>false</clean>
34
+    <wipeOutWorkspace>false</wipeOutWorkspace>
35
+    <pruneBranches>false</pruneBranches>
36
+    <remotePoll>false</remotePoll>
37
+    <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
38
+    <gitTool>Default</gitTool>
39
+    <submoduleCfg class="list"/>
40
+    <relativeTargetDir></relativeTargetDir>
41
+    <excludedRegions></excludedRegions>
42
+    <excludedUsers></excludedUsers>
43
+    <gitConfigName></gitConfigName>
44
+    <gitConfigEmail></gitConfigEmail>
45
+    <skipTag>false</skipTag>
46
+    <scmName></scmName>
47
+  </scm>
48
+  <canRoam>true</canRoam>
49
+  <disabled>false</disabled>
50
+  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
51
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
52
+  <triggers class="vector"/>
53
+  <concurrentBuild>false</concurrentBuild>
54
+  <axes>
55
+    <hudson.matrix.TextAxis>
56
+      <name>ADAPTER</name>
57
+      <values>
58
+        <string>euca</string>
59
+        <string>floating_ips</string>
60
+      </values>
61
+    </hudson.matrix.TextAxis>
62
+  </axes>
63
+  <builders>
64
+    <hudson.tasks.Shell>
65
+      <command>sed -i &apos;s/) 2&gt;&amp;1 | tee &quot;${LOGFILE}&quot;/)/&apos; stack.sh</command>
66
+    </hudson.tasks.Shell>
67
+    <hudson.tasks.Shell>
68
+      <command>set -o errexit
69
+cd tools/jenkins
70
+sudo ./build_configuration.sh $EXECUTOR_NUMBER kvm $ADAPTER &quot;$RC&quot;</command>
71
+    </hudson.tasks.Shell>
72
+    <hudson.tasks.Shell>
73
+      <command>set -o errexit
74
+cd tools/jenkins
75
+sudo ./run_test.sh $EXECUTOR_NUMBER $ADAPTER $RC &quot;$RC&quot;</command>
76
+    </hudson.tasks.Shell>
77
+  </builders>
78
+  <publishers/>
79
+  <buildWrappers/>
80
+  <runSequentially>false</runSequentially>
81
+</matrix-project>
0 82
\ No newline at end of file
1 83
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+<?xml version='1.0' encoding='UTF-8'?>
1
+<matrix-config>
2
+  <keepDependencies>false</keepDependencies>
3
+  <properties/>
4
+  <scm class="hudson.scm.NullSCM"/>
5
+  <canRoam>false</canRoam>
6
+  <disabled>false</disabled>
7
+  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9
+  <triggers class="vector"/>
10
+  <concurrentBuild>false</concurrentBuild>
11
+  <builders/>
12
+  <publishers/>
13
+  <buildWrappers/>
14
+</matrix-config>
0 15
\ No newline at end of file
1 16
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+<?xml version='1.0' encoding='UTF-8'?>
1
+<matrix-config>
2
+  <keepDependencies>false</keepDependencies>
3
+  <properties/>
4
+  <scm class="hudson.scm.NullSCM"/>
5
+  <canRoam>false</canRoam>
6
+  <disabled>false</disabled>
7
+  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9
+  <triggers class="vector"/>
10
+  <concurrentBuild>false</concurrentBuild>
11
+  <builders/>
12
+  <publishers/>
13
+  <buildWrappers/>
14
+</matrix-config>
0 15
\ No newline at end of file
1 16
new file mode 100644
... ...
@@ -0,0 +1,88 @@
0
+<?xml version='1.0' encoding='UTF-8'?>
1
+<matrix-project>
2
+  <actions/>
3
+  <description>In order for this to work, you must create a /var/lib/jenkins/xenrc file as described in README.md</description>
4
+  <keepDependencies>false</keepDependencies>
5
+  <properties>
6
+    <hudson.model.ParametersDefinitionProperty>
7
+      <parameterDefinitions>
8
+        <hudson.model.StringParameterDefinition>
9
+          <name>RC</name>
10
+          <description></description>
11
+          <defaultValue></defaultValue>
12
+        </hudson.model.StringParameterDefinition>
13
+      </parameterDefinitions>
14
+    </hudson.model.ParametersDefinitionProperty>
15
+  </properties>
16
+  <scm class="hudson.plugins.git.GitSCM">
17
+    <configVersion>2</configVersion>
18
+    <userRemoteConfigs>
19
+      <hudson.plugins.git.UserRemoteConfig>
20
+        <name>origin</name>
21
+        <refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
22
+        <url>git://github.com/cloudbuilders/devstack.git</url>
23
+      </hudson.plugins.git.UserRemoteConfig>
24
+    </userRemoteConfigs>
25
+    <branches>
26
+      <hudson.plugins.git.BranchSpec>
27
+        <name>jenkins</name>
28
+      </hudson.plugins.git.BranchSpec>
29
+    </branches>
30
+    <recursiveSubmodules>false</recursiveSubmodules>
31
+    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
32
+    <authorOrCommitter>false</authorOrCommitter>
33
+    <clean>false</clean>
34
+    <wipeOutWorkspace>false</wipeOutWorkspace>
35
+    <pruneBranches>false</pruneBranches>
36
+    <remotePoll>false</remotePoll>
37
+    <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
38
+    <gitTool>Default</gitTool>
39
+    <submoduleCfg class="list"/>
40
+    <relativeTargetDir></relativeTargetDir>
41
+    <excludedRegions></excludedRegions>
42
+    <excludedUsers></excludedUsers>
43
+    <gitConfigName></gitConfigName>
44
+    <gitConfigEmail></gitConfigEmail>
45
+    <skipTag>false</skipTag>
46
+    <scmName></scmName>
47
+  </scm>
48
+  <canRoam>true</canRoam>
49
+  <disabled>false</disabled>
50
+  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
51
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
52
+  <triggers class="vector"/>
53
+  <concurrentBuild>false</concurrentBuild>
54
+  <axes>
55
+    <hudson.matrix.TextAxis>
56
+      <name>ADAPTER</name>
57
+      <values>
58
+        <string>euca</string>
59
+        <string>floating_ips</string>
60
+      </values>
61
+    </hudson.matrix.TextAxis>
62
+  </axes>
63
+  <builders>
64
+    <hudson.tasks.Shell>
65
+      <command>sed -i &apos;s/) 2&gt;&amp;1 | tee &quot;${LOGFILE}&quot;/)/&apos; stack.sh</command>
66
+    </hudson.tasks.Shell>
67
+    <hudson.tasks.Shell>
68
+      <command>set -o errexit
69
+cd tools/jenkins
70
+sudo ./build_configuration.sh $EXECUTOR_NUMBER xs $ADAPTER &quot;$RC&quot;</command>
71
+    </hudson.tasks.Shell>
72
+    <hudson.tasks.Shell>
73
+      <command>#!/bin/bash
74
+set -o errexit
75
+set -o xtrace
76
+
77
+. localrc
78
+
79
+# Unlike kvm, ssh to the xen host to run tests, in case the test instance is launch with a host only network
80
+ssh root@$XEN_IP &quot;cd devstack &amp;&amp; . localrc &amp;&amp; cd tools/jenkins &amp;&amp; ./run_test.sh $EXECUTOR_NUMBER $ADAPTER &apos;$RC&apos;&quot; 
81
+</command>
82
+    </hudson.tasks.Shell>
83
+  </builders>
84
+  <publishers/>
85
+  <buildWrappers/>
86
+  <runSequentially>true</runSequentially>
87
+</matrix-project>
0 88
\ No newline at end of file
1 89
new file mode 100755
... ...
@@ -0,0 +1,45 @@
0
+#!/usr/bin/python
1
+import urllib
2
+import json
3
+import sys
4
+
5
+
6
+def print_usage():
7
+    print "Usage: %s [jenkins_url (eg. http://50.56.12.202:8080/)]"\
8
+          % sys.argv[0]
9
+    sys.exit()
10
+
11
+
12
+def fetch_blob(url):
13
+    return json.loads(urllib.urlopen(url + '/api/json').read())
14
+
15
+
16
+if len(sys.argv) < 2:
17
+    print_usage()
18
+
19
+BASE_URL = sys.argv[1]
20
+
21
+root = fetch_blob(BASE_URL)
22
+results = {}
23
+for job_url in root['jobs']:
24
+    job = fetch_blob(job_url['url'])
25
+    if job.get('activeConfigurations'):
26
+        (tag, name) = job['name'].split('-')
27
+        if not results.get(tag):
28
+            results[tag] = {}
29
+        if not results[tag].get(name):
30
+            results[tag][name] = []
31
+
32
+        for config_url in job['activeConfigurations']:
33
+            config = fetch_blob(config_url['url'])
34
+
35
+            log_url = ''
36
+            if config.get('lastBuild'):
37
+                log_url = config['lastBuild']['url'] + 'console'
38
+
39
+            results[tag][name].append({'test': config['displayName'],
40
+                                       'status': config['color'],
41
+                                       'logUrl': log_url,
42
+                                       'healthReport': config['healthReport']})
43
+
44
+print json.dumps(results)
0 45
new file mode 100755
... ...
@@ -0,0 +1,20 @@
0
+#!/bin/bash
1
+
2
+EXECUTOR_NUMBER=$1
3
+ADAPTER=$2
4
+RC=$3
5
+
6
+function usage() {
7
+    echo "Usage: $0 - Run a test"
8
+    echo ""
9
+    echo "$0 [EXECUTOR_NUMBER] [ADAPTER] [RC (optional)]"
10
+    exit 1
11
+}
12
+
13
+# Validate inputs
14
+if [[ "$EXECUTOR_NUMBER" = "" || "$ADAPTER" = "" ]]; then
15
+    usage
16
+fi
17
+
18
+# Execute configuration script
19
+cd adapters && ./$ADAPTER.sh $EXECUTOR_NUMBER $ADAPTER "$RC"
... ...
@@ -49,10 +49,6 @@ grep -q "^#includedir.*/etc/sudoers.d" $STAGING_DIR/etc/sudoers ||
49 49
 cp $TOP_DIR/files/sudo/* $STAGING_DIR/etc/sudoers.d/
50 50
 sed -e "s,%USER%,$USER,g" -i $STAGING_DIR/etc/sudoers.d/*
51 51
 
52
-# and has sudo ability (in the future this should be limited to only what
53
-# stack requires)
54
-echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers
55
-
56 52
 # Gracefully cp only if source file/dir exists
57 53
 function cp_it {
58 54
     if [ -e $1 ] || [ -d $1 ]; then
... ...
@@ -240,6 +240,11 @@ if [ "$DO_SHUTDOWN" = "1" ]; then
240 240
         xe vm-shutdown uuid=$uuid
241 241
         xe vm-destroy uuid=$uuid
242 242
     done
243
+
244
+    # Destroy orphaned vdis
245
+    for uuid in `xe vdi-list | grep -1 Glance | grep uuid | sed "s/.*\: //g"`; do
246
+        xe vdi-destroy uuid=$uuid
247
+    done
243 248
 fi
244 249
 
245 250
 # Path to head xva.  By default keep overwriting the same one to save space