azdo-cli 0.25.0-feature-devcontainer-caddy-proxy.953 → 0.25.0-rescue-feature-059-project-operations-guide-20261106T184502Z.957
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.
|
@@ -1047,17 +1047,6 @@ var DpapiEntry = class {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
};
|
|
1049
1049
|
|
|
1050
|
-
// src/lib/async.ts
|
|
1051
|
-
function runSequentially(items, task) {
|
|
1052
|
-
return items.reduce(
|
|
1053
|
-
(previous, item, index) => previous.then(() => task(item, index)),
|
|
1054
|
-
Promise.resolve()
|
|
1055
|
-
);
|
|
1056
|
-
}
|
|
1057
|
-
function asPromise(fn) {
|
|
1058
|
-
return Promise.resolve().then(fn);
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
1050
|
// src/services/credential-store.ts
|
|
1062
1051
|
var SERVICE = "azdo-cli";
|
|
1063
1052
|
var LEGACY_ACCOUNT = "pat";
|
|
@@ -1198,7 +1187,7 @@ function serializeCredential(cred) {
|
|
|
1198
1187
|
}
|
|
1199
1188
|
return JSON.stringify(cred);
|
|
1200
1189
|
}
|
|
1201
|
-
function maybeMigrateLegacy(targetOrg) {
|
|
1190
|
+
async function maybeMigrateLegacy(targetOrg) {
|
|
1202
1191
|
if (activeCredentialStore() === "dpapi") return null;
|
|
1203
1192
|
const config = loadConfig();
|
|
1204
1193
|
if (!config.org || config.org !== targetOrg) {
|
|
@@ -1246,31 +1235,30 @@ async function getPat(org) {
|
|
|
1246
1235
|
if (cred.kind === "pat") return cred.token;
|
|
1247
1236
|
return null;
|
|
1248
1237
|
}
|
|
1249
|
-
function getStoredCredential(org) {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1238
|
+
async function getStoredCredential(org) {
|
|
1239
|
+
const entry = entryFor(accountFor(org));
|
|
1240
|
+
const value = wrapUnavailable(() => entry.getPassword());
|
|
1241
|
+
if (value === null) {
|
|
1242
|
+
const migrated = await maybeMigrateLegacy(org);
|
|
1243
|
+
if (migrated === null) return null;
|
|
1244
|
+
return parseStoredValue(migrated);
|
|
1245
|
+
}
|
|
1246
|
+
return parseStoredValue(value);
|
|
1255
1247
|
}
|
|
1256
|
-
function storePat(org, pat) {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
masked_pat: maskedDisplay(pat)
|
|
1266
|
-
});
|
|
1248
|
+
async function storePat(org, pat) {
|
|
1249
|
+
const cred = { kind: "pat", token: pat };
|
|
1250
|
+
const entry = entryFor(accountFor(org));
|
|
1251
|
+
wrapUnavailable(() => entry.setPassword(serializeCredential(cred)));
|
|
1252
|
+
appendAuthAuditEvent({
|
|
1253
|
+
event: "auth.store",
|
|
1254
|
+
org,
|
|
1255
|
+
backend: probeBackend(),
|
|
1256
|
+
masked_pat: maskedDisplay(pat)
|
|
1267
1257
|
});
|
|
1268
1258
|
}
|
|
1269
|
-
function storeOAuthCredential(org, cred) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
wrapUnavailable(() => entry.setPassword(serializeCredential(cred)));
|
|
1273
|
-
});
|
|
1259
|
+
async function storeOAuthCredential(org, cred) {
|
|
1260
|
+
const entry = entryFor(accountFor(org));
|
|
1261
|
+
wrapUnavailable(() => entry.setPassword(serializeCredential(cred)));
|
|
1274
1262
|
}
|
|
1275
1263
|
async function deletePat(org) {
|
|
1276
1264
|
const entry = entryFor(accountFor(org));
|
|
@@ -1302,16 +1290,13 @@ async function deletePat(org) {
|
|
|
1302
1290
|
}
|
|
1303
1291
|
try {
|
|
1304
1292
|
const { unlinkSync: unlinkSync2 } = await import("fs");
|
|
1305
|
-
const { lockPath: lockPath2 } = await import("./oauth-token-refresh-
|
|
1293
|
+
const { lockPath: lockPath2 } = await import("./oauth-token-refresh-RLDAAR5D.js");
|
|
1306
1294
|
unlinkSync2(lockPath2(org));
|
|
1307
1295
|
} catch {
|
|
1308
1296
|
}
|
|
1309
1297
|
return true;
|
|
1310
1298
|
}
|
|
1311
|
-
function listOrgsWithStoredPat() {
|
|
1312
|
-
return asPromise(listOrgsWithStoredPatSync);
|
|
1313
|
-
}
|
|
1314
|
-
function listOrgsWithStoredPatSync() {
|
|
1299
|
+
async function listOrgsWithStoredPat() {
|
|
1315
1300
|
const seen = /* @__PURE__ */ new Set();
|
|
1316
1301
|
for (const ev of readAuditEvents()) {
|
|
1317
1302
|
if (ev.event === "auth.store" || ev.event === "oauth-login-success") {
|
|
@@ -1402,26 +1387,25 @@ function lockPath(org) {
|
|
|
1402
1387
|
async function defaultAcquireLock(org, waitMs = DEFAULT_LOCK_WAIT_MS) {
|
|
1403
1388
|
const path4 = lockPath(org);
|
|
1404
1389
|
mkdirSync(locksDir(), { recursive: true, mode: 448 });
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1390
|
+
const deadline = Date.now() + waitMs;
|
|
1391
|
+
for (; ; ) {
|
|
1392
|
+
try {
|
|
1393
|
+
const fd = openSync2(path4, "wx");
|
|
1394
|
+
closeSync2(fd);
|
|
1395
|
+
return {
|
|
1396
|
+
release: () => {
|
|
1397
|
+
try {
|
|
1398
|
+
unlinkSync(path4);
|
|
1399
|
+
} catch {
|
|
1400
|
+
}
|
|
1416
1401
|
}
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1402
|
+
};
|
|
1403
|
+
} catch (err) {
|
|
1404
|
+
if (err.code !== "EEXIST") throw err;
|
|
1405
|
+
if (Date.now() > deadline) return null;
|
|
1406
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
1407
|
+
}
|
|
1422
1408
|
}
|
|
1423
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
1424
|
-
return tryAcquireLock(path4, deadline);
|
|
1425
1409
|
}
|
|
1426
1410
|
function classifyRefreshFailure(error) {
|
|
1427
1411
|
const code = typeof error === "string" ? error : error.error ?? "";
|
|
@@ -1559,7 +1543,6 @@ export {
|
|
|
1559
1543
|
CredentialStoreUnavailableError,
|
|
1560
1544
|
CredentialMissingError,
|
|
1561
1545
|
CredentialRefreshError,
|
|
1562
|
-
runSequentially,
|
|
1563
1546
|
appendAuthAuditEvent,
|
|
1564
1547
|
readAuditEvents,
|
|
1565
1548
|
SETTINGS,
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
resolveOAuthConfig,
|
|
38
38
|
resolveScopedConfig,
|
|
39
39
|
runAuthCodeFlow,
|
|
40
|
-
runSequentially,
|
|
41
40
|
setConfigValue,
|
|
42
41
|
setOrgScopedValue,
|
|
43
42
|
storeOAuthCredential,
|
|
@@ -46,7 +45,7 @@ import {
|
|
|
46
45
|
tokenResponseToCredential,
|
|
47
46
|
unsetConfigValue,
|
|
48
47
|
unsetOrgScopedValue
|
|
49
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-DNOOZIXA.js";
|
|
50
49
|
|
|
51
50
|
// src/program.ts
|
|
52
51
|
import { Command as Command20 } from "commander";
|
|
@@ -155,14 +154,6 @@ function handleCommandError(err, id, context, scope = "write", exit = true) {
|
|
|
155
154
|
return;
|
|
156
155
|
}
|
|
157
156
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
158
|
-
writeCommandError(error, id, context, scope);
|
|
159
|
-
if (exit) {
|
|
160
|
-
process.exit(1);
|
|
161
|
-
} else {
|
|
162
|
-
process.exitCode = 1;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function writeCommandError(error, id, context, scope) {
|
|
166
157
|
const msg = error.message;
|
|
167
158
|
const scopeLabel = scope === "read" ? "Work Items (read)" : "Work Items (Read & Write)";
|
|
168
159
|
if (isSentinel(msg, "AUTH_FAILED")) {
|
|
@@ -202,6 +193,11 @@ function writeCommandError(error, id, context, scope) {
|
|
|
202
193
|
process.stderr.write(`Error: ${msg}
|
|
203
194
|
`);
|
|
204
195
|
}
|
|
196
|
+
if (exit) {
|
|
197
|
+
process.exit(1);
|
|
198
|
+
} else {
|
|
199
|
+
process.exitCode = 1;
|
|
200
|
+
}
|
|
205
201
|
}
|
|
206
202
|
var STDIN_PATH = "-";
|
|
207
203
|
function readTextSource(file) {
|
|
@@ -344,8 +340,9 @@ async function downloadImagesFromFields(fields, args, credential) {
|
|
|
344
340
|
}
|
|
345
341
|
}
|
|
346
342
|
const results = [];
|
|
347
|
-
|
|
348
|
-
|
|
343
|
+
let index = 0;
|
|
344
|
+
for (const reference of references) {
|
|
345
|
+
index += 1;
|
|
349
346
|
try {
|
|
350
347
|
const bytes = await downloadAttachment(reference.url, credential);
|
|
351
348
|
const processed = await processImageBytes(bytes, options.maxWidth);
|
|
@@ -366,7 +363,7 @@ async function downloadImagesFromFields(fields, args, credential) {
|
|
|
366
363
|
error: err instanceof Error ? err.message : String(err)
|
|
367
364
|
});
|
|
368
365
|
}
|
|
369
|
-
}
|
|
366
|
+
}
|
|
370
367
|
return results;
|
|
371
368
|
}
|
|
372
369
|
async function runImageDownload(fields, args, credential) {
|
|
@@ -406,46 +403,6 @@ var DEFAULT_FIELDS = [
|
|
|
406
403
|
"System.AreaPath",
|
|
407
404
|
"System.IterationPath"
|
|
408
405
|
];
|
|
409
|
-
var ROUTED_API_HOSTS = /* @__PURE__ */ new Map([
|
|
410
|
-
["dev.azure.com", ""],
|
|
411
|
-
// "_vssps" cannot be an organization name, so it never clashes with /<org>/.
|
|
412
|
-
["vssps.dev.azure.com", "/_vssps"]
|
|
413
|
-
]);
|
|
414
|
-
var LEGACY_ORG_HOST = /^([a-z0-9][a-z0-9-]*)\.visualstudio\.com$/i;
|
|
415
|
-
function readApiBase() {
|
|
416
|
-
const raw = process.env.AZDO_API_BASE_URL?.trim();
|
|
417
|
-
if (!raw) return null;
|
|
418
|
-
let base;
|
|
419
|
-
try {
|
|
420
|
-
base = new URL(raw);
|
|
421
|
-
} catch (err) {
|
|
422
|
-
throw new Error(`INVALID_CONFIG: AZDO_API_BASE_URL must be an absolute http(s) URL, got "${raw}"`, { cause: err });
|
|
423
|
-
}
|
|
424
|
-
if (base.protocol !== "http:" && base.protocol !== "https:") {
|
|
425
|
-
throw new Error(`INVALID_CONFIG: AZDO_API_BASE_URL must be an absolute http(s) URL, got "${raw}"`);
|
|
426
|
-
}
|
|
427
|
-
return base;
|
|
428
|
-
}
|
|
429
|
-
function proxiedPath(original) {
|
|
430
|
-
const prefix = ROUTED_API_HOSTS.get(original.hostname);
|
|
431
|
-
if (prefix !== void 0) return { prefix, pathname: original.pathname };
|
|
432
|
-
const legacy = LEGACY_ORG_HOST.exec(original.hostname);
|
|
433
|
-
if (legacy === null) return null;
|
|
434
|
-
const pathname = original.pathname.replace(/^\/DefaultCollection(?=\/)/i, "");
|
|
435
|
-
return { prefix: "", pathname: `/${legacy[1]}${pathname}` };
|
|
436
|
-
}
|
|
437
|
-
function routeAzureDevOpsApiUrl(url) {
|
|
438
|
-
const base = readApiBase();
|
|
439
|
-
if (base === null) return url;
|
|
440
|
-
const original = new URL(url);
|
|
441
|
-
const target = proxiedPath(original);
|
|
442
|
-
if (!target?.pathname.includes("/_apis/")) return url;
|
|
443
|
-
original.protocol = base.protocol;
|
|
444
|
-
original.hostname = base.hostname;
|
|
445
|
-
original.port = base.port;
|
|
446
|
-
original.pathname = `${base.pathname.replace(/\/$/, "")}${target.prefix}${target.pathname}`;
|
|
447
|
-
return original.toString();
|
|
448
|
-
}
|
|
449
406
|
function authHeaders(credentialOrPat) {
|
|
450
407
|
if (typeof credentialOrPat === "string") {
|
|
451
408
|
const token2 = Buffer.from(`:${credentialOrPat}`).toString("base64");
|
|
@@ -458,10 +415,9 @@ function authHeaders(credentialOrPat) {
|
|
|
458
415
|
return { Authorization: `Basic ${token}` };
|
|
459
416
|
}
|
|
460
417
|
async function fetchRaw(url, init) {
|
|
461
|
-
const routedUrl = routeAzureDevOpsApiUrl(url);
|
|
462
418
|
let response;
|
|
463
419
|
try {
|
|
464
|
-
response = await fetch(
|
|
420
|
+
response = await fetch(url, init);
|
|
465
421
|
} catch (err) {
|
|
466
422
|
throw new Error(`NETWORK_ERROR: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
467
423
|
}
|
|
@@ -558,10 +514,9 @@ async function traceResponse(url, init, response) {
|
|
|
558
514
|
return responseBody;
|
|
559
515
|
}
|
|
560
516
|
async function fetchWithErrors(url, init) {
|
|
561
|
-
const routedUrl = routeAzureDevOpsApiUrl(url);
|
|
562
517
|
let response;
|
|
563
518
|
try {
|
|
564
|
-
response = await fetch(
|
|
519
|
+
response = await fetch(url, init);
|
|
565
520
|
} catch (err) {
|
|
566
521
|
throw new Error("NETWORK_ERROR", { cause: err });
|
|
567
522
|
}
|
|
@@ -891,24 +846,23 @@ async function getWorkItemFieldValue(context, id, cred, fieldName) {
|
|
|
891
846
|
}
|
|
892
847
|
return stringifyFieldValue(value);
|
|
893
848
|
}
|
|
894
|
-
async function listWorkItemCommentPages(context, id, cred, continuationToken, comments) {
|
|
895
|
-
const response = await fetchWithErrors(
|
|
896
|
-
buildWorkItemCommentsListUrl(context, id, continuationToken ?? void 0).toString(),
|
|
897
|
-
{ headers: authHeaders(cred) }
|
|
898
|
-
);
|
|
899
|
-
if (!response.ok) {
|
|
900
|
-
throw httpError(response);
|
|
901
|
-
}
|
|
902
|
-
const data = await response.json();
|
|
903
|
-
comments.push(
|
|
904
|
-
...(data.comments ?? []).map((comment) => mapWorkItemComment(comment, id)).filter((comment) => !comment.isDeleted)
|
|
905
|
-
);
|
|
906
|
-
const next = readContinuationToken(response, data);
|
|
907
|
-
if (next === null) return comments;
|
|
908
|
-
return listWorkItemCommentPages(context, id, cred, next, comments);
|
|
909
|
-
}
|
|
910
849
|
async function listWorkItemComments(context, id, cred) {
|
|
911
|
-
const comments =
|
|
850
|
+
const comments = [];
|
|
851
|
+
let continuationToken = null;
|
|
852
|
+
do {
|
|
853
|
+
const response = await fetchWithErrors(
|
|
854
|
+
buildWorkItemCommentsListUrl(context, id, continuationToken ?? void 0).toString(),
|
|
855
|
+
{ headers: authHeaders(cred) }
|
|
856
|
+
);
|
|
857
|
+
if (!response.ok) {
|
|
858
|
+
throw httpError(response);
|
|
859
|
+
}
|
|
860
|
+
const data = await response.json();
|
|
861
|
+
comments.push(
|
|
862
|
+
...(data.comments ?? []).map((comment) => mapWorkItemComment(comment, id)).filter((comment) => !comment.isDeleted)
|
|
863
|
+
);
|
|
864
|
+
continuationToken = readContinuationToken(response, data);
|
|
865
|
+
} while (continuationToken !== null);
|
|
912
866
|
return {
|
|
913
867
|
workItemId: id,
|
|
914
868
|
count: comments.length,
|
|
@@ -1322,7 +1276,7 @@ function patFromEnvFile(envFile) {
|
|
|
1322
1276
|
if (!existsSync3(envFile)) return null;
|
|
1323
1277
|
const contents = readFileSync3(envFile, "utf8");
|
|
1324
1278
|
for (const line of contents.split("\n")) {
|
|
1325
|
-
const match = /^AZDO_PAT\s*=([^\n\r]+)
|
|
1279
|
+
const match = line.match(/^AZDO_PAT\s*=([^\n\r]+)$/);
|
|
1326
1280
|
if (match === null) continue;
|
|
1327
1281
|
const value = match[1].trim().replace(/^["']|["']$/g, "");
|
|
1328
1282
|
if (value.length > 0) return value;
|
|
@@ -1389,7 +1343,7 @@ function describeResolvedCredential() {
|
|
|
1389
1343
|
async function validatePatAgainstAzdo(pat, org) {
|
|
1390
1344
|
const url = `https://dev.azure.com/${encodeURIComponent(org)}/_apis/projects?$top=1&api-version=7.1`;
|
|
1391
1345
|
const auth = Buffer.from(`:${pat}`).toString("base64");
|
|
1392
|
-
const response = await fetch(
|
|
1346
|
+
const response = await fetch(url, {
|
|
1393
1347
|
headers: {
|
|
1394
1348
|
Authorization: `Basic ${auth}`,
|
|
1395
1349
|
Accept: "application/json"
|
|
@@ -1488,31 +1442,29 @@ async function loginWithOAuth(org, opts = {}) {
|
|
|
1488
1442
|
async function logout(opts = {}) {
|
|
1489
1443
|
if (opts.all) {
|
|
1490
1444
|
const orgs = await listOrgsWithStoredPat();
|
|
1491
|
-
|
|
1445
|
+
const removed = [];
|
|
1446
|
+
for (const o of orgs) {
|
|
1447
|
+
const cred2 = await getStoredCredential(o);
|
|
1448
|
+
const ok2 = await deletePat(o);
|
|
1449
|
+
if (ok2 && cred2 !== null) {
|
|
1450
|
+
removed.push({ org: o, kind: cred2.kind });
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
return { removed };
|
|
1492
1454
|
}
|
|
1493
1455
|
if (!opts.org) {
|
|
1494
1456
|
throw new Error("logout requires an org or --all");
|
|
1495
1457
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
const org = orgs[index];
|
|
1500
|
-
if (org === void 0) return removed;
|
|
1501
|
-
removed.push(...await logoutOrg(org));
|
|
1502
|
-
return logoutOrgsInOrder(orgs, index + 1, removed);
|
|
1503
|
-
}
|
|
1504
|
-
async function logoutOrg(org) {
|
|
1505
|
-
const cred = await getStoredCredential(org);
|
|
1506
|
-
const ok = await deletePat(org);
|
|
1507
|
-
return ok && cred !== null ? [{ org, kind: cred.kind }] : [];
|
|
1458
|
+
const cred = await getStoredCredential(opts.org);
|
|
1459
|
+
const ok = await deletePat(opts.org);
|
|
1460
|
+
return { removed: ok && cred !== null ? [{ org: opts.org, kind: cred.kind }] : [] };
|
|
1508
1461
|
}
|
|
1509
1462
|
async function status() {
|
|
1510
1463
|
const orgs = await listOrgsWithStoredPat();
|
|
1511
|
-
const creds = await Promise.all(orgs.map((org) => getStoredCredential(org)));
|
|
1512
1464
|
const out = [];
|
|
1513
|
-
|
|
1514
|
-
const cred =
|
|
1515
|
-
if (cred === null)
|
|
1465
|
+
for (const org of orgs) {
|
|
1466
|
+
const cred = await getStoredCredential(org);
|
|
1467
|
+
if (cred === null) continue;
|
|
1516
1468
|
if (cred.kind === "pat") {
|
|
1517
1469
|
out.push({ org, kind: "pat", backend: probeBackend() });
|
|
1518
1470
|
} else {
|
|
@@ -1525,7 +1477,7 @@ async function status() {
|
|
|
1525
1477
|
backend: probeBackend()
|
|
1526
1478
|
});
|
|
1527
1479
|
}
|
|
1528
|
-
}
|
|
1480
|
+
}
|
|
1529
1481
|
return { orgs: out };
|
|
1530
1482
|
}
|
|
1531
1483
|
async function exportCredential(org) {
|
|
@@ -3176,8 +3128,10 @@ ${renderSettingsHelp()}`);
|
|
|
3176
3128
|
const ask = createAsk(rl);
|
|
3177
3129
|
process.stderr.write("Azure DevOps CLI - Configuration Wizard\n");
|
|
3178
3130
|
process.stderr.write("=======================================\n\n");
|
|
3179
|
-
const
|
|
3180
|
-
|
|
3131
|
+
for (const setting of SETTINGS) {
|
|
3132
|
+
if (setting.key === "credentialStore") continue;
|
|
3133
|
+
await promptForSetting(cfg, setting, ask);
|
|
3134
|
+
}
|
|
3181
3135
|
rl.close();
|
|
3182
3136
|
process.stderr.write("Configuration complete!\n");
|
|
3183
3137
|
});
|
|
@@ -3817,8 +3771,7 @@ function stringifyValue(value) {
|
|
|
3817
3771
|
if (value === null || value === void 0) return "";
|
|
3818
3772
|
if (typeof value === "string") return value;
|
|
3819
3773
|
if (typeof value === "object") return JSON.stringify(value);
|
|
3820
|
-
if (typeof value === "symbol") return value.toString();
|
|
3821
|
-
if (typeof value === "function") return `[function ${value.name || "anonymous"}]`;
|
|
3774
|
+
if (typeof value === "symbol" || typeof value === "function") return value.toString();
|
|
3822
3775
|
return String(value);
|
|
3823
3776
|
}
|
|
3824
3777
|
function formatRichValue(raw) {
|
|
@@ -6918,27 +6871,26 @@ async function getTestSummary(context, cred, buildId) {
|
|
|
6918
6871
|
var MAX_FAILED_TESTS = 50;
|
|
6919
6872
|
async function getFailedTests(context, cred, buildId) {
|
|
6920
6873
|
const testRuns = await listTestRuns(context, cred, buildId);
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
const resultsResponse = await fetchWithErrors(resultsUrl.toString(), {
|
|
6932
|
-
headers: authHeaders(cred)
|
|
6933
|
-
});
|
|
6934
|
-
const resultsData = await readJsonResponse2(resultsResponse);
|
|
6935
|
-
for (const result of resultsData.value) {
|
|
6936
|
-
failed.push({
|
|
6937
|
-
name: result.testCaseTitle ?? result.automatedTestName ?? "(unnamed test)",
|
|
6938
|
-
errorMessage: result.errorMessage ?? null
|
|
6874
|
+
const failed = [];
|
|
6875
|
+
for (const testRun of testRuns) {
|
|
6876
|
+
if (failed.length >= MAX_FAILED_TESTS) break;
|
|
6877
|
+
const resultsUrl = withApiVersion(
|
|
6878
|
+
new URL(`${orgProjectBase(context)}/_apis/test/runs/${testRun.id}/results`)
|
|
6879
|
+
);
|
|
6880
|
+
resultsUrl.searchParams.set("outcomes", "Failed");
|
|
6881
|
+
resultsUrl.searchParams.set("$top", String(MAX_FAILED_TESTS - failed.length));
|
|
6882
|
+
const resultsResponse = await fetchWithErrors(resultsUrl.toString(), {
|
|
6883
|
+
headers: authHeaders(cred)
|
|
6939
6884
|
});
|
|
6885
|
+
const resultsData = await readJsonResponse2(resultsResponse);
|
|
6886
|
+
for (const result of resultsData.value) {
|
|
6887
|
+
failed.push({
|
|
6888
|
+
name: result.testCaseTitle ?? result.automatedTestName ?? "(unnamed test)",
|
|
6889
|
+
errorMessage: result.errorMessage ?? null
|
|
6890
|
+
});
|
|
6891
|
+
}
|
|
6940
6892
|
}
|
|
6941
|
-
return
|
|
6893
|
+
return failed;
|
|
6942
6894
|
}
|
|
6943
6895
|
function secondsBetween(start, finish) {
|
|
6944
6896
|
if (!start || !finish) return null;
|
|
@@ -7211,17 +7163,6 @@ function sleep(ms) {
|
|
|
7211
7163
|
setTimeout(resolve2, ms);
|
|
7212
7164
|
});
|
|
7213
7165
|
}
|
|
7214
|
-
async function pollRunUntilDone(context, cred, runId, timing) {
|
|
7215
|
-
const status2 = await getBuildStatus(context, cred, runId);
|
|
7216
|
-
if (status2.state === "completed") {
|
|
7217
|
-
return { id: runId, state: status2.state, result: status2.result, timedOut: false };
|
|
7218
|
-
}
|
|
7219
|
-
if (Date.now() >= timing.deadline) {
|
|
7220
|
-
return { id: runId, state: status2.state, result: status2.result, timedOut: true };
|
|
7221
|
-
}
|
|
7222
|
-
await sleep(timing.pollMs);
|
|
7223
|
-
return pollRunUntilDone(context, cred, runId, timing);
|
|
7224
|
-
}
|
|
7225
7166
|
function formatTable(rows, rightAlign = /* @__PURE__ */ new Set()) {
|
|
7226
7167
|
const widths = [];
|
|
7227
7168
|
for (const row of rows) {
|
|
@@ -7384,10 +7325,19 @@ function createPipelineWaitCommand() {
|
|
|
7384
7325
|
const resolved = await resolvePipelineContext(options);
|
|
7385
7326
|
context = resolved.context;
|
|
7386
7327
|
const deadline = Date.now() + timeoutSec * 1e3;
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7328
|
+
let waitResult = null;
|
|
7329
|
+
for (; ; ) {
|
|
7330
|
+
const status2 = await getBuildStatus(resolved.context, resolved.cred, runId);
|
|
7331
|
+
if (status2.state === "completed") {
|
|
7332
|
+
waitResult = { id: runId, state: status2.state, result: status2.result, timedOut: false };
|
|
7333
|
+
break;
|
|
7334
|
+
}
|
|
7335
|
+
if (Date.now() >= deadline) {
|
|
7336
|
+
waitResult = { id: runId, state: status2.state, result: status2.result, timedOut: true };
|
|
7337
|
+
break;
|
|
7338
|
+
}
|
|
7339
|
+
await sleep(pollSec * 1e3);
|
|
7340
|
+
}
|
|
7391
7341
|
applyWaitExitCode(waitResult);
|
|
7392
7342
|
if (options.json) {
|
|
7393
7343
|
process.stdout.write(`${JSON.stringify(waitResult, null, 2)}
|
package/package.json
CHANGED