mirror of
https://github.com/ansible/awx.git
synced 2026-01-29 07:14:43 -03:30
* Run collection sanity tests in CI This requires adding a Makefile install of ansible-core Fake the version to make semver check happy * Fixes from ansible-test sanity failures * Exclude the export module due to awxkit requirement * Fix broken ansible-test rule exceptions remove Ansible 2.14 exclusions that make ansible-test ERROR, saying they are not needed
83 lines
3.0 KiB
YAML
83 lines
3.0 KiB
YAML
---
|
|
- name: Sanity assertions, that some variables have a non-blank value
|
|
assert:
|
|
that:
|
|
- collection_version
|
|
- collection_package
|
|
- collection_path
|
|
|
|
- name: Set the collection version in the controller_api.py file
|
|
replace:
|
|
path: "{{ collection_path }}/plugins/module_utils/controller_api.py"
|
|
regexp: '^ _COLLECTION_VERSION = "0.0.1-devel"'
|
|
replace: ' _COLLECTION_VERSION = "{{ collection_version }}"'
|
|
when:
|
|
- "awx_template_version | default(True)"
|
|
|
|
- name: Set the collection type in the controller_api.py file
|
|
replace:
|
|
path: "{{ collection_path }}/plugins/module_utils/controller_api.py"
|
|
regexp: '^ _COLLECTION_TYPE = "awx"'
|
|
replace: ' _COLLECTION_TYPE = "{{ collection_package }}"'
|
|
|
|
- name: Do file content replacements for non-default namespace or package name
|
|
block:
|
|
|
|
- name: Change module doc_fragments to support desired namespace and package names
|
|
replace:
|
|
path: "{{ item }}"
|
|
regexp: '^extends_documentation_fragment: awx.awx.auth([a-zA-Z0-9_]*)$'
|
|
replace: 'extends_documentation_fragment: {{ collection_namespace }}.{{ collection_package }}.auth\1'
|
|
with_fileglob:
|
|
- "{{ collection_path }}/plugins/inventory/*.py"
|
|
- "{{ collection_path }}/plugins/lookup/*.py"
|
|
- "{{ collection_path }}/plugins/modules/*.py"
|
|
loop_control:
|
|
label: "{{ item | basename }}"
|
|
|
|
- name: Change inventory file to support desired namespace and package names
|
|
replace:
|
|
path: "{{ collection_path }}/plugins/inventory/controller.py"
|
|
regexp: "^ NAME = 'awx.awx.controller' # REPLACE$"
|
|
replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.controller' # REPLACE"
|
|
|
|
- name: Change runtime.yml redirect destinations
|
|
replace:
|
|
path: "{{ collection_path }}/meta/runtime.yml"
|
|
regexp: "awx.awx."
|
|
replace: "{{ collection_namespace }}.{{ collection_package }}."
|
|
|
|
- name: get list of test files
|
|
find:
|
|
paths: "{{ collection_path }}/tests/integration/targets/"
|
|
recurse: true
|
|
register: test_files
|
|
|
|
- name: Change lookup plugin fqcn usage in tests
|
|
replace:
|
|
path: "{{ item.path }}"
|
|
regexp: 'awx.awx'
|
|
replace: '{{ collection_namespace }}.{{ collection_package }}'
|
|
loop: "{{ test_files.files }}"
|
|
|
|
- name: Get sanity tests to work with non-default name
|
|
lineinfile:
|
|
path: "{{ collection_path }}/tests/sanity/ignore-2.10.txt"
|
|
state: absent
|
|
regexp: ' pylint:wrong-collection-deprecated-version-tag$'
|
|
|
|
when:
|
|
- (collection_package != 'awx') or (collection_namespace != 'awx')
|
|
|
|
- name: Template the galaxy.yml file
|
|
template:
|
|
src: "{{ collection_path }}/tools/roles/template_galaxy/templates/galaxy.yml.j2"
|
|
dest: "{{ collection_path }}/galaxy.yml"
|
|
force: true
|
|
|
|
- name: Template the README.md file
|
|
template:
|
|
src: "{{ collection_path }}/tools/roles/template_galaxy/templates/README.md.j2"
|
|
dest: "{{ collection_path }}/README.md"
|
|
force: true
|