From 8b20ba1d573c6bac3ac235e628f5685ea631aa6d Mon Sep 17 00:00:00 2001 From: Damian Gerow Date: Wed, 3 May 2017 21:09:38 -0400 Subject: [PATCH] Simplistic testing of the Docker image This simply uses the same LXC system that was just tested. It's functional, but minimal. --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ae0adc43..8e331e9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ python: "2.7" sudo: required dist: trusty +services: + - docker + matrix: fast_finish: true @@ -33,6 +36,9 @@ env: - LXC_NAME=ubuntu1604 LXC_DISTRO=ubuntu LXC_RELEASE=xenial - LXC_NAME=ubuntu1710 LXC_DISTRO=ubuntu LXC_RELEASE=artful +before_install: + - docker build -t travis/algo . + install: - sudo tar xf $HOME/lxc/cache.tar -C / || echo "Didn't extract cache." - export LXC_ROOTFS=/var/lib/lxc/$LXC_NAME/rootfs @@ -41,18 +47,21 @@ install: - export LXC_IP="$(sudo lxc-info -Hin $LXC_NAME)" - sudo /bin/bash -c "printf '\n$LXC_IP test.lxc\n' >> /etc/hosts" - ssh-keygen -f ~/.ssh/id_rsa -t rsa -N '' + - chmod 0644 ~/.ssh/config - sudo mkdir -vm 0700 $LXC_ROOTFS/root/.ssh/ - sudo cp -v ~/.ssh/id_rsa.pub $LXC_ROOTFS/root/.ssh/authorized_keys - sudo apt-get install build-essential libssl-dev libffi-dev python-dev && sudo pip install -r requirements.txt - pip install ansible-lint - gem install awesome_bot + - export DEPLOY_ARGS="server_ip=$LXC_IP server_user=root IP_subject_alt_name=$LXC_IP local_dns=Y" script: # - awesome_bot --allow-dupe --skip-save-results *.md docs/*.md --white-list paypal.com,do.co,microsoft.com,https://github.com/trailofbits/algo/archive/master.zip,https://github.com/trailofbits/algo/issues/new # - shellcheck algo # - ansible-lint deploy.yml users.yml deploy_client.yml - ansible-playbook deploy.yml --syntax-check - - ansible-playbook deploy.yml -t local,vpn,dns,ssh_tunneling,tests -e "server_ip=$LXC_IP server_user=root IP_subject_alt_name=$LXC_IP local_dns=Y" + - ansible-playbook deploy.yml -t local,vpn,dns,ssh_tunneling,tests -e "${DEPLOY_ARGS}" + - docker run -it -v $(pwd)/config.cfg:/algo/config.cfg -v ~/.ssh:/root/.ssh -e "DEPLOY_ARGS=${DEPLOY_ARGS}" travis/algo /bin/sh -c "chown -R 0:0 /root/.ssh && ls -l /root/.ssh && source env/bin/activate && ansible-playbook deploy.yml -t local,vpn,dns,ssh_tunneling,security,tests -e \"${DEPLOY_ARGS}\"" after_script: - ./tests/update-users.sh