Merge "remove tools/jenkins"

This commit is contained in:
Jenkins 2014-08-29 01:36:54 +00:00 committed by Gerrit Code Review
commit b0f7271298
17 changed files with 0 additions and 621 deletions

View File

@ -1,38 +0,0 @@
Getting Started With Jenkins and Devstack
=========================================
This little corner of devstack is to show how to get an OpenStack jenkins
environment up and running quickly, using the rcb configuration methodology.
To create a jenkins server
--------------------------
cd tools/jenkins/jenkins_home
./build_jenkins.sh
This will create a jenkins environment configured with sample test scripts that run against xen and kvm.
Configuring XS
--------------
In order to make the tests for XS work, you must install xs 5.6 on a separate machine,
and install the the jenkins public key on that server. You then need to create the
/var/lib/jenkins/xenrc on your jenkins server like so:
MYSQL_PASSWORD=secrete
SERVICE_TOKEN=secrete
ADMIN_PASSWORD=secrete
RABBIT_PASSWORD=secrete
# This is the password for your guest (for both stack and root users)
GUEST_PASSWORD=secrete
# Do not download the usual images yet!
IMAGE_URLS=""
FLOATING_RANGE=192.168.1.224/28
VIRT_DRIVER=xenserver
# Explicitly set multi-host
MULTI_HOST=1
# Give extra time for boot
ACTIVE_TIMEOUT=45
# IMPORTANT: This is the ip of your xenserver
XEN_IP=10.5.5.1
# IMPORTANT: The following must be set to your dom0 root password!
XENAPI_PASSWORD='MY_XEN_ROOT_PW'

View File

@ -1,9 +0,0 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
TOP_DIR=$(cd ../../.. && pwd)
HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
die_if_not_set $LINENO HEAD_IP "Failure retrieving HEAD_IP"
ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./euca.sh'

View File

@ -1,9 +0,0 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
TOP_DIR=$(cd ../../.. && pwd)
HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
die_if_not_set $LINENO HEAD_IP "Failure retrieving HEAD_IP"
ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./floating_ips.sh'

View File

@ -1,8 +0,0 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
TOP_DIR=$(cd ../../.. && pwd)
HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./swift.sh'

View File

@ -1,9 +0,0 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
TOP_DIR=$(cd ../../.. && pwd)
HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
die_if_not_set $LINENO HEAD_IP "Failure retrieving HEAD_IP"
ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./volumes.sh'

View File

@ -1,21 +0,0 @@
#!/bin/bash
EXECUTOR_NUMBER=$1
CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage {
echo "Usage: $0 - Build a configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
exit 1
}
# Validate inputs
if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
usage
fi
# Execute configuration script
cd configurations && ./$CONFIGURATION.sh $EXECUTOR_NUMBER $CONFIGURATION $ADAPTER "$RC"

View File

@ -1,64 +0,0 @@
#!/bin/bash
# exit on error to stop unexpected errors
set -o errexit
set -o xtrace
EXECUTOR_NUMBER=$1
CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage {
echo "Usage: $0 - Build a test configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
exit 1
}
# Validate inputs
if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
usage
fi
# This directory
CUR_DIR=$(cd $(dirname "$0") && pwd)
# devstack directory
cd ../../..
TOP_DIR=$(pwd)
# Deps
apt-get install -y --force-yes libvirt-bin || true
# Name test instance based on executor
BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER`
GUEST_NAME=$BASE_NAME.$ADAPTER
virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true
virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
# Configure localrc
cat <<EOF >localrc
RECLONE=yes
GUEST_NETWORK=$EXECUTOR_NUMBER
GUEST_NAME=$GUEST_NAME
FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27
GUEST_CORES=1
GUEST_RAM=12574720
MYSQL_PASSWORD=chicken
RABBIT_PASSWORD=chicken
SERVICE_TOKEN=chicken
SERVICE_PASSWORD=chicken
ADMIN_PASSWORD=chicken
USERNAME=admin
TENANT=admin
NET_NAME=$BASE_NAME
ACTIVE_TIMEOUT=45
BOOT_TIMEOUT=45
$RC
EOF
cd tools
sudo ./build_uec.sh
# Make the address of the instances available to test runners
echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses

View File

@ -1,53 +0,0 @@
#!/bin/bash
set -o errexit
set -o xtrace
EXECUTOR_NUMBER=$1
CONFIGURATION=$2
ADAPTER=$3
RC=$4
function usage {
echo "Usage: $0 - Build a test configuration"
echo ""
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
exit 1
}
# Validate inputs
if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
usage
fi
# Configuration of xenrc
XENRC=/var/lib/jenkins/xenrc
if [ ! -e $XENRC ]; then
echo "/var/lib/jenkins/xenrc is not present! See README.md"
exit 1
fi
# Move to top of devstack
cd ../../..
# Use xenrc as the start of our localrc
cp $XENRC localrc
# Set the PUB_IP
PUB_IP=192.168.1.1$EXECUTOR_NUMBER
echo "PUB_IP=$PUB_IP" >> localrc
# Overrides
echo "$RC" >> localrc
# Source localrc
. localrc
# Make host ip available to tester
echo "HEAD=$PUB_IP" > addresses
# Build configuration
REMOTE_DEVSTACK=/root/devstack
ssh root@$XEN_IP "rm -rf $REMOTE_DEVSTACK"
scp -pr . root@$XEN_IP:$REMOTE_DEVSTACK
ssh root@$XEN_IP "cd $REMOTE_DEVSTACK/tools/xen && ./build_domU.sh"

View File

@ -1,3 +0,0 @@
builds
workspace
*.sw*

View File

@ -1,108 +0,0 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# This directory
CUR_DIR=$(cd $(dirname "$0") && pwd)
# Configure trunk jenkins!
echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
apt-get update
# Clean out old jenkins - useful if you are having issues upgrading
CLEAN_JENKINS=${CLEAN_JENKINS:-no}
if [ "$CLEAN_JENKINS" = "yes" ]; then
apt-get remove jenkins jenkins-common
fi
# Install software
DEPS="jenkins cloud-utils"
apt-get install -y --force-yes $DEPS
# Install jenkins
if [ ! -e /var/lib/jenkins ]; then
echo "Jenkins installation failed"
exit 1
fi
# Make sure user has configured a jenkins ssh pubkey
if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then
echo "Public key for jenkins is missing. This is used to ssh into your instances."
echo "Please run "su -c ssh-keygen jenkins" before proceeding"
exit 1
fi
# Setup sudo
JENKINS_SUDO=/etc/sudoers.d/jenkins
cat > $JENKINS_SUDO <<EOF
jenkins ALL = NOPASSWD: ALL
EOF
chmod 440 $JENKINS_SUDO
# Setup .gitconfig
JENKINS_GITCONF=/var/lib/jenkins/hudson.plugins.git.GitSCM.xml
cat > $JENKINS_GITCONF <<EOF
<?xml version='1.0' encoding='UTF-8'?>
<hudson.plugins.git.GitSCM_-DescriptorImpl>
<generation>4</generation>
<globalConfigName>Jenkins</globalConfigName>
<globalConfigEmail>jenkins@rcb.me</globalConfigEmail>
</hudson.plugins.git.GitSCM_-DescriptorImpl>
EOF
# Add build numbers
JOBS=`ls jobs`
for job in ${JOBS// / }; do
if [ ! -e jobs/$job/nextBuildNumber ]; then
echo 1 > jobs/$job/nextBuildNumber
fi
done
# Set ownership to jenkins
chown -R jenkins $CUR_DIR
# Make sure this directory is accessible to jenkins
if ! su -c "ls $CUR_DIR" jenkins; then
echo "Your devstack directory is not accessible by jenkins."
echo "There is a decent chance you are trying to run this from a directory in /root."
echo "If so, try moving devstack elsewhere (eg. /opt/devstack)."
exit 1
fi
# Move aside old jobs, if present
if [ ! -h /var/lib/jenkins/jobs ]; then
echo "Installing jobs symlink"
if [ -d /var/lib/jenkins/jobs ]; then
mv /var/lib/jenkins/jobs /var/lib/jenkins/jobs.old
fi
fi
# Set up jobs symlink
rm -f /var/lib/jenkins/jobs
ln -s $CUR_DIR/jobs /var/lib/jenkins/jobs
# List of plugins
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
# Configure plugins
for plugin in ${PLUGINS//,/ }; do
name=`basename $plugin`
dest=/var/lib/jenkins/plugins/$name
if [ ! -e $dest ]; then
curl -L $plugin -o $dest
fi
done
# Restart jenkins
/etc/init.d/jenkins stop || true
/etc/init.d/jenkins start

View File

@ -1,21 +0,0 @@
#!/bin/bash
# This script is not yet for general consumption.
set -o errexit
if [ ! "$FORCE" = "yes" ]; then
echo "FORCE not set to 'yes'. Make sure this is something you really want to do. Exiting."
exit 1
fi
virsh list | cut -d " " -f1 | grep -v "-" | egrep -e "[0-9]" | xargs -n 1 virsh destroy || true
virsh net-list | grep active | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
killall dnsmasq || true
if [ "$CLEAN" = "yes" ]; then
rm -rf jobs
fi
rm /var/lib/jenkins/jobs
git checkout -f
git fetch
git merge origin/jenkins
./build_jenkins.sh

View File

@ -1,82 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<matrix-project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>RC</name>
<description></description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>origin</name>
<refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
<url>git://github.com/cloudbuilders/devstack.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir></relativeTargetDir>
<excludedRegions></excludedRegions>
<excludedUsers></excludedUsers>
<gitConfigName></gitConfigName>
<gitConfigEmail></gitConfigEmail>
<skipTag>false</skipTag>
<scmName></scmName>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<axes>
<hudson.matrix.TextAxis>
<name>ADAPTER</name>
<values>
<string>euca</string>
<string>floating_ips</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<builders>
<hudson.tasks.Shell>
<command>sed -i &apos;s/) 2&gt;&amp;1 | tee &quot;${LOGFILE}&quot;/)/&apos; stack.sh</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>set -o errexit
cd tools/jenkins
sudo ./build_configuration.sh $EXECUTOR_NUMBER kvm $ADAPTER &quot;$RC&quot;</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>set -o errexit
cd tools/jenkins
./run_test.sh $EXECUTOR_NUMBER $ADAPTER $RC &quot;$RC&quot;</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
<runSequentially>false</runSequentially>
</matrix-project>

View File

@ -1,15 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<matrix-config>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</matrix-config>

View File

@ -1,15 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<matrix-config>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</matrix-config>

View File

@ -1,88 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<matrix-project>
<actions/>
<description>In order for this to work, you must create a /var/lib/jenkins/xenrc file as described in README.md</description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>RC</name>
<description></description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>origin</name>
<refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
<url>git://github.com/cloudbuilders/devstack.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir></relativeTargetDir>
<excludedRegions></excludedRegions>
<excludedUsers></excludedUsers>
<gitConfigName></gitConfigName>
<gitConfigEmail></gitConfigEmail>
<skipTag>false</skipTag>
<scmName></scmName>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<axes>
<hudson.matrix.TextAxis>
<name>ADAPTER</name>
<values>
<string>euca</string>
<string>floating_ips</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<builders>
<hudson.tasks.Shell>
<command>sed -i &apos;s/) 2&gt;&amp;1 | tee &quot;${LOGFILE}&quot;/)/&apos; stack.sh</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>set -o errexit
cd tools/jenkins
sudo ./build_configuration.sh $EXECUTOR_NUMBER xs $ADAPTER &quot;$RC&quot;</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>#!/bin/bash
set -o errexit
set -o xtrace
. localrc
# Unlike kvm, ssh to the xen host to run tests, in case the test instance is launch with a host only network
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;
</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
<runSequentially>true</runSequentially>
</matrix-project>

View File

@ -1,58 +0,0 @@
#!/usr/bin/python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import sys
import urllib
def print_usage():
print("Usage: %s [jenkins_url (eg. http://50.56.12.202:8080/)]"
% sys.argv[0])
sys.exit()
def fetch_blob(url):
return json.loads(urllib.urlopen(url + '/api/json').read())
if len(sys.argv) < 2:
print_usage()
BASE_URL = sys.argv[1]
root = fetch_blob(BASE_URL)
results = {}
for job_url in root['jobs']:
job = fetch_blob(job_url['url'])
if job.get('activeConfigurations'):
(tag, name) = job['name'].split('-')
if not results.get(tag):
results[tag] = {}
if not results[tag].get(name):
results[tag][name] = []
for config_url in job['activeConfigurations']:
config = fetch_blob(config_url['url'])
log_url = ''
if config.get('lastBuild'):
log_url = config['lastBuild']['url'] + 'console'
results[tag][name].append({'test': config['displayName'],
'status': config['color'],
'logUrl': log_url,
'healthReport': config['healthReport']})
print(json.dumps(results))

View File

@ -1,20 +0,0 @@
#!/bin/bash
EXECUTOR_NUMBER=$1
ADAPTER=$2
RC=$3
function usage {
echo "Usage: $0 - Run a test"
echo ""
echo "$0 [EXECUTOR_NUMBER] [ADAPTER] [RC (optional)]"
exit 1
}
# Validate inputs
if [[ "$EXECUTOR_NUMBER" = "" || "$ADAPTER" = "" ]]; then
usage
fi
# Execute configuration script
cd adapters && ./$ADAPTER.sh $EXECUTOR_NUMBER $ADAPTER "$RC"