mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: send run_id from agent to server (#13542)
This commit is contained in:
parent
00199b5617
commit
e2fff31848
@ -252,8 +252,9 @@ program
|
||||
.command('experimental-grid-agent', { hidden: true })
|
||||
.requiredOption('--agent-id <agentId>', 'agent ID')
|
||||
.requiredOption('--grid-url <gridURL>', 'grid URL')
|
||||
.option('--run-id <github run_id>', 'Workflow run_id')
|
||||
.action(function(options) {
|
||||
launchGridAgent(options.agentId, options.gridUrl);
|
||||
launchGridAgent(options.agentId, options.gridUrl, options.runId);
|
||||
});
|
||||
|
||||
program
|
||||
|
||||
@ -19,12 +19,14 @@ import WebSocket from 'ws';
|
||||
import { fork } from 'child_process';
|
||||
import { getPlaywrightVersion } from '../common/userAgent';
|
||||
|
||||
export function launchGridAgent(agentId: string, gridURL: string) {
|
||||
export function launchGridAgent(agentId: string, gridURL: string, runId: string | undefined) {
|
||||
const log = debug(`pw:grid:agent:${agentId}`);
|
||||
log('created');
|
||||
const params = new URLSearchParams();
|
||||
params.set('pwVersion', getPlaywrightVersion(true /* majorMinorOnly */));
|
||||
params.set('agentId', agentId);
|
||||
if (runId)
|
||||
params.set('runId', runId);
|
||||
const ws = new WebSocket(gridURL.replace('http://', 'ws://') + `/registerAgent?` + params.toString());
|
||||
ws.on('message', (message: string) => {
|
||||
log('worker requested ' + message);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user