2024-02-14 15:51:08 +00:00
|
|
|
- name: Initialization
|
|
|
|
run_once: yes
|
|
|
|
block:
|
|
|
|
- debug: msg="Variable `mvn_params` must be set."
|
|
|
|
failed_when: mvn_params == ""
|
|
|
|
- set_fact: local_results_dir="{{ local_workspace }}/results/{{ '%Y%m%d%H%M%S' | strftime }}"
|
|
|
|
- debug: var=local_results_dir
|
|
|
|
|
|
|
|
- name: Cleanup Previous Runs
|
|
|
|
# Kill any currently running Java process from a previous (possibly aborted) run before starting the next.
|
|
|
|
shell: |
|
|
|
|
killall java
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Run mvn command on the remote hosts
|
2024-02-16 10:57:56 +00:00
|
|
|
ansible.builtin.shell: |
|
|
|
|
set -o pipefail
|
2024-02-14 15:51:08 +00:00
|
|
|
cd {{ kc_home }}
|
2024-07-24 14:45:02 +00:00
|
|
|
echo "{{ mvn_params }}"
|
2024-02-14 15:51:08 +00:00
|
|
|
./mvnw {{ mvn_params }}
|
2024-02-19 15:04:55 +00:00
|
|
|
args:
|
|
|
|
executable: /usr/bin/bash
|
2024-02-16 10:57:56 +00:00
|
|
|
# Tests can run for hours. To prevent the test from failing when the SSH connection breaks, use asynchronous polling.
|
2024-02-14 15:51:08 +00:00
|
|
|
async: 86400
|
|
|
|
poll: 10
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- debug: var=result
|
2024-02-16 10:57:56 +00:00
|
|
|
|
|
|
|
- name: Recursively find surefire-report directories
|
|
|
|
ansible.builtin.find:
|
|
|
|
file_type: directory
|
|
|
|
paths: "{{ kc_home }}"
|
|
|
|
patterns: "surefire-reports*"
|
|
|
|
recurse: true
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- debug: var=output
|
|
|
|
|
|
|
|
- name: Create local results directories
|
|
|
|
delegate_to: localhost
|
|
|
|
file:
|
|
|
|
path: "{{ local_results_dir }}/{{ item.path | replace(kc_home, '') }}"
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ output.files }}"
|
|
|
|
|
|
|
|
- name: Copy surefire-report directories to localhost
|
|
|
|
synchronize:
|
|
|
|
src: "{{ item.path }}/"
|
|
|
|
dest: "{{ local_results_dir }}/{{ item.path | replace(kc_home, '') }}"
|
|
|
|
mode: pull
|
|
|
|
with_items:
|
|
|
|
- "{{ output.files }}"
|