orchestrate.ymlΒΆ

---
- name: βœ… Ensure staging base dir exists
  ansible.builtin.file:
    path: "{{ TEST_E2E_PLAYWRIGHT_STAGE_BASE_DIR }}"
    state: directory
    mode: "0755"

- name: βœ… Ensure reports base dir exists
  ansible.builtin.file:
    path: "{{ TEST_E2E_PLAYWRIGHT_REPORTS_BASE_DIR }}"
    state: directory
    mode: "0755"

- name: 🧰 Prepare shared @playwright/test install
  ansible.builtin.include_tasks: 01_setup.yml

- name: βœ… Check the CA and central templates every role's run shares
  ansible.builtin.include_tasks: 01_setup/shared_checks.yml

- name: 🎲 Start the run without a network pick
  ansible.builtin.set_fact:
    _playwright_network_picks: {}

- name: ▢️ Run Playwright for each detected role
  ansible.builtin.include_tasks: 02_run_one.yml
  vars:
    application_id: "{{ playwright_role_id }}"
    _playwright_dispatch: false
  loop: "{{ TEST_E2E_PLAYWRIGHT_APPS }}"
  loop_control:
    loop_var: playwright_role_id
    label: "{{ playwright_role_id }}"
  when: TEST_E2E_PLAYWRIGHT_PARALLEL | int == 1

- name: πŸ”€ Run the round's Playwright containers in parallel
  ansible.builtin.include_tasks: 01_setup/parallel.yml
  when: TEST_E2E_PLAYWRIGHT_PARALLEL | int > 1

- name: ▢️ Run the roles left to the serial runner, in round order, before the retry
  ansible.builtin.include_tasks: 02_run_one.yml
  vars:
    application_id: "{{ playwright_role_id }}"
    _playwright_dispatch: false
  loop: "{{ TEST_E2E_PLAYWRIGHT_APPS | select('in', _playwright_serial_roles | default([])) | list }}"
  loop_control:
    loop_var: playwright_role_id
    label: "{{ playwright_role_id }}"

- name: πŸ” Stash first-pass failures for one flake retry
  ansible.builtin.set_fact:
    _playwright_retry_roles: "{{ _playwright_failures | difference(_budget_timeouts) }}"
    _playwright_failures: "{{ _playwright_failures | intersect(_budget_timeouts) }}"
  vars:
    _budget_timeouts: "{{ _playwright_budget_timeouts | default([]) }}"
  when: (_playwright_failures | default([])) | length > 0

- name: πŸ” Retry failed roles once on rotated Tor circuits
  ansible.builtin.include_tasks: 02_run_one.yml
  vars:
    application_id: "{{ playwright_role_id }}"
    _playwright_dispatch: false
  loop: "{{ _playwright_retry_roles | default([]) }}"
  loop_control:
    loop_var: playwright_role_id
    label: "{{ playwright_role_id }} (retry)"

- name: πŸ›‘ Fail if there were Playwright failures
  ansible.builtin.fail:
    msg: "Playwright failed for roles: {{ _playwright_failures }}"
  when: (_playwright_failures | default([])) | length > 0