From ba1eb2bc79bfe94f945bdf22ec695c9131bcca0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Sat, 11 May 2024 17:23:27 +0000 Subject: [PATCH 1/2] fix(ansible): make long running tasks asynchronous (#42) --- anvil/ansible/playbooks/project_build.yml | 16 ++++++++++++++-- anvil/ansible/playbooks/project_clone.yml | 21 ++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/anvil/ansible/playbooks/project_build.yml b/anvil/ansible/playbooks/project_build.yml index cd76580..3f4b9e6 100644 --- a/anvil/ansible/playbooks/project_build.yml +++ b/anvil/ansible/playbooks/project_build.yml @@ -22,8 +22,20 @@ dest: "{{ forge_registry_url }}" vars: __regex_search: (?<=/)[^/]+(?=\.git) - register: __podman_image_info + async: 1800 + poll: 0 + register: __podman_image + + - name: Waiting for container build to finish + ansible.builtin.async_status: + jid: "{{ __podman_image.ansible_job_id }}" + register: __job_result + until: __job_result.finished + retries: 1800 + delay: 1 - name: INFO | Status from build and push ansible.builtin.debug: - msg: "{{ __podman_image_info }}" + msg: + - "{{ __job_result.actions | to_nice_yaml(indent=2) }}" + - "{{ __job_result.image | to_nice_yaml(indent=2) }}" diff --git a/anvil/ansible/playbooks/project_clone.yml b/anvil/ansible/playbooks/project_clone.yml index 36bf457..64428ab 100644 --- a/anvil/ansible/playbooks/project_clone.yml +++ b/anvil/ansible/playbooks/project_clone.yml @@ -7,13 +7,28 @@ ansible.builtin.include_role: name: debug_forge_vars tasks: - - name: Clone project + - name: Git clone project ansible.builtin.git: repo: "{{ forge_git_repository_url }}" dest: "{{ forge_git_repository_destination }}" version: "{{ forge_git_repository_version }}" - register: __git_clone_info + async: 180 + poll: 0 + register: __git_clone + + - name: Waiting for git clone to finish + ansible.builtin.async_status: + jid: "{{ __git_clone.ansible_job_id }}" + register: __job_result + until: __job_result.finished + retries: 180 + delay: 1 - name: INFO | Status from git clone ansible.builtin.debug: - msg: "{{ __git_clone_info }}" + msg: + - "Source: {{ forge_git_repository_url }}" + - "Destination: {{ forge_git_repository_destination }}" + - "Version: {{ forge_git_repository_version }}" + - "Commit revision before the repository was updated: {{ __job_result.before }}" + - "Last commit revision of the repository retrieved during the update: {{ __job_result.after }}" From a3f0aab6f433a59b33d78f3c2262765abb37ce08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Sat, 11 May 2024 17:24:45 +0000 Subject: [PATCH 2/2] chore(ansible): exclude collections from ansible-lint --- anvil/ansible/.ansible-lint | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/anvil/ansible/.ansible-lint b/anvil/ansible/.ansible-lint index c2c4a76..34ffbc9 100644 --- a/anvil/ansible/.ansible-lint +++ b/anvil/ansible/.ansible-lint @@ -4,6 +4,10 @@ # https://ansible-lint.readthedocs.io/profiles/ profile: production +exclude_paths: + - .cache/ + - collections/ + # Ansible-lint does not fail on warnings from the rules or tags listed below warn_list: - galaxy[version-incorrect]