Skip to content

Commit

Permalink
[IMP] .travis.yml: Install an old release (2.0) of LXD from trusty-ba…
Browse files Browse the repository at this point in the history
…ckports (official LXD PPA deprecated/removed and snap does not work on Trusty)
  • Loading branch information
sebalix committed Jan 19, 2018
1 parent c554938 commit 15d810c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
5 changes: 3 additions & 2 deletions tests/travis_lxd/create_container.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
HERE=$(dirname $(readlink -m $0))
CT_DIR="/var/lib/lxd/containers/$1"
# Spawn a LXD container
lxc init ${IMAGE} $1
lxc init ${IMAGE} $1 -c security.privileged=true
lxc config set $1 raw.lxc "lxc.aa_allow_incomplete=1"
if [[ "$IMAGE" == 'images:debian/jessie' ]]; then
$HERE/fix_debian_jessie.sh $1;
Expand All @@ -12,6 +13,6 @@ lxc config set $1 environment.ODOO_VERSION $ODOO_VERSION
lxc config set $1 environment.ODOO_INSTALL_TYPE $ODOO_INSTALL_TYPE
lxc config set $1 environment.ANSIBLE_VERSION $ANSIBLE_VERSION
# Copy the project files into the container
lxc file push -r -p $HERE/../.. $1/opt/
cp -av $HERE/../.. $CT_DIR/rootfs/opt/ansible-odoo
# Install the test environment
lxc exec $1 -- sh -c "/opt/ansible-odoo/tests/install_test_env.sh"
4 changes: 2 additions & 2 deletions tests/travis_lxd/fix_debian_jessie.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
# This script fix the Debian Jessie container by replacing systemd by SysV
#
CT_DIR="/var/lib/lxd/storage-pools/default/containers/$1"
CT_DIR="/var/lib/lxd/containers/$1"
ROOTFS="$CT_DIR/rootfs"
UID_GID=$(ls -n $CT_DIR | grep rootfs | cut -d ' ' -f "3-4")
CT_UID=$(echo $UID_GID | cut -d ' ' -f1)
CT_GID=$(echo $UID_GID | cut -d ' ' -f2)
CT_UID_GID="$CT_UID:$CT_GID"
BRIDGE_IP=$(lxc network show testbr0 | grep ipv4.address | cut -d' ' -f4 | cut -d'/' -f1)
BRIDGE_IP=$(/sbin/ifconfig lxdbr0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}')
# Configure the network of the container
echo -e "nameserver $BRIDGE_IP\nsearch lxd" > $ROOTFS/etc/resolv.conf
cat $ROOTFS/etc/resolv.conf
Expand Down
9 changes: 4 additions & 5 deletions tests/travis_lxd/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
HERE=$(dirname $(readlink -m $0))
# Install and configure LXD on Travis-CI
add-apt-repository -y ppa:ubuntu-lxc/lxd-stable;
debconf-set-selections $HERE/lxd-debconf
echo 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse' > /etc/apt/sources.list.d/backports.list
apt-get -qq update;
apt-get -y install lxd;
apt-get -y install -t trusty-backports ca-certificates lxd;
lxd init --auto
usermod -a -G lxd travis
lxc network create testbr0
lxc network attach-profile testbr0 default eth0
lxc network show testbr0
22 changes: 22 additions & 0 deletions tests/travis_lxd/lxd-debconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
lxd lxd/bridge-ipv4-address string 10.224.136.1
lxd lxd/bridge-ipv4-dhcp-leases string 252
lxd lxd/use-existing-bridge boolean false
lxd lxd/bridge-ipv6-netmask string
lxd lxd/bridge-ipv6 boolean false
lxd lxd/setup-bridge boolean true
lxd lxd/bridge-ipv4-netmask string 24
lxd lxd/bridge-ipv4 boolean true
lxd lxd/bridge-ipv6-address string
lxd lxd/update-profile boolean true
lxd lxd/bridge-name string lxdbr0
lxd lxd/bridge-empty-error note
# lxcbr0 is being replaced by lxdbr0
lxd lxd/bridge-upgrade-warning note
lxd lxd/bridge-ipv6-nat boolean false
lxd lxd/bridge-random-warning note
lxd lxd/bridge-domain string lxd
lxd lxd/bridge-dnsmasq string
lxd lxd/bridge-http-proxy boolean false
lxd lxd/bridge-ipv4-nat boolean true
lxd lxd/bridge-ipv4-dhcp-last string 10.224.136.254
lxd lxd/bridge-ipv4-dhcp-first string 10.224.136.2

0 comments on commit 15d810c

Please sign in to comment.