Setup the gate for cross-distro support
Split the gate into two specific scripts to support multiple distros Add ubuntu script. Co-Authored-By: Steven Dake <stdake@cisco.com> Change-Id: I23b9dee409b9e678422cd58525e1836541eb64da Partially-Implements: blueprint gate-source-builds
This commit is contained in:
parent
eb05118a3f
commit
8e1b0f817a
38
tests/setup_centos.sh
Executable file
38
tests/setup_centos.sh
Executable 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
38
tests/setup_fedora.sh
Executable 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."
|
@ -1,17 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -o xtrace
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
sudo yum install -y libffi-devel openssl-devel
|
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
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
|
|
||||||
|
|
||||||
group_str="jenkins ALL=(:docker) NOPASSWD: ALL"
|
# TODO(SamYaple): This check could be much better, but should work for now
|
||||||
sudo grep -x "$group_str" /etc/sudoers > /dev/null || sudo bash -c "echo \"$group_str\" >> /etc/sudoers"
|
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
|
# Just for mandre :)
|
||||||
sudo sh -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf'
|
if [[ ! -f /etc/sudoers.d/jenkins ]]; then
|
||||||
sudo /usr/sbin/sysctl -p
|
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
15
tests/setup_ubuntu.sh
Executable 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."
|
Loading…
Reference in New Issue
Block a user