Skip to content

Commit

Permalink
add dockerfile for molecule (#11)
Browse files Browse the repository at this point in the history
* add dockerfile for molecule

* update contributing md

Co-authored-by: SIANOBRI <[email protected]>
  • Loading branch information
salob and salob authored Oct 5, 2021
1 parent aa30d06 commit a9bdf08
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 4 deletions.
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Contributions must meet a minimum criteria:
* Can be installed using `pip install -r ci-requirements.txt`
* Repository cloned to `.../ansible_collections/<collection_namespace>/<collection_name>`

## Dev Environment

We use Molecule for testing our roles and have written converge playbooks and tests for all roles. We have developed a molecule image that can be used for development. Follow the instructions on Docker Hub:
https://hub.docker.com/r/spmdevops/molecule

The Dockerfile that was used to create this image is located in the root directory.

## Creating a new role

The role must have a minimum of
Expand All @@ -50,7 +57,7 @@ These playbooks may be run using the `molecule [converge|verify] -s scenario_nam

### Python venv

Using a python virtual environment is recommended for running molecule tests locally. Create it in the collection root (the root of your repository) with the `venv` command.
Using a python virtual environment is recommended for running molecule tests locally. Create it in the collection root (the root of your repository) with the `venv` command.

Using a venv lets you keep all the packages and requirements for your molecule tests in an isolated environment that can be cleaned easily from your machine.

Expand Down
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM docker:dind

RUN apk add --no-cache bash \
py3-pip \
gcc \
libvirt \
rsync \
py3-bcrypt \
py3-botocore \
py3-certifi \
py3-cffi \
py3-chardet \
py3-click \
py3-colorama \
py3-cryptography \
py3-docutils \
py3-flake8 \
py3-idna \
py3-jinja2 \
py3-mccabe \
py3-netifaces \
py3-paramiko \
py3-pbr \
py3-pexpect \
py3-pip \
py3-pluggy \
py3-psutil \
py3-ptyprocess \
py3-py \
py3-pycodestyle \
py3-pynacl \
py3-pytest \
py3-requests \
py3-ruamel \
py3-setuptools \
py3-urllib3 \
py3-virtualenv \
py3-websocket-client \
&& rm -rf /var/cache/apk/* \
&& pip install --upgrade pip \
&& pip install --upgrade setuptools

WORKDIR /opt

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt
92 changes: 89 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
ansible
passlib
jmespath
ansible==4.6.0
ansible-compat==0.5.0
ansible-core==2.11.5
ansible-lint==5.1.3
appdirs==1.4.4
arrow==1.1.1
asn1crypto==1.4.0
atomicwrites==1.4.0
attrs==20.3.0
bcrypt==3.2.0
binaryornot==0.4.4
botocore==1.20.93
bracex==2.1.1
CacheControl==0.12.6
Cerberus==1.3.2
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
click==8.0.1
click-help-colors==0.9.1
colorama==0.4.4
commonmark==0.9.1
contextlib2==0.6.0
cookiecutter==1.7.3
cryptography==3.3.2
distlib==0.3.1
distro==1.5.0
docker==5.0.2
docutils==0.16
enrich==1.2.6
filelock==3.0.12
flake8==3.9.2
html5lib==1.1
idna==3.2
iniconfig==0.0.0
Jinja2==3.0.1
jinja2-time==0.2.0
jmespath==0.10.0
lockfile==0.12.2
MarkupSafe==2.0.1
mccabe==0.6.1
molecule==3.5.1
molecule-docker==1.0.2
more-itertools==8.8.0
msgpack==1.0.2
netifaces==0.11.0
ordered-set==4.0.2
packaging==20.9
paramiko==2.7.2
pathspec==0.9.0
pbr==5.6.0
pep517==0.10.0
pexpect==4.8.0
pluggy==0.13.1
poyo==0.5.0
progress==1.5
psutil==5.8.0
ptyprocess==0.7.0
py==1.10.0
pyasn1==0.4.8
pycodestyle==2.7.0
pycparser==2.20
pyflakes==2.3.0
Pygments==2.10.0
PyNaCl==1.4.0
pyparsing==2.4.7
pytest==6.2.4
python-dateutil==2.8.1
python-slugify==5.0.2
PyYAML==5.4.1
requests==2.25.1
resolvelib==0.5.4
retrying==1.3.3
rich==10.10.0
ruamel.yaml==0.16.12
ruamel.yaml.clib==0.2.2
selinux==0.2.1
six==1.15.0
subprocess-tee==0.3.4
tenacity==8.0.1
text-unidecode==1.3
toml==0.10.2
urllib3==1.26.5
virtualenv==20.4.2
wcmatch==8.2
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.58.0
yamllint==1.26.3

0 comments on commit a9bdf08

Please sign in to comment.