Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
ansible-pulp CI should test the calling roles from dynamic
Browse files Browse the repository at this point in the history
"include_role" with the source dirs of the branch

Implementation includes:
1. new source-dynamic scenario, using vars from example-source
2. "dynamic" now uses same vars as in example-use (which facilitates
documentation for users.)

fixes: #6071
https://pulp.plan.io/issues/6071
  • Loading branch information
mikedep333 committed Feb 6, 2020
1 parent cd78e2f commit 7e65186
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 59 deletions.
1 change: 1 addition & 0 deletions molecule/dynamic/group_vars
14 changes: 0 additions & 14 deletions molecule/dynamic/group_vars/all

This file was deleted.

9 changes: 7 additions & 2 deletions molecule/dynamic/playbook.yml
Expand Up @@ -8,11 +8,16 @@
that: "ansible_version.full is version_compare('2.8', '>=')"
msg: >
"You must update Ansible to at least 2.8 to use this version of Pulp 3 Installer."
tasks:
- name: Dynamically include prereq roles
include_role:
name: "{{ roleinputvar }}"
loop: "{{ pulp_roles }}"
loop:
- pulp-database
- pulp-workers
- pulp-resource-manager
- pulp-webserver
- pulp-content
loop_control:
loop_var: roleinputvar
environment:
Expand Down
1 change: 1 addition & 0 deletions molecule/source-dynamic/.ansible-lint
1 change: 1 addition & 0 deletions molecule/source-dynamic/Dockerfile.j2
1 change: 1 addition & 0 deletions molecule/source-dynamic/debian-redis-server.service
1 change: 1 addition & 0 deletions molecule/source-dynamic/group_vars
57 changes: 57 additions & 0 deletions molecule/source-dynamic/molecule.yml
@@ -0,0 +1,57 @@
---
dependency:
name: galaxy
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
# This is ignored by molecule, but can be reused in yaml
.platform_base: &platform_base
privileged: False
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
tmpfs:
- /tmp
- /run
- /run/lock
capabilities:
- NET_ADMIN
- NET_RAW
platforms:
- <<: *platform_base
name: debian-10
image: debian:buster
command: /sbin/init
- <<: *platform_base
name: fedora-31
image: fedora:31
command: /usr/sbin/init
provisioner:
name: ansible
inventory:
links:
host_vars: ../scenario_resources/host_vars/
group_vars: ../scenario_resources/group_vars/
lint:
name: ansible-lint
scenario:
name: source-dynamic
test_sequence:
- lint
- dependency
- syntax
- create
- prepare
- converge
- idempotence
- side_effect
- verify
playbooks:
prepare: prepare.yml

verifier:
name: inspec
lint:
name: rubocop
enabled: false
25 changes: 25 additions & 0 deletions molecule/source-dynamic/playbook.yml
@@ -0,0 +1,25 @@
---
- hosts: all
pre_tasks:
# The version string below is the highest of all those in roles' metadata:
# "min_ansible_version". It needs to be kept manually up-to-date.
- name: Verify Ansible meets min required version
assert:
that: "ansible_version.full is version_compare('2.8', '>=')"
msg: >
"You must update Ansible to at least 2.8 to use this version of Pulp 3 Installer."
tasks:
- name: Dynamically include prereq roles
include_role:
name: "{{ roleinputvar }}"
loop:
- pulp-database
- pulp-workers
- pulp-resource-manager
- pulp-webserver
- pulp-content
- pulp-devel
loop_control:
loop_var: roleinputvar
environment:
DJANGO_SETTINGS_MODULE: pulpcore.app.settings
1 change: 1 addition & 0 deletions molecule/source-dynamic/prepare.yml
1 change: 1 addition & 0 deletions molecule/source-dynamic/requirements.yml
1 change: 1 addition & 0 deletions molecule/source-dynamic/roles
42 changes: 0 additions & 42 deletions molecule/source-upgrade/prepare.yml

This file was deleted.

1 change: 1 addition & 0 deletions molecule/source-upgrade/prepare.yml
6 changes: 5 additions & 1 deletion tox.ini
Expand Up @@ -34,7 +34,11 @@ sitepackages = {[testenv]sitepackages}
deps = {[testenv]deps}
passenv = {[testenv]passenv}
whitelist_externals = {[testenv]whitelist_externals}
commands = {env:TRAVIS_WAIT:} molecule test -s dynamic
commands =
{env:TRAVIS_WAIT:} molecule test -s dynamic
molecule destroy -s dynamic
molecule test -s source-dynamic
# only the last scenario should lack a "destroy" task. (It wastes time, and makes debugging more difficult.)

[testenv:py36-dynamic]
sitepackages = {[testenv]sitepackages}
Expand Down

0 comments on commit 7e65186

Please sign in to comment.