mirror of
https://github.com/ansible/awx.git
synced 2026-02-13 16:07:29 -03:30
Merge pull request #6156 from AlanCoding/collection_install
Unify collection targets for install and ansible-test Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
24
Makefile
24
Makefile
@@ -402,6 +402,7 @@ prepare_collection_venv:
|
|||||||
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
|
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
|
||||||
COLLECTION_PACKAGE ?= awx
|
COLLECTION_PACKAGE ?= awx
|
||||||
COLLECTION_NAMESPACE ?= awx
|
COLLECTION_NAMESPACE ?= awx
|
||||||
|
COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE)
|
||||||
|
|
||||||
test_collection:
|
test_collection:
|
||||||
@if [ "$(VENV_BASE)" ]; then \
|
@if [ "$(VENV_BASE)" ]; then \
|
||||||
@@ -414,27 +415,26 @@ flake8_collection:
|
|||||||
|
|
||||||
test_collection_all: prepare_collection_venv test_collection flake8_collection
|
test_collection_all: prepare_collection_venv test_collection flake8_collection
|
||||||
|
|
||||||
test_collection_sanity:
|
|
||||||
rm -rf sanity
|
|
||||||
mkdir -p sanity/ansible_collections/$(COLLECTION_NAMESPACE)
|
|
||||||
cp -Ra awx_collection sanity/ansible_collections/$(COLLECTION_NAMESPACE)/awx # symlinks do not work
|
|
||||||
cd sanity/ansible_collections/$(COLLECTION_NAMESPACE)/awx && git init && git add . # requires both this file structure and a git repo, so there you go
|
|
||||||
cd sanity/ansible_collections/$(COLLECTION_NAMESPACE)/awx && ansible-test sanity
|
|
||||||
|
|
||||||
# WARNING: symlinking a collection is fundamentally unstable
|
# WARNING: symlinking a collection is fundamentally unstable
|
||||||
# this is for rapid development iteration with playbooks, do not use with other test targets
|
# this is for rapid development iteration with playbooks, do not use with other test targets
|
||||||
symlink_collection:
|
symlink_collection:
|
||||||
rm -rf ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)
|
rm -rf $(COLLECTION_INSTALL)
|
||||||
mkdir -p ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)
|
mkdir -p ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE) # in case it does not exist
|
||||||
ln -s $(shell pwd)/awx_collection ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/awx
|
ln -s $(shell pwd)/awx_collection $(COLLECTION_INSTALL)
|
||||||
|
|
||||||
build_collection:
|
build_collection:
|
||||||
ansible-playbook -i localhost, awx_collection/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION)
|
ansible-playbook -i localhost, awx_collection/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION)
|
||||||
ansible-galaxy collection build awx_collection --force --output-path=awx_collection
|
ansible-galaxy collection build awx_collection --force --output-path=awx_collection
|
||||||
|
|
||||||
install_collection: build_collection
|
install_collection: build_collection
|
||||||
rm -rf ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/awx
|
rm -rf $(COLLECTION_INSTALL)
|
||||||
ansible-galaxy collection install awx_collection/$(COLLECTION_NAMESPACE)-awx-$(VERSION).tar.gz
|
ansible-galaxy collection install awx_collection/$(COLLECTION_NAMESPACE)-$(COLLECTION_PACKAGE)-$(VERSION).tar.gz
|
||||||
|
|
||||||
|
test_collection_sanity: install_collection
|
||||||
|
cd $(COLLECTION_INSTALL) && ansible-test sanity
|
||||||
|
|
||||||
|
test_collection_integration: install_collection
|
||||||
|
cd $(COLLECTION_INSTALL) && ansible-test integration
|
||||||
|
|
||||||
test_unit:
|
test_unit:
|
||||||
@if [ "$(VENV_BASE)" ]; then \
|
@if [ "$(VENV_BASE)" ]; then \
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ inside the folder `lib/ansible/modules/web_infrastructure/ansible_tower`
|
|||||||
as well as other folders for the inventory plugin, module utils, and
|
as well as other folders for the inventory plugin, module utils, and
|
||||||
doc fragment.
|
doc fragment.
|
||||||
|
|
||||||
|
## Building and Installing
|
||||||
|
|
||||||
|
This collection templates the `galaxy.yml` file it uses.
|
||||||
|
Run `make build_collection` from the root folder of the AWX source tree.
|
||||||
|
This will create the `tar.gz` file inside the `awx_collection` folder
|
||||||
|
with the current AWX version, for example: `awx_collection/awx-awx-9.2.0.tar.gz`.
|
||||||
|
|
||||||
|
Installing the `tar.gz` involves no special instructions.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Modules in this collection may have any of the following python requirements:
|
||||||
|
|
||||||
|
- the official [AWX CLI](https://docs.ansible.com/ansible-tower/latest/html/towercli/index.html)
|
||||||
|
- the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/)
|
||||||
|
- no requirements
|
||||||
|
|
||||||
|
See requirements in the `DOCUMENTATION` string specific to each module.
|
||||||
|
|
||||||
## Release and Upgrade Notes
|
## Release and Upgrade Notes
|
||||||
|
|
||||||
The release 7.0.0 of the `awx.awx` collection is intended to be identical
|
The release 7.0.0 of the `awx.awx` collection is intended to be identical
|
||||||
@@ -27,16 +46,6 @@ The following notes are changes that may require changes to playbooks:
|
|||||||
- The `variables` parameter in the `tower_group`, `tower_host` and `tower_inventory` modules are now in `dict` format and no longer supports the use of the `C(@)` syntax (for an external `vars` file).
|
- The `variables` parameter in the `tower_group`, `tower_host` and `tower_inventory` modules are now in `dict` format and no longer supports the use of the `C(@)` syntax (for an external `vars` file).
|
||||||
- Some return values (e.g., `credential_type`) have been removed. Use of `id` is recommended.
|
- Some return values (e.g., `credential_type`) have been removed. Use of `id` is recommended.
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
To use this collection, the "old" `tower-cli` needs to be installed
|
|
||||||
in the virtual environment where the collection runs.
|
|
||||||
You can install it from [PyPI](https://pypi.org/project/ansible-tower-cli/).
|
|
||||||
|
|
||||||
To use this collection in AWX, you should create a custom virtual environment into which to install the requirements. NOTE: running locally, you will also need
|
|
||||||
to set the job template `extra_vars` to include `ansible_python_interpreter`
|
|
||||||
to be the Python in that virtual environment.
|
|
||||||
|
|
||||||
## Running Unit Tests
|
## Running Unit Tests
|
||||||
|
|
||||||
Tests to verify compatibility with the most recent AWX code are
|
Tests to verify compatibility with the most recent AWX code are
|
||||||
@@ -95,12 +104,6 @@ cd ~/.ansible/collections/ansible_collections/awx/awx/
|
|||||||
ansible-test integration
|
ansible-test integration
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
The build target `make build_collection` will template out a `galaxy.yml` file
|
|
||||||
with automatic detection of the current AWX version. Then it builds the
|
|
||||||
collection with the `ansible-galaxy` CLI.
|
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
All content in this folder is licensed under the same license as Ansible,
|
All content in this folder is licensed under the same license as Ansible,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
replace: 'extends_documentation_fragment: {{ collection_namespace }}.{{ collection_package }}.auth'
|
replace: 'extends_documentation_fragment: {{ collection_namespace }}.{{ collection_package }}.auth'
|
||||||
loop: "{{ module_files.files }}"
|
loop: "{{ module_files.files }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path[ playbook_dir | length :] }}"
|
label: "{{ item.path | basename }}"
|
||||||
|
|
||||||
- name: Change files to support desired namespace and package names
|
- name: Change files to support desired namespace and package names
|
||||||
replace:
|
replace:
|
||||||
|
|||||||
Reference in New Issue
Block a user