diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bb14c04..9399a37b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,8 @@ jobs: - stable-4.4 - stable-4.5 - stable-4.6 - # - master disabled until build issue resolved + - stable-4.7 + - master uses: "./.github/workflows/ci_standalone_versioned.yml" with: galaxy_ng_version: ${{ matrix.galaxy_ng_version }} diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 00000000..f1c42fab --- /dev/null +++ b/bindep.txt @@ -0,0 +1 @@ +python >=3.5 diff --git a/galaxy.yml b/galaxy.yml index afa19ead..7362316e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,8 +8,8 @@ description: Ansible content that interacts with the Ansible Automation Hub or G documentation: https://github.com/ansible/galaxy_collection/blob/devel/README.md license: - GPL-3.0-only -namespace: galaxy -name: galaxy +namespace: infra +name: ah_configuration version: 1.1.1-devel readme: README.md repository: https://github.com/ansible/galaxy_collection @@ -27,4 +27,5 @@ build_ignore: - galaxy.yml.j2 - template_galaxy.yml - '*.tar.gz' + - test ... diff --git a/plugins/modules/collection_repository.py b/plugins/modules/collection_repository.py index 782e5d6b..f8f35388 100644 --- a/plugins/modules/collection_repository.py +++ b/plugins/modules/collection_repository.py @@ -76,7 +76,7 @@ description: - Existing remote name. type: str - update: + update_repo: description: - Whether to update the collection repository before exiting the module. required: false @@ -155,7 +155,7 @@ def main(): pulp_labels=dict(type="dict"), private=dict(type="bool", default=False), remote=dict(), - update=dict(default=False, type="bool"), + update_repo=dict(type="bool", default=False), wait=dict(default=True, type="bool"), interval=dict(default=1.0, type="float"), timeout=dict(default=None, type="int"), @@ -167,7 +167,7 @@ def main(): # Extract our parameters name = module.params.get("name") module.fail_on_missing_params(["name"]) - update = module.params.get("wait") + update_repo = module.params.get("update_repo") wait = module.params.get("wait") interval = module.params.get("interval") timeout = module.params.get("timeout") @@ -196,7 +196,8 @@ def main(): ansible_repository = AHPulpAnsibleRepository(module) ansible_repository.get_object(name=name) - if distro := new_fields.get("distribution"): + distro = new_fields.get("distribution") + if distro: # if "distribution" is set, but "state" is missing, set "present" distro_state = distro.get("state", None) @@ -224,7 +225,8 @@ def main(): ansible_repository.delete(auto_exit=True) - if remote := new_fields.get("remote"): + remote = new_fields.get("remote") + if remote: ansible_remote = AHPulpAnsibleRemote(module) ansible_remote.get_object(name=remote) @@ -262,7 +264,7 @@ def main(): auto_exit=False, ) - if update: + if update_repo: ansible_repository.sync(wait, interval, timeout) module.exit_json(**module.json_output) diff --git a/roles/collection_repository/README.md b/roles/collection_repository/README.md index 6f80d871..5b561593 100644 --- a/roles/collection_repository/README.md +++ b/roles/collection_repository/README.md @@ -60,7 +60,7 @@ This also speeds up the overall role. |`distribution`|""|no|dict|Distribution options for the collection repository. See additional options below for details. Most users will leave this blank| |`private`|""|no|boolean|Make the Collection repository private.| |`remote`|""|no|str|Remote repository name. This is used if the collections use a remote source.| -|`update`|`false`|no|bool|Wait for the Collection repository to finish syncing before returning.|| +|`update_repo`|`false`|no|bool|Wait for the Collection repository to finish syncing before returning.|| |`wait`|`true`|no|bool|Wait for the Collection repository to finish syncing before returning.|| |`interval`|1.0|no|float|The interval to request an update from Automation Hub.|| |`timeout`|""|no|int|If waiting for the project to update this will abort after this amount of seconds.|| diff --git a/roles/collection_repository/tasks/main.yml b/roles/collection_repository/tasks/main.yml index 57abec94..a9fddce3 100644 --- a/roles/collection_repository/tasks/main.yml +++ b/roles/collection_repository/tasks/main.yml @@ -9,10 +9,10 @@ distribution: "{{ __collection_repository_item.distribution | default(omit) }}" private: "{{ __collection_repository_item.private | default(omit) }}" remote: "{{ __collection_repository_item.remote | default(omit) }}" - update: "{{ __repository_item.update | default(omit) }}" - wait: "{{ __repository_item.wait | default(omit) }}" - interval: "{{ __repository_item.interval | default(1) }}" - timeout: "{{ __repository_item.timeout | default(omit) }}" + update_repo: "{{ __collection_repository_item.update_repo | default(omit) }}" + wait: "{{ __collection_repository_item.wait | default(omit) }}" + interval: "{{ __collection_repository_item.interval | default(1) }}" + timeout: "{{ __collection_repository_item.timeout | default(omit) }}" state: "{{ __collection_repository_item.state | default(ah_state | default('present')) }}" ah_host: "{{ ah_host | default(ah_hostname) }}" ah_username: "{{ ah_username | default(omit) }}" diff --git a/roles/collection_repository_sync/tasks/main.yml b/roles/collection_repository_sync/tasks/main.yml index be651fd5..7272d2c5 100644 --- a/roles/collection_repository_sync/tasks/main.yml +++ b/roles/collection_repository_sync/tasks/main.yml @@ -3,9 +3,9 @@ - name: Sync Automation Hub Collection Remote repository collection_repository_sync: name: "{{ __collection_repository_sync_item.name }}" - wait: "{{ __repository_item.wait | default(omit) }}" - interval: "{{ __repository_item.interval | default(1) }}" - timeout: "{{ __repository_item.timeout | default(omit) }}" + wait: "{{ __collection_repository_sync_item.wait | default(omit) }}" + interval: "{{ __collection_repository_sync_item.interval | default(1) }}" + timeout: "{{ __collection_repository_sync_item.timeout | default(omit) }}" ah_host: "{{ ah_host | default(ah_hostname) }}" ah_username: "{{ ah_username | default(omit) }}" ah_password: "{{ ah_password | default(omit) }}" diff --git a/tests/config.yml b/tests/config.yml new file mode 100644 index 00000000..6e0a73a1 --- /dev/null +++ b/tests/config.yml @@ -0,0 +1,6 @@ +--- +# See template for more information: +# https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/config/config.yml +modules: + python_requires: '>=3.5' +... diff --git a/tests/playbooks/ah_configs/ah_repository.yml b/tests/playbooks/ah_configs/ah_repository.yml index 72f2368b..54c58564 100644 --- a/tests/playbooks/ah_configs/ah_repository.yml +++ b/tests/playbooks/ah_configs/ah_repository.yml @@ -31,4 +31,17 @@ ah_collection_repositories: distribution: state: present remote: community-infra + - name: community-infra-repo-nodistro + description: "description of community-infra repository" + pulp_labels: + pipeline: "approved" + remote: community-infra + - name: community-infra-repo-noremote + description: "description of community-infra repository" + pulp_labels: + pipeline: "approved" + distribution: + state: present + - name: community-infra-repo-nothing + description: "description of community-infra repository" ... diff --git a/tests/playbooks/testing_collections_repos.yml b/tests/playbooks/testing_collections_repos.yml index c6090ba7..7fa867fb 100644 --- a/tests/playbooks/testing_collections_repos.yml +++ b/tests/playbooks/testing_collections_repos.yml @@ -4,7 +4,7 @@ connection: local gather_facts: false collections: - - ansible.automation_hub + - infra.ah_configuration pre_tasks: - name: Include vars from ah_configs directory ansible.builtin.include_vars: @@ -61,4 +61,7 @@ - name: Collection Repository sync ansible.builtin.include_role: name: collection_repository_sync + vars: + ah_collection_repositories: + - name: community-infra-repo ...