Files
computer-playbook/roles/test-e2e-playwright/tasks/01_setup.yml
kevinveenbirkenbachandClaude Opus 5.5 b1c7e98d3a fix(test-e2e-playwright): bound the shared Playwright image pull
The shared `container pull` of the Playwright image had no timeout. A
wedged registry-proxy tunnel kept a local deploy on that task for 18
minutes with no traffic until the pull was killed by hand; the task's
`retries: 3` never got a chance because the first attempt never
returned.

Run the pull under `timeout -k 60 <lookup('timeout', 1800)>`, the same
shape the compose build handlers use. A stuck pull now exits with 124
and the existing retry loop starts a fresh connection.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 23:27:42 +02:00

102 lines
3.3 KiB
YAML

---
- name: ✅ Ensure shared Playwright project dir exists
ansible.builtin.file:
path: "{{ TEST_E2E_PLAYWRIGHT_SHARED_DIR }}"
state: directory
mode: "0755"
- name: 📄 Render shared package.json from central template
ansible.builtin.template: # nocheck: stack-host-template (per-host playwright stage dir, runs on every test host)
src: "{{ lookup('path_absolute', 'roles/test-e2e-playwright/templates/package.json.j2') }}"
dest: "{{ TEST_E2E_PLAYWRIGHT_SHARED_DIR }}/package.json"
mode: "0644"
- name: 📦 Pack the persona flows for a single transfer
ansible.builtin.command:
cmd: >-
tar -cf {{ TEST_E2E_PLAYWRIGHT_PERSONAS_ARCHIVE | quote }}
-C {{ lookup('path_absolute', 'roles/test-e2e-playwright/files/personas') | quote }} .
delegate_to: localhost
changed_when: false
- name: ✅ Ensure the shared personas dir exists
ansible.builtin.file:
path: "{{ TEST_E2E_PLAYWRIGHT_SHARED_PERSONAS }}"
state: directory
mode: "0755"
- name: 📋 Stage the persona flows once for every role of this run
ansible.builtin.unarchive:
src: "{{ TEST_E2E_PLAYWRIGHT_PERSONAS_ARCHIVE }}"
dest: "{{ TEST_E2E_PLAYWRIGHT_SHARED_PERSONAS }}/"
- name: 🔍 Probe shared install stamp
ansible.builtin.stat:
path: "{{ TEST_E2E_PLAYWRIGHT_SHARED_STAMP }}"
register: _playwright_shared_stamp_stat
- name: 📖 Read shared install stamp
ansible.builtin.slurp:
src: "{{ TEST_E2E_PLAYWRIGHT_SHARED_STAMP }}"
register: _playwright_shared_stamp_content
when: _playwright_shared_stamp_stat.stat.exists
- name: 🤔 Decide whether the shared install is up to date
ansible.builtin.set_fact:
_playwright_shared_install_needed: >-
{{
(not _playwright_shared_stamp_stat.stat.exists)
or ((_playwright_shared_stamp_content.content | default('') | b64decode | trim)
!= TEST_E2E_PLAYWRIGHT_VERSION)
}}
- name: ⬇️ Pull the Playwright image once for every role of this run
ansible.builtin.command:
argv:
- timeout
- -k
- "60"
- "{{ lookup('timeout', 1800) | int }}"
- container
- pull
- "{{ TEST_E2E_PLAYWRIGHT_IMAGE }}"
register: _playwright_shared_pull
changed_when: false
failed_when: false
retries: 3
delay: 5
until: _playwright_shared_pull.rc == 0
- name: 🔧 Provision the shared Playwright install (npm install + stamp)
when: _playwright_shared_install_needed | bool
block:
- name: 📦 Install @playwright/test into the shared dir (once per host per version)
ansible.builtin.command:
argv:
- container
- run
- --rm
- -v
- "{{ TEST_E2E_PLAYWRIGHT_SHARED_DIR }}:/shared"
- -w
- /shared
- "{{ TEST_E2E_PLAYWRIGHT_IMAGE }}"
- /bin/bash
- -lc
- >-
npm install --no-fund --no-audit --prefer-offline
--fetch-retries 5
--fetch-retry-mintimeout 10000
--fetch-retry-maxtimeout 60000
register: _playwright_shared_install
changed_when: _playwright_shared_install.rc == 0
retries: 3
delay: 5
until: _playwright_shared_install.rc == 0
- name: ✏️ Write shared install stamp
ansible.builtin.copy:
dest: "{{ TEST_E2E_PLAYWRIGHT_SHARED_STAMP }}"
content: "{{ TEST_E2E_PLAYWRIGHT_VERSION }}"
mode: "0644"