Restrucutre gate scripts

So we can respect DRY and share as much code as possible I have broken
out the common code between the aio and multinode gate scripts.

Additionally, this lays the ground work for removing our policy on
root-everywhere by using sudo. Once we get the non-root stuff worked
out we can gate as non-root user.

Change-Id: I781c597ab10f2296b95f51ae27e0fa617ffe0a66
Partially-Implements: blueprint multinode-gate
This commit is contained in:
Sam Yaple 2015-11-04 04:58:22 +00:00
parent 6a9beb4a33
commit 3d7a0c6f55
3 changed files with 38 additions and 13 deletions

View File

@ -12,16 +12,7 @@ function print_failure {
exit 1 exit 1
} }
# Setup ssh key as required # Populate globals.yml
ssh-keygen -f kolla-ssh -N ""
cat kolla-ssh.pub | tee /root/.ssh/authorized_keys
# Install Ansible and docker-py
pip install "ansible<2" docker-py
pip freeze | egrep "docker|ansible"
# Setup configs
cp -a etc/kolla /etc/
cat << EOF > /etc/kolla/globals.yml cat << EOF > /etc/kolla/globals.yml
--- ---
kolla_base_distro: "$1" kolla_base_distro: "$1"

31
tests/setup_deploy.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
set -o xtrace
set -o errexit
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
function create_keys {
# Setup ssh key as required
sudo -H ssh-keygen -f /root/.ssh/id_rsa -N ""
sudo -H cat /root/.ssh/id_rsa.pub | sudo -H tee /root/.ssh/authorized_keys
}
function install_deps {
# Install Ansible and docker-py
sudo -H pip install "ansible<2" docker-py
pip freeze | egrep "docker|ansible"
}
function copy_configs {
# Copy configs
sudo cp -a etc/kolla /etc/
}
create_keys
install_deps
copy_configs
# Link the logs directory into root
mkdir -p logs
sudo ln -s $(pwd)/logs /root/logs

View File

@ -70,7 +70,8 @@ commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
bash -c "if [ ! -d .testrepository ]; then testr init; fi" bash -c "if [ ! -d .testrepository ]; then testr init; fi"
sudo -g docker testr run test_build.DeployTestCentosBinary sudo -g docker testr run test_build.DeployTestCentosBinary
sudo tests/deploy_kolla.sh centos binary bash tests/setup_deploy.sh
sudo tests/deploy_aio.sh centos binary
[testenv:deploy-images-centos-source] [testenv:deploy-images-centos-source]
whitelist_externals = find whitelist_externals = find
@ -80,7 +81,8 @@ commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
bash -c "if [ ! -d .testrepository ]; then testr init; fi" bash -c "if [ ! -d .testrepository ]; then testr init; fi"
sudo -g docker testr run test_build.DeployTestCentosSource sudo -g docker testr run test_build.DeployTestCentosSource
sudo tests/deploy_kolla.sh centos source bash tests/setup_deploy.sh
sudo tests/deploy_aio.sh centos source
[testenv:deploy-images-ubuntu-source] [testenv:deploy-images-ubuntu-source]
whitelist_externals = find whitelist_externals = find
@ -90,7 +92,8 @@ commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
bash -c "if [ ! -d .testrepository ]; then testr init; fi" bash -c "if [ ! -d .testrepository ]; then testr init; fi"
sudo -g docker testr run test_build.DeployTestUbuntuSource sudo -g docker testr run test_build.DeployTestUbuntuSource
sudo tests/deploy_kolla.sh ubuntu source bash tests/setup_deploy.sh
sudo tests/deploy_aio.sh ubuntu source
[testenv:functional] [testenv:functional]
whitelist_externals = find whitelist_externals = find