Skip to content

Commit a879e03

Browse files
feat(playwright): add max-parallel and customizable timeouts, add docker logs on Grafana startup failure (#711)
Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
1 parent cd1032b commit a879e03

3 files changed

Lines changed: 87 additions & 2 deletions

File tree

.github/workflows/cd.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,26 @@ on:
185185
type: string
186186
required: false
187187
default: http://localhost:3000/
188+
playwright-grafana-timeout:
189+
description: |
190+
Seconds to wait for the Grafana endpoint check in Playwright jobs.
191+
Default is 60.
192+
required: false
193+
type: number
194+
default: 60
195+
playwright-grafana-startup-timeout:
196+
description: |
197+
Seconds to wait for Grafana startup before endpoint checks begin in
198+
Playwright jobs. Default is 60.
199+
required: false
200+
type: number
201+
default: 60
202+
playwright-max-parallel:
203+
description: |
204+
Maximum number of Playwright matrix jobs to run in parallel.
205+
required: false
206+
type: number
207+
default: 256
188208
playwright-secrets:
189209
description: |
190210
The secrets to use for Playwright tests.
@@ -464,7 +484,6 @@ on:
464484
default: true
465485
type: boolean
466486

467-
468487
branch:
469488
description: |
470489
Branch or tag to publish from.
@@ -789,6 +808,9 @@ jobs:
789808
playwright-docker-compose-file: ${{ inputs.playwright-docker-compose-file }}
790809
playwright-config: ${{ inputs.playwright-config }}
791810
playwright-grafana-url: ${{ inputs.playwright-grafana-url }}
811+
playwright-grafana-timeout: ${{ inputs.playwright-grafana-timeout }}
812+
playwright-grafana-startup-timeout: ${{ inputs.playwright-grafana-startup-timeout }}
813+
playwright-max-parallel: ${{ inputs.playwright-max-parallel }}
792814
playwright-secrets: ${{ inputs.playwright-secrets }}
793815
playwright-gar-registry: ${{ inputs.playwright-gar-registry }}
794816

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ on:
158158
type: string
159159
required: false
160160
default: http://localhost:3000/
161+
playwright-grafana-timeout:
162+
description: |
163+
Seconds to wait for the Grafana endpoint check in Playwright jobs.
164+
Default is 60.
165+
required: false
166+
type: number
167+
default: 60
168+
playwright-grafana-startup-timeout:
169+
description: |
170+
Seconds to wait for Grafana startup before endpoint checks begin in
171+
Playwright jobs. Default is 60.
172+
required: false
173+
type: number
174+
default: 60
175+
playwright-max-parallel:
176+
description: |
177+
Maximum number of Playwright matrix jobs to run in parallel.
178+
required: false
179+
type: number
180+
default: 256
161181
playwright-secrets:
162182
description: |
163183
The secrets to use for Playwright tests.
@@ -743,6 +763,9 @@ jobs:
743763
playwright-config: ${{ inputs.playwright-config }}
744764
report-path: ${{ inputs.playwright-report-path }}
745765
grafana-url: ${{ inputs.playwright-grafana-url }}
766+
grafana-timeout: ${{ inputs.playwright-grafana-timeout }}
767+
grafana-startup-timeout: ${{ inputs.playwright-grafana-startup-timeout }}
768+
max-parallel: ${{ inputs.playwright-max-parallel }}
746769
secrets: ${{ (fromJson(needs.test-and-build.outputs.workflow-context).isTrusted && inputs.playwright-secrets != '') && inputs.playwright-secrets || '' }}
747770
node-version: ${{ inputs.node-version }}
748771
npm-registry-auth: ${{ inputs.npm-registry-auth }}

.github/workflows/playwright.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,28 @@ on:
7272
type: string
7373
required: false
7474
default: http://localhost:3000/
75+
grafana-timeout:
76+
description: |
77+
Seconds to wait for the HTTP endpoint check before timing out.
78+
This maps to wait-for-grafana's `timeout` input.
79+
type: number
80+
required: false
81+
default: 60
82+
grafana-startup-timeout:
83+
description: |
84+
Seconds to wait for Grafana startup before beginning endpoint checks.
85+
This maps to wait-for-grafana's `startupTimeout` input.
86+
type: number
87+
required: false
88+
default: 60
89+
max-parallel:
90+
description: |
91+
Maximum number of matrix jobs to run in parallel.
92+
Defaults to 256 effectively unbounded. Lower values stagger Docker image pulls and Grafana
93+
startup across runners, which can avoid wait-for-grafana flakes.
94+
required: false
95+
type: number
96+
default: 256
7597
node-version:
7698
description: Node.js version to use
7799
type: string
@@ -114,6 +136,7 @@ jobs:
114136
timeout-minutes: 60
115137
strategy:
116138
fail-fast: false
139+
max-parallel: ${{ inputs.max-parallel }}
117140
matrix:
118141
GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}}
119142
name: e2e ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }}
@@ -249,9 +272,26 @@ jobs:
249272
DOCKER_COMPOSE_FILE: ${{ inputs.docker-compose-file }}
250273

251274
- name: Wait for Grafana to start
252-
uses: grafana/plugin-actions/wait-for-grafana@wait-for-grafana/v1.0.2
275+
id: wait-for-grafana
276+
uses: grafana/plugin-actions/wait-for-grafana@wait-for-grafana/v1.0.3
253277
with:
254278
url: "${{ inputs.grafana-url }}"
279+
timeout: "${{ inputs.grafana-timeout }}"
280+
startupTimeout: "${{ inputs.grafana-startup-timeout }}"
281+
282+
- name: Capture Grafana logs on startup failure
283+
if: ${{ failure() && steps.wait-for-grafana.outcome == 'failure' }}
284+
shell: bash
285+
working-directory: ${{ inputs.plugin-directory }}
286+
run: |
287+
echo "::group::docker compose ps"
288+
docker compose ${DOCKER_COMPOSE_FILE:+-f "$DOCKER_COMPOSE_FILE"} ps -a || true
289+
echo "::endgroup::"
290+
echo "::group::docker compose logs"
291+
docker compose ${DOCKER_COMPOSE_FILE:+-f "$DOCKER_COMPOSE_FILE"} logs --no-color --tail 500 || true
292+
echo "::endgroup::"
293+
env:
294+
DOCKER_COMPOSE_FILE: ${{ inputs.docker-compose-file }}
255295

256296
- name: Run Playwright tests
257297
id: run-tests

0 commit comments

Comments
 (0)