diff --git a/.zuul.d/base-jobs.yaml b/.zuul.d/base-jobs.yaml deleted file mode 100644 index 95632143..00000000 --- a/.zuul.d/base-jobs.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Equivalent to tox -e ansible-integration -- job: - name: ara-basic-ansible-integration - parent: base - nodeset: fedora-latest - run: tests/basic.yaml - vars: - ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara" diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index a875fe25..b2854331 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -95,3 +95,38 @@ Deploys the ARA API server on Fedora 30 using distribution packages for ARA and Ansible. run: tests/with_fedora_packages.yaml + +- job: + name: ara-ansible-integration-base + parent: ara-integration-base + nodeset: ara-fedora-30 + vars: + ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara" + run: tests/basic.yaml + +- job: + name: ara-basic-ansible-devel + parent: ara-ansible-integration-base + description: | + Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible devel. + required-projects: + - name: github.com/ansible/ansible + override-checkout: devel + +- job: + name: ara-basic-ansible-2.8 + parent: ara-ansible-integration-base + description: | + Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible 2.8. + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.8 + +- job: + name: ara-basic-ansible-2.7 + parent: ara-ansible-integration-base + description: | + Runs basic integration tests through the equivalent of "tox -e ansible-integration" with Ansible 2.7. + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.7 diff --git a/.zuul.d/project.yaml b/.zuul.d/project.yaml index 3b7b6269..8540e49c 100644 --- a/.zuul.d/project.yaml +++ b/.zuul.d/project.yaml @@ -10,13 +10,12 @@ - ara-api-postgresql - ara-api-fedora-packages: voting: false - - ansible-role-ara-api-fedora-devel - - ansible-role-ara-api-fedora-2.9 - - ansible-role-ara-api-ubuntu-2.8 - - ansible-role-ara-api-ubuntu-2.7 + - ara-basic-ansible-devel: + voting: false + - ara-basic-ansible-2.8 + - ara-basic-ansible-2.7 - ansible-role-ara-web-ubuntu - ansible-role-ara-web-fedora - - ara-basic-ansible-integration - ara-tox-linters - ara-tox-py3 gate: @@ -24,13 +23,10 @@ - ara-api-distributed-sqlite - ara-api-mysql - ara-api-postgresql - - ansible-role-ara-api-fedora-devel - - ansible-role-ara-api-fedora-2.9 - - ansible-role-ara-api-ubuntu-2.8 - - ansible-role-ara-api-ubuntu-2.7 + - ara-basic-ansible-2.8 + - ara-basic-ansible-2.7 - ansible-role-ara-web-ubuntu - ansible-role-ara-web-fedora - - ara-basic-ansible-integration - ara-tox-linters - ara-tox-py3 post: diff --git a/.zuul.d/role-jobs.yaml b/.zuul.d/role-jobs.yaml index b92938d7..861d481c 100644 --- a/.zuul.d/role-jobs.yaml +++ b/.zuul.d/role-jobs.yaml @@ -1,73 +1,3 @@ -- job: - name: ansible-role-ara-api-base - parent: base - files: - - ara/* - - playbooks/* - - roles/* - - tests/* - - .zuul.d/* - - setup.py - - setup.cfg - - requirements.txt - - test-requirements.txt - pre-run: tests/role-integration-pre.yaml - post-run: tests/role-integration-post.yaml - vars: - ara_tests_cleanup: false - ara_api_source: "{{ ansible_user_dir }}/src/opendev.org/recordsansible/ara" - ara_api_version: HEAD - ara_api_log_level: DEBUG - ara_api_debug: true - ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests" - ara_tests_ansible_name: "{{ ansible_user_dir }}/src/github.com/ansible/ansible" - ara_tests_ansible_version: null - required-projects: - - name: github.com/ansible/ansible - override-checkout: stable-2.9 - -- job: - name: ansible-role-ara-api-ubuntu - parent: ansible-role-ara-api-base - nodeset: ubuntu-bionic - -- job: - name: ansible-role-ara-api-fedora - parent: ansible-role-ara-api-base - nodeset: ara-fedora-30 - -- job: - name: ansible-role-ara-api-fedora-devel - parent: ansible-role-ara-api-fedora - run: tests/with_defaults.yaml - required-projects: - - name: github.com/ansible/ansible - override-checkout: devel - -- job: - name: ansible-role-ara-api-fedora-2.9 - parent: ansible-role-ara-api-fedora - run: tests/with_defaults.yaml - required-projects: - - name: github.com/ansible/ansible - override-checkout: stable-2.9 - -- job: - name: ansible-role-ara-api-ubuntu-2.8 - parent: ansible-role-ara-api-ubuntu - run: tests/with_defaults.yaml - required-projects: - - name: github.com/ansible/ansible - override-checkout: stable-2.8 - -- job: - name: ansible-role-ara-api-ubuntu-2.7 - parent: ansible-role-ara-api-ubuntu - run: tests/with_defaults.yaml - required-projects: - - name: github.com/ansible/ansible - override-checkout: stable-2.7 - # ara-web jobs - job: name: ansible-role-ara-web-base diff --git a/tests/basic.yaml b/tests/basic.yaml index 5f40cbcc..20a97dd6 100644 --- a/tests/basic.yaml +++ b/tests/basic.yaml @@ -19,30 +19,24 @@ - name: Basic ARA tests without Ansible roles hosts: all vars: - ara_tests_ansible_name: ansible - ara_tests_ansible_version: latest ara_api_root_dir: "{{ ansible_user_dir }}/.ara-tests" ara_api_venv_path: "{{ ara_api_root_dir }}/virtualenv" ara_api_secret_key: testing ara_api_debug: true ara_api_log_level: DEBUG tasks: - - name: Ensure root directory exists - file: - path: "{{ ara_api_root_dir }}" - state: directory - - - name: Set source to checked out repository if it isn't specified + # The name can be "ansible" when installing from pip or the path to an + # Ansible git repository on-disk. + # We're handling it here to allow various levels of variable precedence. + - name: Set default Ansible name if unset set_fact: - ara_api_source: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}" - when: ara_api_source is not defined or ara_api_source is none + ara_tests_ansible_name: ansible + when: ara_tests_ansible_name is not defined or ara_tests_ansible_name is none - - name: Ensure python3-venv is installed for Ubuntu - become: yes - package: - name: python3-venv - state: present - when: ansible_distribution == "Ubuntu" + - name: Set default Ansible version is unset + set_fact: + ara_tests_ansible_version: latest + when: ara_tests_ansible_version is not defined or ara_tests_ansible_version is none # If a version is not explicitly set we want to make sure to # completely omit the version argument to pip, as it will be coming @@ -59,6 +53,23 @@ _install_ansible_state: latest when: ara_tests_ansible_version == "latest" + - name: Set source to checked out repository if it isn't specified + set_fact: + ara_api_source: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}" + when: ara_api_source is not defined or ara_api_source is none + + - name: Ensure root directory exists + file: + path: "{{ ara_api_root_dir }}" + state: directory + + - name: Ensure python3-venv is installed for Ubuntu + become: yes + package: + name: python3-venv + state: present + when: ansible_distribution == "Ubuntu" + - name: Initialize virtual environment with Ansible pip: name: "{{ ara_tests_ansible_name }}" @@ -86,35 +97,38 @@ ANSIBLE_ACTION_PLUGINS: "{{ ara_setup_plugins.stdout }}/action" ARA_DEBUG: "{{ ara_api_debug }}" ARA_LOG_LEVEL: "{{ ara_api_log_level }}" - ARA_BASE_DIR: "{{ ara_api_root_dir }}" + ARA_BASE_DIR: "{{ ara_api_root_dir }}/server" ARA_SECRET_KEY: "{{ ara_api_secret_key }}" ARA_API_CLIENT: "{{ ara_api_client | default('offline') }}" ARA_API_SERVER: "{{ ara_api_server | default('http://127.0.0.1:8000') }}" + PATH: "{{ ara_api_venv_path }}/bin:/bin:/usr/bin:/usr/local/bin" vars: - _ansible_playbook: "{{ ara_api_venv_path }}/bin/ansible-playbook -vvv" _test_root: "{{ ara_api_source }}/tests/integration" block: # smoke.yaml tests setting ara_playbook_name in one of three plays - name: Run smoke.yaml integration test - command: "{{ _ansible_playbook }} {{ _test_root }}/smoke.yaml" + command: "ansible-playbook -vvv {{ _test_root }}/smoke.yaml" - name: Run hosts.yaml integration test - command: "{{ _ansible_playbook }} {{ _test_root }}/hosts.yaml" + command: "ansible-playbook -vvv {{ _test_root }}/hosts.yaml" - name: Run import.yaml integration test - command: "{{ _ansible_playbook }} {{ _test_root }}/import.yaml" + command: "ansible-playbook -vvv {{ _test_root }}/import.yaml" # Tests setting ara_playbook_name as an extra var - name: Run failed.yaml integration test command: > - {{ _ansible_playbook }} {{ _test_root }}/failed.yaml -e ara_playbook_name="Failed playbook" + ansible-playbook -vvv {{ _test_root }}/failed.yaml -e ara_playbook_name="Failed playbook" ignore_errors: yes - name: Run incomplete.yaml integration test shell: | - {{ _ansible_playbook }} {{ _test_root }}/incomplete.yaml & + ansible-playbook -vvv {{ _test_root }}/incomplete.yaml & sleep 5 kill $! args: executable: /bin/bash ignore_errors: yes + + - name: Generate static report + command: ara-manage generate {{ ara_api_root_dir }}/static