ansible / galaxy_collection

Collection of modules and roles to configure Automation Hub
GNU General Public License v3.0
54 stars 50 forks source link

ah_collection fails on overwrite_existing #384

Closed Tompage1994 closed 2 months ago

Tompage1994 commented 2 months ago

Summary

When overwrite_existing is set on ah_collection module the task to delete doesn't always complete before the new upload starts. This means that the task isn't being tracked properly and there are issues with timing.

Issue Type

OS / ENVIRONMENT

CI (on my fork because CI is working there, existing PRs will replicate this in devel)

Desired Behavior

CI works, particularly this section:

- name: Upload Collection
      ansible.builtin.include_role:
        name: collection

    - name: Overwrite Collection
      ansible.builtin.include_role:
        name: collection
      vars:
        ah_collections: "{{ ah_collections_overwrite }}"

Actual Behavior

failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j134852763177.8629', 'results_file': '/home/runner/.ansible_async/j134852763177.8629', 'changed': False, '__collection': {'namespace': 'galaxy', 'name': 'galaxy', 'path': '/home/runner/work/ah_configuration/ah_configuration/galaxy-galaxy-1.0.0.tar.gz', 'wait': True, 'interaval': 5, 'auto_approve': True, 'timeout': 180, 'overwrite_existing': True}, 'ansible_loop_var': '__collection'}) => {"__collections_job_async_result_item": {"__collection": {"auto_approve": true, "interaval": 5, "name": "galaxy", "namespace": "galaxy", "overwrite_existing": true, "path": "/home/runner/work/ah_configuration/ah_configuration/galaxy-galaxy-1.0.0.tar.gz", "timeout": 180, "wait": true}, "ansible_job_id": "j134852763177.8629", "ansible_loop_var": "__collection", "changed": false, "failed": 0, "finished": 0, "results_file": "/home/runner/.ansible_async/j134852763177.8629", "started": 1}, "ansible_job_id": "j134852763177.8629", "ansible_loop_var": "__collections_job_async_result_item", "attempts": 50, "changed": false, "finished": 0, "results_file": "/home/runner/.ansible_async/j134852763177.8629", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
Screenshot 2024-04-17 at 16 30 00

Failure to import because timing issues with deletion.

Suggested Resolution

Add a wait for task completion after the deletion