Skip to content

Commit 9467b4f

Browse files
authored
fix(api-for-ide), return the full ripple-job URL when on a lane (#9330)
1 parent c393ecc commit 9467b4f

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

scopes/harmony/api-server/api-for-ide.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { getParsedHistoryMetadata } from '@teambit/legacy/dist/consumer/consumer
1818
import RemovedObjects from '@teambit/legacy/dist/scope/removed-components';
1919
import { RemoveMain } from '@teambit/remove';
2020
import { compact, uniq } from 'lodash';
21-
import { getCloudDomain } from '@teambit/legacy/dist/constants';
2221
import { ConfigMain } from '@teambit/config';
2322
import { LANE_REMOTE_DELIMITER, LaneId } from '@teambit/lane-id';
2423
import { ApplicationMain } from '@teambit/application';
@@ -390,13 +389,13 @@ export class APIForIDE {
390389
}
391390

392391
async export() {
393-
const { componentsIds, removedIds, exportedLanes, rippleJobs } = await this.exporter.export();
394-
const rippleJobsFullUrls = rippleJobs.map((job) => `https://${getCloudDomain()}/ripple-ci/job/${job}`);
392+
const { componentsIds, removedIds, exportedLanes, rippleJobUrls } = await this.exporter.export();
395393
return {
396394
componentsIds: componentsIds.map((c) => c.toString()),
397395
removedIds: removedIds.map((c) => c.toString()),
398396
exportedLanes: exportedLanes.map((l) => l.id()),
399-
rippleJobs: rippleJobsFullUrls,
397+
rippleJobs: rippleJobUrls, // for backward compatibility. bit-extension until 1.1.52 expects rippleJobs.
398+
rippleJobUrls,
400399
};
401400
}
402401

scopes/scope/export/export-cmd.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Command, CommandOptions } from '@teambit/cli';
22
import open from 'open';
33
import { ejectTemplate } from '@teambit/eject';
4-
import { WILDCARD_HELP, COMPONENT_PATTERN_HELP, getCloudDomain } from '@teambit/legacy/dist/constants';
4+
import { WILDCARD_HELP, COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
55
import chalk from 'chalk';
66
import { isEmpty } from 'lodash';
77
import { ExportMain, ExportResult } from './export.main.runtime';
@@ -87,7 +87,7 @@ export class ExportCmd implements Command {
8787
missingScope,
8888
exportedLanes,
8989
ejectResults,
90-
rippleJobs,
90+
rippleJobUrls,
9191
} = await this.exportMain.export({
9292
ids,
9393
eject,
@@ -154,23 +154,16 @@ export class ExportCmd implements Command {
154154
return `\n${output}`;
155155
};
156156
const rippleJobsOutput = () => {
157-
if (!rippleJobs.length) return '';
157+
if (!rippleJobUrls.length) return '';
158158
const shouldOpenBrowser = openBrowser && !process.env.CI;
159159
const prefix = shouldOpenBrowser ? 'Your browser has been opened to the following link' : 'Visit the link below';
160160
const msg = `\n\n${prefix} to track the progress of building the components in the cloud\n`;
161-
const lane = exportedLanes.length ? exportedLanes?.[0] : undefined;
162-
const fullUrls = lane
163-
? rippleJobs.map(
164-
(job) =>
165-
`https://${getCloudDomain()}/${lane.scope.replace('.', '/')}/~lane/${lane.name}/~ripple-ci/job/${job}`
166-
)
167-
: rippleJobs.map((job) => `https://${getCloudDomain()}/ripple-ci/job/${job}`);
168161
if (shouldOpenBrowser) {
169-
open(fullUrls[0], { url: true }).catch(() => {
162+
open(rippleJobUrls[0], { url: true }).catch(() => {
170163
/** it's ok, the user is instructed to open the browser manually */
171164
});
172165
}
173-
const urlsColored = fullUrls.map((url) => chalk.bold.underline(url));
166+
const urlsColored = rippleJobUrls.map((url) => chalk.bold.underline(url));
174167
return msg + urlsColored.join('\n');
175168
};
176169

scopes/scope/export/export.main.runtime.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ScopeAspect, ScopeMain } from '@teambit/scope';
44
import { BitError } from '@teambit/bit-error';
55
import { Analytics } from '@teambit/legacy.analytics';
66
import { ComponentID, ComponentIdList } from '@teambit/component-id';
7-
import { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL } from '@teambit/legacy/dist/constants';
7+
import { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, getCloudDomain } from '@teambit/legacy/dist/constants';
88
import { Consumer } from '@teambit/legacy/dist/consumer';
99
import { BitMap } from '@teambit/legacy.bit-map';
1010
import { ComponentsList } from '@teambit/legacy.component-list';
@@ -77,6 +77,7 @@ export interface ExportResult {
7777
componentsIds: ComponentID[];
7878
exportedLanes: Lane[];
7979
rippleJobs: string[];
80+
rippleJobUrls: string[];
8081
ejectResults: EjectResults | undefined;
8182
}
8283

@@ -95,7 +96,7 @@ export class ExportMain {
9596
let ejectResults: EjectResults | undefined;
9697
await this.workspace.clearCache(); // needed when one process executes multiple commands, such as in "bit test" or "bit cli"
9798
if (params.eject) ejectResults = await this.ejectExportedComponents(exported);
98-
const exportResults = {
99+
const exportResults: ExportResult = {
99100
componentsIds: exported,
100101
newIdsOnRemote,
101102
nonExistOnBitMap,
@@ -104,15 +105,28 @@ export class ExportMain {
104105
ejectResults,
105106
exportedLanes,
106107
rippleJobs,
108+
rippleJobUrls: this.getRippleJobUrls(exportedLanes, rippleJobs),
107109
};
108110
if (Scope.onPostExport) {
109111
await Scope.onPostExport(exported, exportedLanes).catch((err) => {
110112
this.logger.error('fatal: onPostExport encountered an error (this error does not stop the process)', err);
111113
});
112114
}
115+
113116
return exportResults;
114117
}
115118

119+
private getRippleJobUrls(exportedLanes: Lane[], rippleJobs: string[]): string[] {
120+
const lane = exportedLanes.length ? exportedLanes?.[0] : undefined;
121+
const rippleJobUrls = lane
122+
? rippleJobs.map(
123+
(job) =>
124+
`https://${getCloudDomain()}/${lane.scope.replace('.', '/')}/~lane/${lane.name}/~ripple-ci/job/${job}`
125+
)
126+
: rippleJobs.map((job) => `https://${getCloudDomain()}/ripple-ci/job/${job}`);
127+
return rippleJobUrls;
128+
}
129+
116130
private async exportComponents({
117131
ids,
118132
includeNonStaged,

0 commit comments

Comments
 (0)