Skip to content

Commit

Permalink
Merge pull request #25 from systemli/molecule4
Browse files Browse the repository at this point in the history
Run molecule 5
  • Loading branch information
0x46616c6b authored May 9, 2023
2 parents ff6ede4 + d982d18 commit 283b9ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/ansible-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ on:
description: "Default pip dependencies for molecule"
type: string
default: |
molecule[docker]
molecule-goss
molecule==5.0.1
molecule-plugins[docker]
jmespath
role-dependencies:
required: false
description: "Default role dependencies for ansible (empty)"
type: string
default: ""
molecule-config:
required: false
description: "Configuration for molecule"
Expand All @@ -33,9 +28,11 @@ on:
platforms:
- name: instance
image: "geerlingguy/docker-\$\{MOLECULE_DISTRO:-debian11\}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
command: ""
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
Expand Down Expand Up @@ -73,9 +70,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup yq
uses: mikefarah/[email protected]

- name: Prepare Molecule Tests
run: |
# Creating required directories
Expand All @@ -84,33 +78,25 @@ jobs:
echo "${{ inputs.python-dependencies }}" > molecule/requirements.txt
# Writing molecule config for docker
echo "${{ inputs.molecule-config}}" > molecule/github/molecule.yml
# Writing ansible role requirements
echo "${{ inputs.role-dependencies }}" > molecule/requirements.yml
# Add prepare playbook if exists
if test -f "molecule/default/prepare.yml"; then
yq e --inplace '.provisioner.playbooks += {"prepare":"../default/prepare.yml"}' molecule/github/molecule.yml
fi
# Add verify playbook if exists
if test -f "molecule/default/verify.yml"; then
yq e --inplace '.provisioner.playbooks += {"verify":"../default/verify.yml"}' molecule/github/molecule.yml
yq e --inplace '. += {"verifier": {"name": "goss", "directory": "../default/tests/"}}' molecule/github/molecule.yml
fi
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: "molecule/requirements.txt"

- name: Install Dependencies
- name: Install testing dependencies
run: pip3 install -r molecule/requirements.txt

- name: Install Ansible Role Requirements
run: ansible-galaxy install -r molecule/requirements.yml
if: inputs.role-dependencies != ''
run: ansible-galaxy install -r requirements.yml
continue-on-error: true

- name: Disable AppArmor (MySQL)
run: |
Expand All @@ -132,7 +118,6 @@ jobs:
echo "Print molecule/default/converge.yml"
cat molecule/default/converge.yml
if [ -f "molecule/default/prepare.yml" ]; then echo "Print molecule/default/prepare.yml" && cat molecule/default/prepare.yml; fi
if [ -f "molecule/default/verify.yml" ]; then echo "Print molecule/default/verify.yml" && cat molecule/default/verify.yml; fi
- name: Molecule Test
run: molecule test -s github
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
|---|---|---|---|
| distros | string | '[ "debian11", "debian10" ]' | List of distributions to test against the Role |
| python-dependencies | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Default pip dependencies for molecule |
| role-dependencies | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Default role dependencies for ansible (empty)|
| molecule-config | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Configuration for molecule |
| disable-apparmor-mysql | boolean | false | Disable AppArmor MySQL Profile for the Job Runner |

Expand Down

0 comments on commit 283b9ab

Please sign in to comment.