Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the CI to test against more recent Ansible/Python/OS versions #51

Merged
merged 6 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Ansible ###
*.retry
.ansible_cache

### Python ###
# Byte-compiled / optimized / DLL files
Expand Down
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
---

language: python
python: 2.7
python:
- "2.7"
- "3.6"

sudo: required

# Enable the docker service
services:
- docker

# Replace aufs with the vfs docker storage driver
# to prevent systemd to fail starting docker in docker.
before_install:
- sudo sed -i 's|DOCKER_OPTS=.*|DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock --storage-driver vfs"|g' /etc/default/docker
- sudo service docker restart
- docker info

# Parallel testing of the supported
# Ansible versions
env:
matrix:
- ANSIBLE=2.5
- ANSIBLE=2.6
- ANSIBLE=2.7
- ANSIBLE=2.8
- ANSIBLE=2.9

# Install tox
install:
- pip install tox-travis

# Test the current PowerDNS Recursor stable release
script:
- tox -- molecule test -s pdns-rec-41
- tox -- molecule test -s pdns-rec-42

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ To test all the scenarios run

To run a custom molecule command

$ tox -e py27-ansible22 -- molecule test -s pdns-rec-41
$ tox -e py27-ansible22 -- molecule test -s pdns-rec-42

## License

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

scenario:
name: pdns-rec-41
name: pdns-rec-42

driver:
name: docker
Expand All @@ -12,41 +12,45 @@ dependency:
platforms:
- name: centos-6
image: centos:6
groups:
- pdns-rec

- name: centos-7
image: centos:7
dockerfile_tpl: centos-systemd
groups:
- pdns-rec

- name: ubuntu-1604
image: ubuntu:16.04
dockerfile_tpl: debian-systemd
groups:
- pdns-rec
# Temporarely disable CentOS 8 due to:
# https://github.com/ansible/ansible/issues/64963
# - name: centos-8
# image: centos:8
# dockerfile_tpl: centos-systemd

- name: ubuntu-1804
image: ubuntu:18.04
groups:
- pdns-rec

- name: debian-8
image: debian:8
groups:
- pdns-rec
dockerfile_tpl: debian-systemd

- name: debian-9
image: debian:9
groups:
- pdns-rec
dockerfile_tpl: debian-systemd

- name: debian-10
image: debian:10
dockerfile_tpl: debian-systemd

provisioner:
name: ansible
options:
diff: True
v: True
config_options:
defaults:
gathering: smart
fact_caching: jsonfile
fact_caching_connection: .ansible_cache
fact_caching_timeout: 7200
ssh_connection:
pipelining: true
inventory:
links:
host_vars: ../resources/host_vars/
playbooks:
create: ../resources/create.yml
destroy: ../resources/destroy.yml
Expand All @@ -66,11 +70,10 @@ lint:
verifier:
name: testinfra
options:
hosts: pdns-rec
vvv: True
directory: ../resources/tests/all
additional_files_or_dirs:
# path relative to 'directory'
- ../repo-41/
# path relative to '../resources/tests/all'
- ../repo-42/
lint:
name: flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---

- hosts: pdns-rec
- hosts: all
vars_files:
- ../resources/vars/pdns-rec-common.yml
- ../resources/vars/pdns-rec-repo-41.yml
- ../resources/vars/pdns-rec-repo-42.yml
roles:
- { role: pdns_recursor-ansible }
43 changes: 23 additions & 20 deletions molecule/pdns-rec-master/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,45 @@ dependency:
platforms:
- name: centos-6
image: centos:6
groups:
- pdns-rec

- name: centos-7
image: centos:7
dockerfile_tpl: centos-systemd
groups:
- pdns-rec

- name: ubuntu-1604
image: ubuntu:16.04
dockerfile_tpl: debian-systemd
groups:
- pdns-rec
# Temporarely disable CentOS 8 due to:
# https://github.com/ansible/ansible/issues/64963
# - name: centos-8
# image: centos:8
# dockerfile_tpl: centos-systemd

- name: ubuntu-1804
image: ubuntu:18.04
groups:
- pdns-rec

- name: debian-8
image: debian:8
groups:
- pdns-rec
dockerfile_tpl: debian-systemd

- name: debian-9
image: debian:9
groups:
- pdns-rec
dockerfile_tpl: debian-systemd

- name: debian-10
image: debian:10
dockerfile_tpl: debian-systemd

provisioner:
name: ansible
options:
diff: True
v: True
config_options:
defaults:
gathering: smart
fact_caching: jsonfile
fact_caching_connection: .ansible_cache
fact_caching_timeout: 7200
ssh_connection:
pipelining: true
inventory:
links:
host_vars: ../resources/host_vars/
playbooks:
create: ../resources/create.yml
destroy: ../resources/destroy.yml
Expand All @@ -66,11 +70,10 @@ lint:
verifier:
name: testinfra
options:
hosts: pdns-rec
vvv: True
directory: ../resources/tests/all
additional_files_or_dirs:
# path relative to 'directory'
# path relative to '../resources/tests/all'
- ../repo-master/
lint:
name: flake8
2 changes: 1 addition & 1 deletion molecule/pdns-rec-master/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- hosts: pdns-rec
- hosts: all
vars_files:
- ../resources/vars/pdns-rec-common.yml
- ../resources/vars/pdns-rec-repo-master.yml
Expand Down
3 changes: 2 additions & 1 deletion molecule/resources/Dockerfile.centos-systemd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ VOLUME [ "/sys/fs/cgroup" ]

CMD ["/usr/sbin/init"]

RUN if [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python python-devel python2-dnf net-tools bash && dnf clean all; \
RUN if [ $(command -v dnf) ] && [ $(rpm -E %{rhel}) -eq 8 ]; then dnf makecache && dnf --assumeyes install python3 python3-devel python*-dnf bash iproute && dnf clean all; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl net-tools bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; fi
3 changes: 3 additions & 0 deletions molecule/resources/host_vars/centos-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

ansible_python_interpreter: "/usr/bin/python3"
2 changes: 1 addition & 1 deletion molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: Prepare the Molecule Test Resources
hosts: pdns-rec
hosts: all
tasks:
# Install rsyslog to capture the PowerDNS Recursor log messages
# when the service is not managed by systemd
Expand Down
2 changes: 1 addition & 1 deletion molecule/resources/tests/all/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ def systemd_override(host):
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
assert 'LimitCORE=infinity' in f.content
assert f.contains('LimitCORE=infinity')
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
def test_repo_file(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-41.list')
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-rec-41.repo')
f = host.file('/etc/yum.repos.d/powerdns-rec-42.repo')

assert f.exists
assert f.user == 'root'
Expand All @@ -18,15 +18,16 @@ def test_repo_file(host):
def test_pdns_repo(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-41.list')
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-rec-41.repo')
f = host.file('/etc/yum.repos.d/powerdns-rec-42.repo')

assert f.exists
assert f.contains('rec-41')
assert f.contains('rec-42')


def test_pdns_version(host):
cmd = host.run('/usr/sbin/pdns_recursor --version')

assert 'PowerDNS Recursor 4.1.' in cmd.stderr
assert 'PowerDNS Recursor' in cmd.stderr
assert '4.2' in cmd.stderr
3 changes: 2 additions & 1 deletion molecule/resources/tests/repo-master/test_repo_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def test_pdns_repo(host):
def test_pdns_version(host):
cmd = host.run('/usr/sbin/pdns_recursor --version')

assert 'PowerDNS Recursor 0.0.' in cmd.stderr
assert 'PowerDNS Recursor' in cmd.stderr
assert 'master' in cmd.stderr
7 changes: 0 additions & 7 deletions molecule/resources/vars/pdns-rec-repo-41.yml

This file was deleted.

7 changes: 7 additions & 0 deletions molecule/resources/vars/pdns-rec-repo-42.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

##
# PowerDNS Recursor 4.2.x Repository
##

pdns_rec_install_repo: "{{ pdns_rec_powerdns_repo_42 }}"
9 changes: 5 additions & 4 deletions tasks/repo-RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
- block:

- name: Install epel-release on CentOS
yum:
package:
name: epel-release
state: present
when: ansible_distribution in [ 'CentOS' ]

- name: Install epel-release on RHEL/OracleLinux
yum:
package:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
state: present
when: ansible_distribution in [ 'RedHat', 'OracleLinux' ]
Expand All @@ -21,6 +21,7 @@
name: yum-plugin-priorities
state: present
when: ansible_distribution in [ 'CentOS' ]
and ansible_pkg_mgr in [ 'yum' ]

- name: Add the PowerDNS Recursor YUM Repository
yum_repository:
Expand All @@ -30,7 +31,7 @@
baseurl: "{{ pdns_rec_install_repo['yum_repo_baseurl'] }}"
gpgkey: "{{ pdns_rec_install_repo['gpg_key'] }}"
gpgcheck: yes
priority: 90
priority: "90"
state: present

- name: Add the PowerDNS Recursor debug symbols YUM Repository
Expand All @@ -41,6 +42,6 @@
baseurl: "{{ pdns_rec_install_repo['yum_debug_symbols_repo_baseurl'] }}"
gpgkey: "{{ pdns_rec_install_repo['gpg_key'] }}"
gpgcheck: yes
priority: 90
priority: "90"
state: present
when: pdns_rec_install_debug_symbols_package
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[tox]
minversion = 1.8
envlist = py{27}-ansible{25,26,27}
envlist = py{27,36}-ansible{27,28,29}
skipsdist = true

[travis:env]
ANSIBLE=
2.5: ansible25
2.6: ansible26
2.7: ansible27
2.8: ansible28
2.9: ansible29

[testenv]
passenv = *
deps =
-rtest-requirements.txt
ansible25: ansible<2.6
ansible26: ansible<2.7
ansible27: ansible<2.8
ansible28: ansible<2.9
ansible29: ansible<2.10
commands =
{posargs:molecule test --all --destroy always}