Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit 45394a8

Browse files
authored
Merge pull request #11 from pycontribs/fix/rhel8
Enable testing on RHEL8
2 parents b41bae5 + 2483e52 commit 45394a8

File tree

23 files changed

+255
-73
lines changed

23 files changed

+255
-73
lines changed

.travis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
---
22
dist: xenial
33
# Config file for automatic testing at travis-ci.org
4-
5-
sudo: false
64
services:
75
- docker
86
language: python
97

108
jobs:
119
fast_finish: true
1210
include:
13-
- name: lint
11+
# combined env improve execution speed on travis considerably
12+
- name: lint,py27,distros
1413
python: "3.7"
15-
env: TOXENV=lint
16-
- name: py27
17-
python: "2.7"
18-
env: TOXENV=py27
14+
env: TOXENV=lint,py27,distros
1915
- name: py35
2016
python: "3.5"
2117
env: TOXENV=py35
@@ -37,11 +33,15 @@ install:
3733
- pip install tox
3834

3935
script:
40-
- tox
36+
- travis_wait tox
4137

4238
before_cache:
4339
- rm -rf $HOME/.cache/pip/log
4440

41+
branches:
42+
only:
43+
- master
44+
4545
cache:
4646
directories:
4747
- $HOME/.cache/pip

.yamllint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
document-start: disable
6+
line-length:
7+
max: 999
8+
allow-non-breakable-words: true
9+
allow-non-breakable-inline-mappings: true
10+
key-duplicates: enable
11+
ignore: |
12+
.tox

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Installation
2929

3030
You can install "pytest-molecule" via `pip`_ from `PyPI`_::
3131

32-
$ pip install pytest-molecule
32+
$ PIP_NO_BUILD_ISOLATION=false pip install pytest-molecule
3333

34+
PIP_NO_BUILD_ISOLATION is needed only on ancient python distributions to workaround
35+
https://github.com/pypa/pip/issues/5229
3436

3537
Contributing
3638
------------
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
galaxy_info:
3+
author: Sorin Sbarnea
4+
description: Role that does nothing
5+
license: MIT
6+
7+
min_ansible_version: 2.6
8+
9+
platforms:
10+
- name: Fedora
11+
versions:
12+
- 28
13+
- 29
14+
- 30
15+
- name: CentOS
16+
versions:
17+
- 7
18+
- name: RHEL
19+
versions:
20+
- 7
21+
- 8
22+
- name: Ubuntu
23+
versions:
24+
- Xenial
25+
- Bionic
26+
27+
galaxy_tags: []
28+
29+
dependencies: []
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Molecule managed
2+
3+
{% if item.registry is defined %}
4+
FROM {{ item.registry.url }}/{{ item.image }}
5+
{% else %}
6+
FROM {{ item.image }}
7+
{% endif %}
8+
9+
# Required by RHEL8 image which defaults to non root
10+
USER root
11+
12+
CMD ["sh", "-c", "while true; do sleep 10000; done"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
driver:
3+
name: docker
4+
5+
platforms:
6+
7+
- name: centos7
8+
hostname: centos7
9+
image: centos:7
10+
dockerfile: ../Dockerfile.j2
11+
12+
- name: fedora
13+
hostname: fedora
14+
image: fedora:latest
15+
dockerfile: ../Dockerfile.j2
16+
17+
- name: rhel8
18+
hostname: rhel8
19+
image: ubi8/python-36
20+
registry:
21+
url: registry.access.redhat.com
22+
dockerfile: ../Dockerfile.j2
23+
24+
- name: ubuntu
25+
hostname: ubuntu
26+
image: ubuntu:latest
27+
dockerfile: ../Dockerfile.j2
28+
29+
provisioner:
30+
name: ansible
31+
env:
32+
ANSIBLE_STDOUT_CALLBACK: yaml
33+
log: true
34+
35+
scenario:
36+
test_sequence:
37+
- destroy
38+
- create
39+
- prepare
40+
- converge
41+
- destroy
42+
43+
lint:
44+
enabled: false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
3+
- name: Converge
4+
hosts: all
5+
# avoid gather as setup module fails when python is missing (ubuntu:latest)
6+
gather_facts: false
7+
vars:
8+
test_dir: /root/src
9+
tasks:
10+
11+
- name: ensure-ansible role
12+
include_role:
13+
name: ensure-ansible
14+
15+
- name: Create a directory if it does not exist
16+
file:
17+
path: "{{ test_dir }}"
18+
state: directory
19+
mode: '0755'
20+
21+
- name: Deploy package wheel(s)
22+
copy:
23+
src: "{{ item }}"
24+
dest: "{{ test_dir }}/"
25+
with_fileglob:
26+
- "{{ playbook_dir }}/../../../../../dist/*.whl"
27+
28+
# Setting locales to avoid click error:
29+
# https://click.palletsprojects.com/en/7.x/python3/
30+
# we really need a minimum version of setuptools
31+
# PIP_NO_BUILD_ISOLATION workaround for older pips with partial pep514
32+
- name: Test install to user
33+
shell: |
34+
set -euox pipefail
35+
export LC_ALL=C.UTF-8
36+
export LANG=C.UTF-8
37+
{{ ansible_python.executable }} -m pip install --user 'setuptools>=40.0'
38+
PIP_NO_BUILD_ISOLATION=false {{ ansible_python.executable }} -m pip install --user {{ test_dir }}/*.whl
39+
{{ ansible_python.executable }} -m molecule --version
40+
args:
41+
# ubuntu defaults to /bin/sh which chokes on pipefail
42+
executable: /bin/bash
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
3+
- name: gather_fact fallback block
4+
block:
5+
- name: Attempt to gather facts
6+
setup:
7+
gather_subset: all
8+
9+
rescue:
10+
- name: Attempt to bootstrap python
11+
become_user: root
12+
raw: |
13+
/bin/bash -c "apt-get update && apt-get install -y python3 python3-apt sudo"
14+
15+
- name: Retry gather facts
16+
setup:
17+
gather_subset: all
18+
19+
- name: Include OS specific variables
20+
include_vars: "{{ item }}"
21+
failed_when: false
22+
loop:
23+
- "{{ ansible_os_family | lower }}.yml"
24+
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
25+
- "{{ ansible_distribution | lower }}.yml"
26+
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
27+
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version.split('.')[0:2] | join('-') | lower }}.yml"
28+
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version.split('.')[0:3] | join('-') | lower }}.yml"
29+
30+
# at this stage we may not even have sudo installed
31+
- name: pre-install system packages
32+
when: pre_packages is defined
33+
become_user: root
34+
package:
35+
name: "{{ pre_packages }}"
36+
37+
- name: install system packages
38+
when: packages is defined
39+
become: true
40+
package:
41+
name: "{{ packages }}"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# packages to be installed ASAP, like those enabling new repos
2+
pre_packages:
3+
- epel-release
4+
- sudo
5+
6+
packages:
7+
- bash
8+
- rsync
9+
- gcc # compiling psutil
10+
- python2-devel
11+
- python2-pip
12+
- python2-psutil
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pre_packages:
2+
- sudo
3+
4+
packages:
5+
- bash
6+
- rsync
7+
- gcc # compiling psutil
8+
- python36-devel
9+
- python3-libselinux
10+
11+
# RHEL 8 is missing:
12+
# python3-psutil

0 commit comments

Comments
 (0)