Merge "Setup the gate for cross-distro support"

This commit is contained in:
Jenkins 2015-08-27 08:53:13 +00:00 committed by Gerrit Code Review
commit eecf6581a4
4 changed files with 107 additions and 11 deletions

38
tests/setup_centos.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -o xtrace
set -o errexit
cat | sudo tee /etc/yum.repos.d/docker.repo << EOF
[docker]
name=Docker Main Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
sudo yum install -y libffi-devel openssl-devel docker-engine xfsprogs
# Setup backing disk for use with Docker. This is to ensure we use the ephemeral
# disk provided to the build instance. It ensures the correct disk and storage
# driver are used for Docker. It is recommend to use the thin provisioning
# driver. https://github.com/docker/docker/blob/master/man/docker.1.md
sudo parted /dev/${DEV} -s -- mklabel msdos mkpart pri 1 -1
sudo pvcreate /dev/${DEV}1
sudo vgcreate kolla01 /dev/${DEV}1
sudo lvcreate -n thin01 -L 60G kolla01
sudo lvcreate -n thin01meta -L 2G kolla01
yes | sudo lvconvert --type thin-pool --poolmetadata kolla01/thin01meta kolla01/thin01
# Setup Docker
sudo sed -i -r 's,(ExecStart)=(.+),\1=/usr/bin/docker daemon --storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=kolla01-thin01 --storage-opt dm.use_deferred_removal=true,' /usr/lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl start docker
sudo docker info
# disable ipv6 until we're sure routes to fedora mirrors work properly
sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf'
sudo /usr/sbin/sysctl -p
echo "Completed $0."

38
tests/setup_fedora.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -o xtrace
set -o errexit
cat | sudo tee /etc/yum.repos.d/docker.repo << EOF
[docker]
name=Docker Main Repository
baseurl=https://yum.dockerproject.org/repo/main/fedora/21
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
sudo yum install -y libffi-devel openssl-devel docker-engine xfsprogs
# Setup backing disk for use with Docker. This is to ensure we use the ephemeral
# disk provided to the build instance. It ensures the correct disk and storage
# driver are used for Docker. It is recommend to use the thin provisioning
# driver. https://github.com/docker/docker/blob/master/man/docker.1.md
sudo parted /dev/${DEV} -s -- mklabel msdos mkpart pri 1 -1
sudo pvcreate /dev/${DEV}1
sudo vgcreate kolla01 /dev/${DEV}1
sudo lvcreate -n thin01 -L 60G kolla01
sudo lvcreate -n thin01meta -L 2G kolla01
yes | sudo lvconvert --type thin-pool --poolmetadata kolla01/thin01meta kolla01/thin01
# Setup Docker
sudo sed -i -r 's,(ExecStart)=(.+),\1=/usr/bin/docker daemon --storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=kolla01-thin01 --storage-opt dm.use_deferred_removal=true,' /usr/lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl start docker
sudo docker info
# disable ipv6 until we're sure routes to fedora mirrors work properly
sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf'
sudo /usr/sbin/sysctl -p
echo "Completed $0."

View File

@ -1,17 +1,22 @@
#!/bin/bash
set -e
set -o xtrace
set -o errexit
sudo yum install -y libffi-devel openssl-devel
sudo yum install -y http://yum.dockerproject.org/repo/main/fedora/21/Packages/docker-engine-1.7.1-1.fc21.x86_64.rpm
sudo systemctl start docker
sleep 1
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
group_str="jenkins ALL=(:docker) NOPASSWD: ALL"
sudo grep -x "$group_str" /etc/sudoers > /dev/null || sudo bash -c "echo \"$group_str\" >> /etc/sudoers"
# TODO(SamYaple): This check could be much better, but should work for now
if [[ $(hostname | grep rax) ]]; then
export DEV="xvde"
else
echo "Assuming this is an hpcloud box"
export DEV="vdb"
fi
# disable ipv6 until we're sure routes to fedora mirrors work properly
sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf'
sudo /usr/sbin/sysctl -p
# Just for mandre :)
if [[ ! -f /etc/sudoers.d/jenkins ]]; then
echo "jenkins ALL=(:docker) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/jenkins
fi
echo "Completed $0."
distro=$(awk -F'[="]'+ '/^ID/ {print tolower($2); exit}' /etc/*-release)
exec tests/setup_${distro}.sh

15
tests/setup_ubuntu.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -o xtrace
set -o errexit
# Setup Docker repo and add signing key
echo 'deb http://apt.dockerproject.org/repo ubuntu-trusty main' | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-get install -y --no-install-recommends docker-engine btrfs-progs
# We break the gate initially since it will not function until i can test against the ubuntu gate
exit 1
echo "Completed $0."