lae / ansible-role-travis-lxc

Ansible role that prepares a Travis CI environment and creates LXC containers for testing roles.
MIT License
4 stars 2 forks source link

Adds Ansible Devel branch test #12

Closed wilmardo closed 6 years ago

wilmardo commented 6 years ago

Fixes #11 Test added for Devel branch, this could be extended by defining more ANSIBLE_VERSION variables. The following for example to test all the not EOL releases:

- LXC_DISTRO=ubuntu LXC_RELEASE=xenial ANSIBLE_VERSION='ansible>=2.2.0,<2.3.0' #2.2.x
- LXC_DISTRO=ubuntu LXC_RELEASE=xenial ANSIBLE_VERSION='ansible>=2.3.0,<2.4.0' #2.3.x
- LXC_DISTRO=ubuntu LXC_RELEASE=xenial ANSIBLE_VERSION='ansible>=2.4.0,<2.5.0' #2.4.x
- LXC_DISTRO=ubuntu LXC_RELEASE=xenial ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL

I choose Ubuntu Xenial since Ubuntu seems to be the most popular choice and the change that an Ansible bug depends on an OS seems slim. But you could test the devel branch on each os also like this:

- LXC_DISTRO=debian LXC_RELEASE=stretch ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=debian LXC_RELEASE=jessie ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=debian LXC_RELEASE=wheezy ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=ubuntu LXC_RELEASE=xenial ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=ubuntu LXC_RELEASE=trusty ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=ubuntu LXC_RELEASE=precise ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=centos LXC_RELEASE=7 ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL
- LXC_DISTRO=centos LXC_RELEASE=6 ANSIBLE_VERSION='git+https://github.com/ansible/ansible.git@devel' #2.5 DEVEL

What would you prefer as test approach? Personally I would add the first example to be sure it works on every supported version. The second example seems overkill (also doubles the time to complete tests) and could be added later if issues arise on different platforms.

PS. The documentation update will come soon I hope, writing docs takes more time then coding ;)

lae commented 6 years ago

Since I have a limit of running 5 builds at once, preferably the fewer builds the better (especially considering it runs once a day). I agree that just testing against one distribution should be good enough.

Will review shortly.

lae commented 6 years ago

Okay yeah, just finished reading - go ahead and update this PR with the first approach and I'll merge it. Thanks a lot!

wilmardo commented 6 years ago

No problem, had made this before for my own roles :)

Updated the Travis playbook with the first approach and it resulted in the 2.2.x and 2.3.x tests to fail. So I renamed the replace parameter path to dest, it was known before Ansible 2.3 as dest (source). This made the 2.2.x role fail on the same error as the 2.3.x test, the first use of the lxc_container module fails

TASK [ansible-role-travis-lxc : Create Ubuntu Xenial Xerus (16.04) test container(s)] ***

fatal: [localhost]: FAILED! => {"failed": true, "msg": "Could not find imported module support code for lxc_container.  Looked for either BOOLEANS_FALSE.py or convert_bool.py"}

I did some research and I personally have no clue why this is happening, all the requirements seem to be fulfilled and the lxc_container module is merged since Ansible 1.8.0. Maybe @lae could have a look?

lae commented 6 years ago

To resolve #10 I vendored in a patched lxc_container module within the role. I guess there're some incompatible changes introduced into the module in 2.4, so I'm working through it right now in https://github.com/lae/ansible-role-travis-lxc/tree/test/lxc_container_backport

lae commented 6 years ago

So Travis is having some issues still. I'll come back to this later tonight.