From a9bdf08b295cc27bc187f5fee888b0c1a45f71c9 Mon Sep 17 00:00:00 2001 From: sian Date: Tue, 5 Oct 2021 17:26:07 +0100 Subject: [PATCH] add dockerfile for molecule (#11) * add dockerfile for molecule * update contributing md Co-authored-by: SIANOBRI --- CONTRIBUTING.md | 9 ++++- Dockerfile | 47 +++++++++++++++++++++++++ requirements.txt | 92 ++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3bb63c8f..91696fde 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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//` +## 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 @@ -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. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7200bd34 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/requirements.txt b/requirements.txt index 789efa97..0a06368c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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