bdy 1.10.4 → 1.10.6-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/distTs/package.json
CHANGED
|
@@ -134,6 +134,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
134
134
|
const isBuddy = process.env.BUDDY === 'true';
|
|
135
135
|
const isGithubAction = process.env.GITHUB_ACTIONS === 'true';
|
|
136
136
|
const isCircleCI = process.env.CIRCLECI === 'true';
|
|
137
|
+
const forceTag = process.env.SNAPSHOTS_TAG;
|
|
137
138
|
const forceBranch = process.env.SNAPSHOTS_BRANCH;
|
|
138
139
|
const forceCommit = process.env.SNAPSHOTS_COMMIT;
|
|
139
140
|
const forceBaseCommit = process.env.SNAPSHOTS_BASE_COMMIT;
|
|
@@ -145,6 +146,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
145
146
|
(isPR
|
|
146
147
|
? process.env.BUDDY_RUN_PR_HEAD_BRANCH
|
|
147
148
|
: process.env.BUDDY_EXECUTION_BRANCH);
|
|
149
|
+
const tag = forceTag || process.env.BUDDY_EXECUTION_TAG;
|
|
148
150
|
const commit = forceCommit || process.env.BUDDY_EXECUTION_REVISION;
|
|
149
151
|
const baseCommit = withoutBaseCommit
|
|
150
152
|
? undefined
|
|
@@ -157,6 +159,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
157
159
|
return {
|
|
158
160
|
ci: ciInfo_js_1.CI.BUDDY,
|
|
159
161
|
branch,
|
|
162
|
+
tag,
|
|
160
163
|
pullRequestNumber: isPR ? pullRequestNumber : undefined,
|
|
161
164
|
commit,
|
|
162
165
|
baseCommit,
|
|
@@ -170,11 +173,13 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
170
173
|
}
|
|
171
174
|
if (isGithubAction) {
|
|
172
175
|
const isPR = process.env.GITHUB_EVENT_NAME === 'pull_request';
|
|
176
|
+
const isTag = process.env.GITHUB_REF_TYPE === 'tag';
|
|
173
177
|
const pullRequestNumber = isPR && process.env.GITHUB_REF
|
|
174
178
|
? Number(process.env.GITHUB_REF.split('/')[2])
|
|
175
179
|
: undefined;
|
|
176
180
|
const branch = forceBranch ||
|
|
177
181
|
(isPR ? process.env.GITHUB_HEAD_REF : process.env.GITHUB_REF_NAME);
|
|
182
|
+
const tag = forceTag || (isTag ? process.env.GITHUB_REF_NAME : undefined);
|
|
178
183
|
const commit = forceCommit ||
|
|
179
184
|
(isPR ? await getGithubPullRequestCommit() : process.env.GITHUB_SHA);
|
|
180
185
|
const baseCommit = withoutBaseCommit
|
|
@@ -184,6 +189,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
184
189
|
return {
|
|
185
190
|
ci: ciInfo_js_1.CI.GITHUB_ACTION,
|
|
186
191
|
branch,
|
|
192
|
+
tag,
|
|
187
193
|
pullRequestNumber,
|
|
188
194
|
commit,
|
|
189
195
|
baseCommit,
|
|
@@ -197,6 +203,7 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
197
203
|
? Number(process.env.CIRCLE_PR_NUMBER)
|
|
198
204
|
: undefined;
|
|
199
205
|
const branch = forceBranch || process.env.CIRCLE_BRANCH;
|
|
206
|
+
const tag = forceTag || process.env.CIRCLE_TAG;
|
|
200
207
|
const commit = forceCommit || process.env.CIRCLE_SHA1;
|
|
201
208
|
const baseCommit = withoutBaseCommit
|
|
202
209
|
? undefined
|
|
@@ -204,7 +211,8 @@ async function getCiAndGitInfo(baseBranch) {
|
|
|
204
211
|
(isPR ? await getBaseCommit(baseBranch, branch) : undefined);
|
|
205
212
|
return {
|
|
206
213
|
ci: ciInfo_js_1.CI.CIRCLE_CI,
|
|
207
|
-
branch
|
|
214
|
+
branch,
|
|
215
|
+
tag,
|
|
208
216
|
pullRequestNumber,
|
|
209
217
|
commit,
|
|
210
218
|
baseCommit,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debug = exports.executionUrl = exports.browserPath = exports.commitDetails = exports.invokerId = exports.executionId = exports.actionId = exports.pipelineName = exports.pipelineId = exports.baseCommit = exports.commit = exports.pullRequestNumber = exports.branch = exports.ci = exports.defaultTimeout = exports.cliId = exports.buildId = exports.token = exports.parallel = exports.skipDiscovery = exports.oneByOne = exports.cliVersion = void 0;
|
|
3
|
+
exports.debug = exports.executionUrl = exports.browserPath = exports.commitDetails = exports.invokerId = exports.executionId = exports.actionId = exports.pipelineName = exports.pipelineId = exports.baseCommit = exports.commit = exports.pullRequestNumber = exports.tag = exports.branch = exports.ci = exports.defaultTimeout = exports.cliId = exports.buildId = exports.token = exports.parallel = exports.skipDiscovery = exports.oneByOne = exports.cliVersion = void 0;
|
|
4
4
|
exports.setExecOptions = setExecOptions;
|
|
5
5
|
exports.setBrowserPath = setBrowserPath;
|
|
6
6
|
exports.setCiAndCommitInfo = setCiAndCommitInfo;
|
|
@@ -34,6 +34,7 @@ function setBrowserPath(path) {
|
|
|
34
34
|
function setCiAndCommitInfo(ciInfo) {
|
|
35
35
|
exports.ci = ciInfo.ci;
|
|
36
36
|
exports.branch = ciInfo.branch;
|
|
37
|
+
exports.tag = ciInfo.tag;
|
|
37
38
|
exports.pullRequestNumber = ciInfo.pullRequestNumber;
|
|
38
39
|
exports.commit = ciInfo.commit;
|
|
39
40
|
exports.baseCommit = ciInfo.baseCommit;
|
|
@@ -19,7 +19,16 @@ const node_fs_1 = require("node:fs");
|
|
|
19
19
|
const output_1 = __importDefault(require("../output"));
|
|
20
20
|
const texts_1 = require("../texts");
|
|
21
21
|
const eventsource_1 = require("eventsource");
|
|
22
|
-
const
|
|
22
|
+
const customServiceUrl = process.env.SNAPSHOTS_SERVICE_URL;
|
|
23
|
+
function getServiceUrl() {
|
|
24
|
+
if (customServiceUrl) {
|
|
25
|
+
return customServiceUrl;
|
|
26
|
+
}
|
|
27
|
+
if (context_js_1.token.startsWith('bud_vt_eu')) {
|
|
28
|
+
return 'https://vt.eu.buddy.works';
|
|
29
|
+
}
|
|
30
|
+
return 'https://vt.buddy.works';
|
|
31
|
+
}
|
|
23
32
|
function prepareSnapshotInternal(snapshot) {
|
|
24
33
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
34
|
const { resourceDiscoveryTimeout, cookies, ...filteredSnapshot } = snapshot;
|
|
@@ -68,6 +77,7 @@ async function sendSnapshot(snapshot, firstSnapshot) {
|
|
|
68
77
|
parallel: context_js_1.parallel,
|
|
69
78
|
ci: context_js_1.ci,
|
|
70
79
|
branch: context_js_1.branch,
|
|
80
|
+
tag: context_js_1.tag,
|
|
71
81
|
pullRequestNumber: context_js_1.pullRequestNumber,
|
|
72
82
|
commit: context_js_1.commit,
|
|
73
83
|
baseCommit: context_js_1.baseCommit,
|
|
@@ -103,6 +113,7 @@ async function sendSnapshots(snapshots) {
|
|
|
103
113
|
parallel: context_js_1.parallel,
|
|
104
114
|
ci: context_js_1.ci,
|
|
105
115
|
branch: context_js_1.branch,
|
|
116
|
+
tag: context_js_1.tag,
|
|
106
117
|
pullRequestNumber: context_js_1.pullRequestNumber,
|
|
107
118
|
commit: context_js_1.commit,
|
|
108
119
|
baseCommit: context_js_1.baseCommit,
|
|
@@ -158,6 +169,7 @@ async function sendStorybook(snapshots, filePaths) {
|
|
|
158
169
|
cliVersion: context_js_1.cliVersion,
|
|
159
170
|
ci: context_js_1.ci,
|
|
160
171
|
branch: context_js_1.branch,
|
|
172
|
+
tag: context_js_1.tag,
|
|
161
173
|
pullRequestNumber: context_js_1.pullRequestNumber,
|
|
162
174
|
commit: context_js_1.commit,
|
|
163
175
|
baseCommit: context_js_1.baseCommit,
|
|
@@ -202,6 +214,7 @@ async function sendCompareLinks(urls, validatedOptions, sitemapSource) {
|
|
|
202
214
|
cliVersion: context_js_1.cliVersion,
|
|
203
215
|
ci: context_js_1.ci,
|
|
204
216
|
branch: context_js_1.branch,
|
|
217
|
+
tag: context_js_1.tag,
|
|
205
218
|
commit: context_js_1.commit,
|
|
206
219
|
baseCommit: context_js_1.baseCommit,
|
|
207
220
|
pipelineId: context_js_1.pipelineId,
|
|
@@ -264,7 +277,7 @@ async function downloadScrapPackage(buildId) {
|
|
|
264
277
|
return response;
|
|
265
278
|
}
|
|
266
279
|
async function sendRequest({ url, payload, multipart, }) {
|
|
267
|
-
output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(`${
|
|
280
|
+
output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(`${getServiceUrl()}${url}`));
|
|
268
281
|
const init = {
|
|
269
282
|
method: 'GET',
|
|
270
283
|
redirect: 'follow',
|
|
@@ -278,7 +291,7 @@ async function sendRequest({ url, payload, multipart, }) {
|
|
|
278
291
|
init.method = 'POST';
|
|
279
292
|
init.body = payload;
|
|
280
293
|
}
|
|
281
|
-
const response = await (0, undici_1.fetch)(`${
|
|
294
|
+
const response = await (0, undici_1.fetch)(`${getServiceUrl()}${url}`, init);
|
|
282
295
|
const contentType = response.headers.get('content-type');
|
|
283
296
|
if (contentType && contentType.includes('application/json')) {
|
|
284
297
|
try {
|
|
@@ -297,7 +310,7 @@ async function sendRequest({ url, payload, multipart, }) {
|
|
|
297
310
|
return [text, undefined];
|
|
298
311
|
}
|
|
299
312
|
function connectToScrapSession(buildId) {
|
|
300
|
-
return new eventsource_1.EventSource(`${
|
|
313
|
+
return new eventsource_1.EventSource(`${getServiceUrl()}/sse`, {
|
|
301
314
|
fetch: (url, options) => {
|
|
302
315
|
return (0, undici_1.fetch)(url, {
|
|
303
316
|
...options,
|