From be6b5b3b0136f905e6961fe3df877df0989e7865 Mon Sep 17 00:00:00 2001 From: Niall Byrne <9848926+niall-byrne@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:56:45 -0400 Subject: [PATCH] test(COLIMA): show logs on converge failure --- roles/colima/molecule/buildkit/converge.yml | 14 +++++++++++--- roles/colima/molecule/buildkit/vars/main.yml | 2 ++ .../colima/molecule/common/tasks/display_logs.yml | 3 +++ roles/colima/molecule/standard/converge.yml | 14 +++++++++++--- roles/colima/molecule/standard/vars/main.yml | 2 ++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/roles/colima/molecule/buildkit/converge.yml b/roles/colima/molecule/buildkit/converge.yml index 23310c7..e4e2058 100644 --- a/roles/colima/molecule/buildkit/converge.yml +++ b/roles/colima/molecule/buildkit/converge.yml @@ -7,6 +7,14 @@ - name: Setup Scenario ansible.builtin.include_tasks: "../common/tasks/setup.yml" - - name: Include osx_provisioner.collection.colima - ansible.builtin.include_role: - name: "osx_provisioner.collection.colima" + - name: Display Logs For Troubleshooting Failures + block: + + - name: Include osx_provisioner.collection.colima + ansible.builtin.include_role: + name: "osx_provisioner.collection.colima" + + rescue: + + - name: Display Logs + ansible.builtin.include_tasks: "../common/tasks/display_logs.yml" diff --git a/roles/colima/molecule/buildkit/vars/main.yml b/roles/colima/molecule/buildkit/vars/main.yml index 7eebce3..9a360bb 100644 --- a/roles/colima/molecule/buildkit/vars/main.yml +++ b/roles/colima/molecule/buildkit/vars/main.yml @@ -1,6 +1,8 @@ --- # defaults file for role-colima +colima_service_user: "{{ lookup('env', 'USER') }}" + colima_homebrew_retries: 4 colima_service_startup_delay: 1 diff --git a/roles/colima/molecule/common/tasks/display_logs.yml b/roles/colima/molecule/common/tasks/display_logs.yml index 7536c38..3bafb47 100644 --- a/roles/colima/molecule/common/tasks/display_logs.yml +++ b/roles/colima/molecule/common/tasks/display_logs.yml @@ -1,4 +1,7 @@ --- +- name: Load Default Var Content + ansible.builtin.include_vars: "../../../defaults/main.yml" + - name: Create Log File List ansible.builtin.set_fact: colima_molecule_log_list: diff --git a/roles/colima/molecule/standard/converge.yml b/roles/colima/molecule/standard/converge.yml index 23310c7..e4e2058 100644 --- a/roles/colima/molecule/standard/converge.yml +++ b/roles/colima/molecule/standard/converge.yml @@ -7,6 +7,14 @@ - name: Setup Scenario ansible.builtin.include_tasks: "../common/tasks/setup.yml" - - name: Include osx_provisioner.collection.colima - ansible.builtin.include_role: - name: "osx_provisioner.collection.colima" + - name: Display Logs For Troubleshooting Failures + block: + + - name: Include osx_provisioner.collection.colima + ansible.builtin.include_role: + name: "osx_provisioner.collection.colima" + + rescue: + + - name: Display Logs + ansible.builtin.include_tasks: "../common/tasks/display_logs.yml" diff --git a/roles/colima/molecule/standard/vars/main.yml b/roles/colima/molecule/standard/vars/main.yml index ed97d53..6082a79 100644 --- a/roles/colima/molecule/standard/vars/main.yml +++ b/roles/colima/molecule/standard/vars/main.yml @@ -1 +1,3 @@ --- + +colima_service_user: "{{ lookup('env', 'USER') }}"