Skip to content

Commit 518a61f

Browse files
darshan3881claude
andcommitted
OB-10135: propagate automate build id on observability buildStop
Cache the automate build hashed_id at build-create time and include it as `automate_build_id` on the observability-api buildStop payload (`PUT /api/v1/builds/:id/stop`). Lets obs-api persist the mapping so the synergy dashboard can call the railsApp resource-errors endpoint in the automate id-space directly (removing the OB-9830 reverse-lookup shim once end-to-end coverage is verified). Only fires when `isTestObservabilitySession` is true, so non-o11y runs are unaffected. Payload change is additive; obs-api ingest accepts the new field via a typed `automate_build_id` on `BuildStopParams`. Spec: https://browserstack.atlassian.net/wiki/spaces/ENG/pages/6322258049/ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0dbede3 commit 518a61f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

bin/commands/runs.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ module.exports = function run(args, rawArgs) {
340340
utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
341341
if(isTestObservabilitySession) {
342342
utils.setO11yProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
343+
// OB-10135: cache the automate build id so `stopBuildUpstream`
344+
// can include it on the obs-api buildStop payload. Enables the
345+
// synergy dashboard to call the railsApp resource-errors
346+
// endpoint in the automate id-space directly.
347+
process.env.BROWSERSTACK_AUTOMATION_BUILD_ID = data.build_id;
343348
}
344349
let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`;
345350
let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`;

bin/testObservability/helper/helper.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,12 @@ exports.stopBuildUpstream = async () => {
684684
};
685685
} else {
686686
const data = {
687-
'stop_time': (new Date()).toISOString()
687+
'stop_time': (new Date()).toISOString(),
688+
// OB-10135: propagate the automate build hashed_id (cached at
689+
// build-create time in runs.js) so obs-api can persist it and the
690+
// synergy dashboard can call the railsApp resource-errors endpoint
691+
// in the automate id-space directly.
692+
'automate_build_id': process.env.BROWSERSTACK_AUTOMATION_BUILD_ID
688693
};
689694
const config = {
690695
headers: {

0 commit comments

Comments
 (0)