Skip to content

Instantly share code, notes, and snippets.

@redbo
Last active April 14, 2016 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redbo/d7133a069341a2f17119 to your computer and use it in GitHub Desktop.
Save redbo/d7133a069341a2f17119 to your computer and use it in GitHub Desktop.
# DOCKER-VERSION 0.6.4

# This is probably only useful if you're setting up a CI environment.

# Adding this line to /etc/default/docker will convince Docker to use btrfs:
# DOCKER_OPTS="--storage-driver=btrfs"

FROM   ubuntu:14.04

RUN     echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports universe" >> /etc/apt/sources.list
RUN     apt-get update
RUN     apt-get -y upgrade
RUN     apt-get install -y curl gcc memcached rsync sqlite3 xfsprogs git-core libffi-dev python-setuptools python-coverage python-dev python-nose python-simplejson python-xattr python-eventlet python-greenlet python-pastedeploy python-netifaces python-pip python-dnspython python-unittest2 python-mock python-openssl wget pkg-config build-essential autoconf automake libtool sudo liberasurecode-dev

RUN     /usr/sbin/useradd -m -d /home/swift -U swift

RUN     cd /home/swift; git clone https://review.openstack.org/openstack/swift
RUN     pip install -U pip tox pbr virtualenv setuptools six
RUN     apt-get remove -y python-pip python-six

RUN     cd /home/swift/swift; pip install -r requirements.txt
RUN     cd /home/swift/swift; pip install -r test-requirements.txt
RUN     cd /home/swift/swift; python setup.py develop

RUN     cd /home/swift; git clone https://review.openstack.org/openstack/python-swiftclient.git
RUN     cd /home/swift/python-swiftclient; python setup.py develop

RUN     cp /home/swift/swift/doc/saio/bin/* /usr/local/bin

RUN     mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4 /var/run/swift /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/hummingbird /etc/hummingbird

RUN     cp -r /home/swift/swift/doc/saio/swift /etc/swift
RUN     find /etc/swift/ -name \*.conf | xargs sed -i "s/<your-user-name>/swift/"
RUN     cp /home/swift/swift/test/sample.conf /etc/swift/test.conf
RUN     printf "[swift-hash]\nswift_hash_path_prefix = changeme\nswift_hash_path_suffix = changeme\n" > /etc/swift/swift.conf
RUN     remakerings

RUN     chown -R swift:swift /etc/swift /etc/hummingbird /srv/* /var/cache/swift* /var/run/swift /var/run/hummingbird

RUN     curl 'https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz' | tar -xz -C /usr/local
RUN     ln -s /usr/local/go/bin/* /usr/local/bin

ADD     tests /root/tests

tests:

#!/bin/bash

set -e

cd /home/swift/swift
git fetch https://review.openstack.org/openstack/swift "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
cp -r /home/swift/swift/doc/saio/swift /etc/swift
find /etc/swift/ -name \*.conf | xargs sed -i "s/<your-user-name>/swift/"
cp /home/swift/swift/test/sample.conf /etc/swift/test.conf
mkdir -p /home/swift/gocode/src/github.com/openstack
ln -s /home/swift/swift /home/swift/gocode/src/github.com/openstack/swift
chown -R swift:swift /etc/swift /srv/* /var/cache/swift* /var/run/swift /var/run/hummingbird /home/swift/gocode
cd /home/swift/gocode/src/github.com/openstack/swift/go
GOPATH=/home/swift/gocode make get test install
service memcached start
swift-init start proxy-server
swift-init start account-server
swift-init start container-server
hummingbird start object
cd /home/swift/swift
nosetests --exe -v /home/swift/swift/test/functional/

Jenkins job script:

/usr/bin/docker run --name "hbt${BUILD_NUMBER}" -e "GERRIT_REFSPEC=${GERRIT_REFSPEC}" hummingbirdtest /root/tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment