Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #44 from lae/feature/ubuntu-bionic
Browse files Browse the repository at this point in the history
Update CI to use Bionic as build host
  • Loading branch information
lae authored May 5, 2020
2 parents b3b86dd + d10cbc6 commit f17a27a
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 72 deletions.
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ python:
- "2.7"
- "3.6"
sudo: required
dist: trusty
dist: bionic
cache:
directories:
- "$HOME/lxc"
pip: true
env:
- ANSIBLE_VERSION='<2.9.0' # 2.7.x
- ANSIBLE_VERSION='~=2.9.0'
matrix:
fast_finish: true
include:
- python: '2.7'
env: ANSIBLE_GIT_VERSION='devel' # 2.9.x development branch
- python: '2.7'
env: ANSIBLE_VERSION='<2.8.0' # 2.7.x
- python: '2.7'
env: ANSIBLE_VERSION='<2.7.0' # 2.6.x
# FIXME: Ansible 2.10.x going through major restructuring.
# https://groups.google.com/forum/#!msg/ansible-project/eXsoOKEd0Mk/XTgbnPWbCAAJ
# - python: '3.6'
# env: ANSIBLE_GIT_VERSION='devel' # 2.10.x development branch
- python: '3.6'
env: ANSIBLE_VERSION='~=2.8.0'
- python: '3.6'
env: ANSIBLE_VERSION='~=2.7.0'
# Install expect here since it's just a normal utility and it's needed for
# reading any playbook errors easily
addons:
apt:
packages:
- expect
install:
- ls -lh $HOME/lxc
- if [ "$ANSIBLE_GIT_VERSION" ]; then pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_GIT_VERSION}.tar.gz";
Expand Down
65 changes: 40 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ valid, idempotent, and functional may look like this:
---
language: python
sudo: required
dist: trusty
dist: bionic
install:
- pip install ansible
- ansible-galaxy install lae.travis-lxc,v0.8.1
- ansible-galaxy install lae.travis-lxc,v0.9.0
- ansible-playbook tests/install.yml -i tests/inventory
before_script: cd tests/
script:
Expand Down Expand Up @@ -60,9 +60,9 @@ build process, but the following is what typically serves most purposes:
vars:
test_profiles:
- profile: debian-buster
- profile: ubuntu-bionic
- profile: centos-7
- profile: alpine-v3.8
- profile: ubuntu-focal
- profile: centos-8
- profile: alpine-v3.11
# Add any other setup tasks you might need but don't necessarily need in your role
- hosts: all
Expand Down Expand Up @@ -121,9 +121,9 @@ And finally, the inventory:

```ini
debian-buster-01
ubuntu-bionic-01
centos-7-01
alpine-v3-8-01
ubuntu-focal-01
centos-8-01
alpine-v3-11-01
```

Hostnames are generated from two parts, a prefix and suffix. By default, these
Expand All @@ -141,10 +141,10 @@ configure in `.travis.yml` and there are various ways to go about it:

```yaml
env:
- ANSIBLE_GIT_VERSION='devel' # 2.9.x development branch
- ANSIBLE_VERSION='<2.9.0' # 2.8.x
- ANSIBLE_VERSION='<2.8.0' # 2.7.x
- ANSIBLE_VERSION='<2.7.0' # 2.6.x
- ANSIBLE_GIT_VERSION='devel'
- ANSIBLE_VERSION='~=2.9.0'
- ANSIBLE_VERSION='~=2.9.0'
- ANSIBLE_VERSION='~=2.7.0'
install:
- if [ "$ANSIBLE_GIT_VERSION" ]; then pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_GIT_VERSION}.tar.gz";
else pip install "ansible${ANSIBLE_VERSION}"; fi
Expand Down Expand Up @@ -196,27 +196,42 @@ profiles include (feel free to request/contribute new ones):

```yaml
test_profiles:
- profile: alpine-v3.11
- profile: alpine-v3.10
- profile: alpine-v3.9
- profile: centos-8
- profile: centos-7
- profile: debian-buster
- profile: debian-stretch
- profile: debian-jessie
- profile: debian-wheezy # EOL
- profile: centos-7
- profile: centos-6
- profile: fedora-32
- profile: fedora-31
- profile: ubuntu-focal
- profile: ubuntu-bionic
- profile: ubuntu-xenial
- profile: ubuntu-trusty
- profile: fedora-28
- profile: fedora-27
- profile: fedora-26 # EOL
- profile: fedora-25 # EOL
```

The following profiles have definitions, but are not necessarily actively
supported as targets by this role (i.e. tests are no longer ran against these),
either because they're officially EOL upstream or are relatively old. No
guarantees are made that they are still functional (but they probably are).

```yaml
test_profiles:
- profile: alpine-v3.8
- profile: alpine-v3.7
- profile: alpine-v3.6
- profile: centos-6
- profile: debian-jessie
- profile: debian-wheezy
- profile: fedora-30
- profile: fedora-29
- profile: fedora-28
- profile: fedora-27
- profile: fedora-26
- profile: fedora-25
- profile: ubuntu-trusty
```

Profiles marked as `EOL` above, while are EOL upstream, are still available, but
no guarantees are made that they are still functional (but they probably are).

You can look at `vars/main.yml` for more information about those profiles.

A test container, if no prefix is specified, is given a hostname of
Expand All @@ -240,7 +255,7 @@ The following creates `ubuntu-app-python2` and `ubuntu-app-python3`:

```yaml
test_profiles:
- profile: ubuntu-bionic
- profile: ubuntu-focal
prefix: ubuntu-
test_host_suffixes:
- app-python2
Expand Down
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ galaxy_info:
author: Musee Ullah
description: Builds and configures LXC container hosts to use for integration testing Ansible roles on Travis CI
license: MIT
min_ansible_version: 2.5
min_ansible_version: 2.7
github_branch: master
platforms:
- name: Ubuntu
versions:
- trusty
- bionic
galaxy_tags:
- development
- ansible
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

- name: Gather minimum subset of facts again with correct interpreter
setup:
gather_subset: "{{ 'min' if ansible_version.full is version_compare('2.4.0', '>=') else 'all' }}"
gather_subset: min

- include: validate_variables.yml
- include: travis_packaging_setup.yml
Expand Down
36 changes: 6 additions & 30 deletions tasks/travis_packaging_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,22 @@
- block:
# This needs to be done using a command module because the apt module is
# broken in the Travis CI virtualenv by default.
# The version is pinned to 1.2.10 to ensure that the version from apt-backport
# is installed - which Travis CI appears to use.
- name: Install libapt-pkg-dev as build dependency for python-apt
command: "apt-get install -y libapt-pkg-dev=1.2.10"
shell: "apt update && apt install -y libapt-pkg-dev"
args:
creates: /usr/lib/x86_64-linux-gnu/libapt-pkg.so
warn: False
retries: 3

# 1.1.0_beta5 is compatible with the above package
- name: Clone the python-apt source repository
git:
repo: https://git.launchpad.net/python-apt
dest: /usr/local/src/python-apt
version: 1.1.0_beta5
depth: 1
retries: 3
become: True

# After this task, the apt module can be used without problem. There's no need
# to be root while running this, so it's outside of the blocks.
- name: Install the python-apt library from local source
# After this task, the apt module can be used without problem.
# 1.6.y branch tracks Xenial
- name: Install the python-apt library from Launchpad
pip:
name: file:///usr/local/src/python-apt
name: "https://git.launchpad.net/python-apt/snapshot/1.6.y.tar.gz"
virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') }}"

- block:
- name: Configure LXC PPA
apt_repository:
repo: "ppa:ubuntu-lxc/stable"

- name: Install needed packages
apt:
name: "{{ travis_lxc_packages }}"
Expand All @@ -50,20 +35,11 @@
file:
path: /usr/share/lxc/templates/lxc-fedora
mode: 0755

- name: Patch Debian's LXC template to use iproute2
patch:
src: debian-iproute2.patch
dest: /usr/share/lxc/templates/lxc-debian

- name: Install updated debian-archive-keyring from Debian 10's repository
apt:
deb: http://ftp.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2019.1_all.deb
become: True

- name: Install LXC Python library
pip:
name: "{{ 'https://github.com/lxc/python3-lxc/archive/python3-lxc-3.0.1.tar.gz' if ansible_python.version.major == 3 else 'lxc_python2' }}"
name: "{{ 'https://github.com/lxc/python3-lxc/archive/python3-lxc-3.0.4.tar.gz' if ansible_python.version.major == 3 else 'lxc_python2' }}"
virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') }}"
retries: 3

Expand Down
4 changes: 0 additions & 4 deletions tests/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@
prefix: debian-buster-test-
- profile: debian-stretch
- profile: debian-jessie
#- profile: debian-wheezy
- profile: centos-7
- profile: centos-6
- profile: ubuntu-bionic
- profile: ubuntu-xenial
- profile: ubuntu-trusty
- profile: fedora-28
- profile: fedora-27
#- profile: fedora-26
#- profile: fedora-25
- profile: alpine-v3.8
- profile: alpine-v3.7
- profile: alpine-v3.6
1 change: 0 additions & 1 deletion tests/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ centos-7-[01:02]
centos-6-[01:02]
ubuntu-bionic-[01:02]
ubuntu-xenial-[01:02]
ubuntu-trusty-[01:02]
fedora-28-[01:02]
fedora-27-[01:02]
alpine-v3-8-[01:02]
Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ travis_lxc_packages:
- yum
- debootstrap
- debian-archive-keyring
- expect-dev
- expect
- pigz
- patch
travis_lxc_network_config:
Expand Down

0 comments on commit f17a27a

Please sign in to comment.