-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathsplit_targets.yaml
24 lines (24 loc) · 1.08 KB
/
split_targets.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
- set_fact:
_hashed_targets: []
- name: List the targets
args:
chdir: "{{ _test_location }}"
executable: /bin/bash
environment: "{{ ansible_test_environment | default({}) }}"
shell: "source {{ ansible_test_venv_path }}/bin/activate; {{ ansible_test_executable }} {{ ansible_test_test_command }} {{ ansible_test_options }} --list {{ ansible_test_integration_targets }} 2>&1|grep -v WARNING"
register: ansible_test_targets
failed_when: ansible_test_targets.rc not in [0, 1]
- set_fact:
number_entries: "{{ ansible_test_targets.stdout_lines|length }}"
- set_fact:
sorted_test_targets: "{{ ansible_test_targets.stdout_lines | sort() | list }}"
# Distribute test targets evenly between workers
- set_fact:
targets_to_test: "{{ targets_to_test | default([]) + [ ansible_test_targets.stdout_lines[item] ] }}"
when: item % ansible_test_split_in == ansible_test_do_number|int - 1
loop: "{{ range(0,number_entries|int)|list }}"
- set_fact:
_integration_targets: "{{ targets_to_test | default([]) | join(' ') }}"
- debug:
msg: "Do roles: '{{ _integration_targets }}'"