@datadog/datadog-ci-base 4.4.0 → 5.0.0
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/dist/cli.d.ts +1 -0
- package/dist/cli.js +21 -19
- package/dist/cli.js.map +1 -1
- package/dist/commands/dsyms/cli.d.ts +2 -0
- package/dist/commands/dsyms/cli.js +10 -0
- package/dist/commands/dsyms/cli.js.map +1 -0
- package/dist/commands/dsyms/interfaces.d.ts +17 -0
- package/dist/commands/dsyms/interfaces.js +34 -0
- package/dist/commands/dsyms/interfaces.js.map +1 -0
- package/dist/commands/dsyms/renderer.d.ts +11 -0
- package/dist/commands/dsyms/renderer.js +93 -0
- package/dist/commands/dsyms/renderer.js.map +1 -0
- package/dist/commands/dsyms/upload.d.ts +51 -0
- package/dist/commands/dsyms/upload.js +338 -0
- package/dist/commands/dsyms/upload.js.map +1 -0
- package/dist/commands/dsyms/utils.d.ts +15 -0
- package/dist/commands/dsyms/utils.js +74 -0
- package/dist/commands/dsyms/utils.js.map +1 -0
- package/dist/commands/lambda/instrument.js +7 -2
- package/dist/commands/lambda/instrument.js.map +1 -1
- package/dist/commands/plugin/check.js +8 -0
- package/dist/commands/plugin/check.js.map +1 -1
- package/dist/commands/plugin/install.js +9 -1
- package/dist/commands/plugin/install.js.map +1 -1
- package/dist/commands/plugin/list.d.ts +1 -0
- package/dist/commands/plugin/list.js +20 -13
- package/dist/commands/plugin/list.js.map +1 -1
- package/dist/helpers/plugin.d.ts +24 -0
- package/dist/helpers/plugin.js +193 -58
- package/dist/helpers/plugin.js.map +1 -1
- package/dist/helpers/serverless/lambda-layer-versions.d.ts +8 -0
- package/dist/helpers/serverless/lambda-layer-versions.js +13 -0
- package/dist/helpers/serverless/lambda-layer-versions.js.map +1 -0
- package/package.json +14 -16
- package/dist/commands/git-metadata/index.d.ts +0 -1
- package/dist/commands/git-metadata/index.js +0 -18
- package/dist/commands/git-metadata/index.js.map +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.DsymsUploadCommand = void 0;
|
|
39
|
+
const fs_1 = require("fs");
|
|
40
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
+
const clipanion_1 = require("clipanion");
|
|
42
|
+
const upath_1 = __importDefault(require("upath"));
|
|
43
|
+
const datadog_ci_base_1 = require("@datadog/datadog-ci-base");
|
|
44
|
+
const constants_1 = require("@datadog/datadog-ci-base/constants");
|
|
45
|
+
const apikey_1 = require("@datadog/datadog-ci-base/helpers/apikey");
|
|
46
|
+
const concurrency_1 = require("@datadog/datadog-ci-base/helpers/concurrency");
|
|
47
|
+
const env_1 = require("@datadog/datadog-ci-base/helpers/env");
|
|
48
|
+
const errors_1 = require("@datadog/datadog-ci-base/helpers/errors");
|
|
49
|
+
const fips_1 = require("@datadog/datadog-ci-base/helpers/fips");
|
|
50
|
+
const glob_1 = require("@datadog/datadog-ci-base/helpers/glob");
|
|
51
|
+
const metrics_1 = require("@datadog/datadog-ci-base/helpers/metrics");
|
|
52
|
+
const upload_1 = require("@datadog/datadog-ci-base/helpers/upload");
|
|
53
|
+
const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
|
|
54
|
+
const validation = __importStar(require("@datadog/datadog-ci-base/helpers/validation"));
|
|
55
|
+
const validation_1 = require("@datadog/datadog-ci-base/helpers/validation");
|
|
56
|
+
const version_1 = require("@datadog/datadog-ci-base/version");
|
|
57
|
+
const interfaces_1 = require("./interfaces");
|
|
58
|
+
const renderer_1 = require("./renderer");
|
|
59
|
+
const utils_2 = require("./utils");
|
|
60
|
+
class DsymsUploadCommand extends datadog_ci_base_1.BaseCommand {
|
|
61
|
+
constructor() {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
super(...arguments);
|
|
64
|
+
this.basePath = clipanion_1.Option.String({ required: true });
|
|
65
|
+
this.configPath = clipanion_1.Option.String('--config');
|
|
66
|
+
this.dryRun = clipanion_1.Option.Boolean('--dry-run', false);
|
|
67
|
+
this.maxConcurrency = clipanion_1.Option.String('--max-concurrency', '20', { validator: validation.isInteger() });
|
|
68
|
+
this.cliVersion = version_1.cliVersion;
|
|
69
|
+
this.fips = clipanion_1.Option.Boolean('--fips', false);
|
|
70
|
+
this.fipsIgnoreError = clipanion_1.Option.Boolean('--fips-ignore-error', false);
|
|
71
|
+
this.fipsConfig = {
|
|
72
|
+
fips: (_a = (0, env_1.toBoolean)(process.env[constants_1.FIPS_ENV_VAR])) !== null && _a !== void 0 ? _a : false,
|
|
73
|
+
fipsIgnoreError: (_b = (0, env_1.toBoolean)(process.env[constants_1.FIPS_IGNORE_ERROR_ENV_VAR])) !== null && _b !== void 0 ? _b : false,
|
|
74
|
+
};
|
|
75
|
+
this.config = {
|
|
76
|
+
datadogSite: 'datadoghq.com',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
execute() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
(0, fips_1.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
|
|
82
|
+
this.basePath = upath_1.default.normalize(this.basePath);
|
|
83
|
+
this.context.stdout.write((0, renderer_1.renderCommandInfo)(this.basePath, this.maxConcurrency, this.dryRun));
|
|
84
|
+
yield this.loadConfig();
|
|
85
|
+
const { metricsLogger, apiKeyValidator } = this.createServices();
|
|
86
|
+
const initialTime = Date.now();
|
|
87
|
+
try {
|
|
88
|
+
const tmpDirectory = yield (0, utils_2.createUniqueTmpDirectory)();
|
|
89
|
+
try {
|
|
90
|
+
const results = yield this.processAndUploadDsyms(tmpDirectory, metricsLogger, apiKeyValidator);
|
|
91
|
+
const totalTime = (Date.now() - initialTime) / 1000;
|
|
92
|
+
this.context.stdout.write((0, renderer_1.renderSuccessfulCommand)(results, totalTime, this.dryRun));
|
|
93
|
+
metricsLogger.logger.gauge('duration', totalTime);
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
yield (0, utils_2.deleteDirectory)(tmpDirectory);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof errors_1.InvalidConfigurationError) {
|
|
102
|
+
this.context.stdout.write((0, renderer_1.renderConfigurationError)(error));
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
try {
|
|
109
|
+
yield metricsLogger.flush();
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
this.context.stdout.write(`WARN: ${err}\n`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
loadConfig() {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
this.config = yield (0, utils_1.resolveConfigFromFileAndEnvironment)(this.config, {
|
|
120
|
+
apiKey: process.env.DATADOG_API_KEY || process.env.DD_API_KEY,
|
|
121
|
+
datadogSite: process.env.DATADOG_SITE || process.env.DD_SITE,
|
|
122
|
+
}, {
|
|
123
|
+
configPath: this.configPath,
|
|
124
|
+
defaultConfigPaths: ['datadog-ci.json', '../datadog-ci.json'],
|
|
125
|
+
configFromFileCallback: (configFromFile) => {
|
|
126
|
+
(0, validation_1.checkAPIKeyOverride)(process.env.DATADOG_API_KEY || process.env.DD_API_KEY, configFromFile.apiKey, this.context.stdout);
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
createServices() {
|
|
132
|
+
const metricsLogger = (0, metrics_1.getMetricsLogger)({
|
|
133
|
+
apiKey: this.config.apiKey,
|
|
134
|
+
datadogSite: this.config.datadogSite,
|
|
135
|
+
defaultTags: [`cli_version:${this.cliVersion}`],
|
|
136
|
+
prefix: 'datadog.ci.dsyms.',
|
|
137
|
+
});
|
|
138
|
+
const apiKeyValidator = (0, apikey_1.newApiKeyValidator)({
|
|
139
|
+
apiKey: this.config.apiKey,
|
|
140
|
+
datadogSite: this.config.datadogSite,
|
|
141
|
+
metricsLogger: metricsLogger.logger,
|
|
142
|
+
});
|
|
143
|
+
return { metricsLogger, apiKeyValidator };
|
|
144
|
+
}
|
|
145
|
+
processAndUploadDsyms(tmpDirectory, metricsLogger, apiKeyValidator) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const intermediateDirectory = (0, utils_1.buildPath)(tmpDirectory, 'datadog-ci', 'dsyms', 'intermediate');
|
|
148
|
+
const uploadDirectory = (0, utils_1.buildPath)(tmpDirectory, 'datadog-ci', 'dsyms', 'upload');
|
|
149
|
+
this.context.stdout.write((0, renderer_1.renderCommandDetail)(intermediateDirectory, uploadDirectory));
|
|
150
|
+
const searchDirectory = yield this.prepareSearchDirectory(tmpDirectory);
|
|
151
|
+
const dsyms = yield this.findDsyms(searchDirectory);
|
|
152
|
+
const thinDsyms = yield this.processDsyms(dsyms, intermediateDirectory);
|
|
153
|
+
const compressedDsyms = yield this.compressDsyms(thinDsyms, uploadDirectory);
|
|
154
|
+
const requestBuilder = this.createRequestBuilder();
|
|
155
|
+
const uploadFunction = this.createUploadFunction(requestBuilder, metricsLogger, apiKeyValidator);
|
|
156
|
+
return (0, concurrency_1.doWithMaxConcurrency)(this.maxConcurrency, compressedDsyms, uploadFunction);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
prepareSearchDirectory(tmpDirectory) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
if (yield (0, utils_2.isZipFile)(this.basePath)) {
|
|
162
|
+
yield (0, utils_2.unzipArchiveToDirectory)(this.basePath, tmpDirectory);
|
|
163
|
+
return tmpDirectory;
|
|
164
|
+
}
|
|
165
|
+
return this.basePath;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
findDsyms(directoryPath) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
const dsymPaths = (0, glob_1.globSync)((0, utils_1.buildPath)(directoryPath, '**/*.dSYM'));
|
|
171
|
+
const results = yield Promise.all(dsymPaths.map((bundle) => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
try {
|
|
173
|
+
const { stdout } = yield (0, utils_2.executeDwarfdump)(bundle);
|
|
174
|
+
const dwarf = this.parseDwarfdumpOutput(stdout);
|
|
175
|
+
return [{ bundle, dwarf }];
|
|
176
|
+
}
|
|
177
|
+
catch (_a) {
|
|
178
|
+
this.context.stdout.write((0, renderer_1.renderInvalidDsymWarning)(bundle));
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
})));
|
|
182
|
+
return results.flat();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Parses the output of `dwarfdump --uuid` command (ref.: https://www.unix.com/man-page/osx/1/dwarfdump/).
|
|
187
|
+
* It returns one or many DWARF UUID and arch read from the output.
|
|
188
|
+
*
|
|
189
|
+
* Example `dwarfdump --uuid` output:
|
|
190
|
+
* ```
|
|
191
|
+
* $ dwarfdump --uuid DDTest.framework.dSYM
|
|
192
|
+
* UUID: C8469F85-B060-3085-B69D-E46C645560EA (armv7) DDTest.framework.dSYM/Contents/Resources/DWARF/DDTest
|
|
193
|
+
* UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E (arm64) DDTest.framework.dSYM/Contents/Resources/DWARF/DDTest
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
parseDwarfdumpOutput(output) {
|
|
197
|
+
const lineRegexp = /UUID: ([0-9A-F]{8}-(?:[0-9A-F]{4}-){3}[0-9A-F]{12}) \(([a-z0-9_]+)\) (.+)/;
|
|
198
|
+
return output
|
|
199
|
+
.split('\n')
|
|
200
|
+
.map((line) => {
|
|
201
|
+
const match = line.match(lineRegexp);
|
|
202
|
+
return match ? [{ uuid: match[1], arch: match[2], object: match[3] }] : [];
|
|
203
|
+
})
|
|
204
|
+
.flat();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* It takes `N` dSYMs and returns `N` or more dSYMs. If a dSYM includes more than one arch slice,
|
|
208
|
+
* it will be thinned by extracting each arch to a new dSYM in `output`.
|
|
209
|
+
*/
|
|
210
|
+
processDsyms(dsyms, output) {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
yield fs_1.promises.mkdir(output, { recursive: true });
|
|
213
|
+
const results = yield Promise.all(dsyms.map((dsym) => __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
// Reduce dSYMs size by extracting single UUIDs and arch slices from fat dSYMs to separate
|
|
215
|
+
// single-arch dSYMs in intermediate location. This is to avoid exceeding intake limit whenever possible.
|
|
216
|
+
return dsym.dwarf.length > 1 ? this.thinDsym(dsym, output) : [dsym];
|
|
217
|
+
})));
|
|
218
|
+
return results.flat();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* It takes fat dSYM as input and returns multiple dSYMs by extracting **each arch**
|
|
223
|
+
* to separate dSYM file. New files are saved to `output` and named by their object uuid (`<uuid>.dSYM`).
|
|
224
|
+
*
|
|
225
|
+
* For example, given `<source path>/Foo.dSYM/Contents/Resources/DWARF/Foo` dSYM with two arch slices: `arm64` (uuid1)
|
|
226
|
+
* and `x86_64` (uuid2), it will:
|
|
227
|
+
* - create `<intermediate path>/<uuid1>.dSYM/Contents/Resources/DWARF/Foo` for `arm64`,
|
|
228
|
+
* - create `<intermediate path>/<uuid2>.dSYM/Contents/Resources/DWARF/Foo` for `x86_64`.
|
|
229
|
+
*/
|
|
230
|
+
thinDsym(dsym, output) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
const results = yield Promise.all(dsym.dwarf.map((dwarf) => __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
try {
|
|
234
|
+
const bundle = (0, utils_1.buildPath)(output, `${dwarf.uuid}.dSYM`);
|
|
235
|
+
const object = (0, utils_1.buildPath)(bundle, upath_1.default.relative(dsym.bundle, dwarf.object));
|
|
236
|
+
yield fs_1.promises.mkdir(upath_1.default.dirname(object), { recursive: true });
|
|
237
|
+
try {
|
|
238
|
+
// Attempt to extract the single arch object file.
|
|
239
|
+
// We could use the `lipo -archs` command to get the list of archs,
|
|
240
|
+
// but it's more straightforward to just attempt to extract
|
|
241
|
+
// the single arch.
|
|
242
|
+
yield (0, utils_2.executeLipo)(dwarf.object, dwarf.arch, object);
|
|
243
|
+
}
|
|
244
|
+
catch (_a) {
|
|
245
|
+
// The thinning using `lipo` failed, meaning the dSYM is already
|
|
246
|
+
// a single arch dSYM. Copy the object file to the new dSYM.
|
|
247
|
+
yield fs_1.promises.copyFile(dwarf.object, object);
|
|
248
|
+
}
|
|
249
|
+
yield this.copyInfoPlist(dsym.bundle, bundle);
|
|
250
|
+
return [{ bundle, dwarf: [Object.assign(Object.assign({}, dwarf), { object })] }];
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
this.context.stdout.write((0, renderer_1.renderDSYMSlimmingFailure)(dsym, dwarf, error));
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
})));
|
|
257
|
+
return results.flat();
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
copyInfoPlist(src, dst) {
|
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
const infoPlistPaths = (0, glob_1.globSync)((0, utils_1.buildPath)(src, '**/Info.plist'));
|
|
263
|
+
if (infoPlistPaths.length === 0) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const infoPlistPath = infoPlistPaths[0];
|
|
267
|
+
const newInfoPlistPath = (0, utils_1.buildPath)(dst, upath_1.default.relative(src, infoPlistPath));
|
|
268
|
+
yield fs_1.promises.mkdir(upath_1.default.dirname(newInfoPlistPath), { recursive: true });
|
|
269
|
+
yield fs_1.promises.copyFile(infoPlistPath, newInfoPlistPath);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
compressDsyms(dsyms, output) {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
yield fs_1.promises.mkdir(output, { recursive: true });
|
|
275
|
+
return Promise.all(dsyms.map((dsym) => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
const archivePath = (0, utils_1.buildPath)(output, `${dsym.dwarf[0].uuid}.zip`);
|
|
277
|
+
yield (0, utils_2.zipDirectoryToArchive)(dsym.bundle, archivePath);
|
|
278
|
+
return new interfaces_1.CompressedDsym(archivePath, dsym);
|
|
279
|
+
})));
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
createRequestBuilder() {
|
|
283
|
+
if (!this.config.apiKey) {
|
|
284
|
+
throw new errors_1.InvalidConfigurationError(`Missing ${chalk_1.default.bold('DATADOG_API_KEY')} or ${chalk_1.default.bold('DD_API_KEY')} in your environment.`);
|
|
285
|
+
}
|
|
286
|
+
return (0, utils_1.getRequestBuilder)({
|
|
287
|
+
apiKey: this.config.apiKey,
|
|
288
|
+
baseUrl: (0, utils_2.getBaseIntakeUrl)(this.config.datadogSite),
|
|
289
|
+
headers: new Map([
|
|
290
|
+
['DD-EVP-ORIGIN', 'datadog-ci_dsyms'],
|
|
291
|
+
['DD-EVP-ORIGIN-VERSION', this.cliVersion],
|
|
292
|
+
]),
|
|
293
|
+
overrideUrl: 'api/v2/srcmap',
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
createUploadFunction(requestBuilder, metricsLogger, apiKeyValidator) {
|
|
297
|
+
return (dsym) => __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
const payload = dsym.asMultipartPayload();
|
|
299
|
+
if (this.dryRun) {
|
|
300
|
+
this.context.stdout.write(`[DRYRUN] ${(0, renderer_1.renderUpload)(dsym)}`);
|
|
301
|
+
return upload_1.UploadStatus.Success;
|
|
302
|
+
}
|
|
303
|
+
return (0, upload_1.upload)(requestBuilder)(payload, {
|
|
304
|
+
apiKeyValidator,
|
|
305
|
+
onError: (e) => {
|
|
306
|
+
this.context.stdout.write((0, renderer_1.renderFailedUpload)(dsym, e.message));
|
|
307
|
+
metricsLogger.logger.increment('failed', 1);
|
|
308
|
+
},
|
|
309
|
+
onRetry: (e, attempts) => {
|
|
310
|
+
this.context.stdout.write((0, renderer_1.renderRetriedUpload)(dsym, e.message, attempts));
|
|
311
|
+
metricsLogger.logger.increment('retries', 1);
|
|
312
|
+
},
|
|
313
|
+
onUpload: () => {
|
|
314
|
+
this.context.stdout.write((0, renderer_1.renderUpload)(dsym));
|
|
315
|
+
},
|
|
316
|
+
retries: 5,
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
exports.DsymsUploadCommand = DsymsUploadCommand;
|
|
322
|
+
DsymsUploadCommand.paths = [['dsyms', 'upload']];
|
|
323
|
+
DsymsUploadCommand.usage = clipanion_1.Command.Usage({
|
|
324
|
+
category: 'RUM',
|
|
325
|
+
description: 'Upload dSYM files to Datadog.',
|
|
326
|
+
details: `
|
|
327
|
+
This command will upload all dSYM files to Datadog in order to symbolicate crash reports received by Datadog.\n
|
|
328
|
+
See README for details.
|
|
329
|
+
`,
|
|
330
|
+
examples: [
|
|
331
|
+
['Upload all dSYM files in Derived Data path', 'datadog-ci dsyms upload ~/Library/Developer/Xcode/DerivedData'],
|
|
332
|
+
[
|
|
333
|
+
'Upload all dSYM files in a zip file (this is usually the case if your app has Bitcode enabled)',
|
|
334
|
+
'datadog-ci dsyms upload /path/to/folder/my_file.zip',
|
|
335
|
+
],
|
|
336
|
+
],
|
|
337
|
+
});
|
|
338
|
+
//# sourceMappingURL=upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/dsyms/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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ACJ,CAAC,CAAA,CAAA;IACH,CAAC;;AAzUH,gDA0UC;AAzUe,wBAAK,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,AAAxB,CAAwB;AAE7B,wBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,+BAA+B;IAC5C,OAAO,EAAE;;;KAGR;IACD,QAAQ,EAAE;QACR,CAAC,4CAA4C,EAAE,+DAA+D,CAAC;QAC/G;YACE,gGAAgG;YAChG,qDAAqD;SACtD;KACF;CACF,CAAC,AAdiB,CAcjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const isZipFile: (filepath: string) => Promise<boolean>;
|
|
2
|
+
export declare const createUniqueTmpDirectory: () => Promise<string>;
|
|
3
|
+
export declare const deleteDirectory: (directoryPath: string) => Promise<void>;
|
|
4
|
+
export declare const zipDirectoryToArchive: (directoryPath: string, archivePath: string) => Promise<void>;
|
|
5
|
+
export declare const unzipArchiveToDirectory: (archivePath: string, directoryPath: string) => Promise<void>;
|
|
6
|
+
export declare const executeDwarfdump: (dSYMPath: string) => Promise<{
|
|
7
|
+
stderr: string;
|
|
8
|
+
stdout: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const executeLipo: (objectPath: string, arch: string, newObjectPath: string) => Promise<{
|
|
11
|
+
stderr: string;
|
|
12
|
+
stdout: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const getBaseIntakeUrl: (datadogSite?: string) => string;
|
|
15
|
+
export declare const pluralize: (nb: number, singular: string, plural: string) => string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.pluralize = exports.getBaseIntakeUrl = exports.executeLipo = exports.executeDwarfdump = exports.unzipArchiveToDirectory = exports.zipDirectoryToArchive = exports.deleteDirectory = exports.createUniqueTmpDirectory = exports.isZipFile = void 0;
|
|
16
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
17
|
+
const os_1 = require("os");
|
|
18
|
+
const upath_1 = __importDefault(require("upath"));
|
|
19
|
+
const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
|
|
20
|
+
const isZipFile = (filepath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const stats = yield promises_1.default.stat(filepath);
|
|
23
|
+
return stats.size !== 0 && upath_1.default.extname(filepath) === '.zip';
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
// Log to console "file exists yet empty" ?
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.isZipFile = isZipFile;
|
|
31
|
+
const createUniqueTmpDirectory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const uniqueValue = Math.random() * Number.MAX_SAFE_INTEGER;
|
|
33
|
+
const directoryPath = (0, utils_1.buildPath)((0, os_1.tmpdir)(), uniqueValue.toString());
|
|
34
|
+
yield promises_1.default.mkdir(directoryPath, { recursive: true });
|
|
35
|
+
return directoryPath;
|
|
36
|
+
});
|
|
37
|
+
exports.createUniqueTmpDirectory = createUniqueTmpDirectory;
|
|
38
|
+
const deleteDirectory = (directoryPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
yield promises_1.default.rm(directoryPath, { recursive: true });
|
|
40
|
+
});
|
|
41
|
+
exports.deleteDirectory = deleteDirectory;
|
|
42
|
+
const zipDirectoryToArchive = (directoryPath, archivePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
const cwd = upath_1.default.dirname(directoryPath);
|
|
44
|
+
const directoryName = upath_1.default.basename(directoryPath);
|
|
45
|
+
yield (0, utils_1.execute)(`zip -r '${archivePath}' '${directoryName}'`, cwd);
|
|
46
|
+
});
|
|
47
|
+
exports.zipDirectoryToArchive = zipDirectoryToArchive;
|
|
48
|
+
const unzipArchiveToDirectory = (archivePath, directoryPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
yield promises_1.default.mkdir(directoryPath, { recursive: true });
|
|
50
|
+
yield (0, utils_1.execute)(`unzip -o '${archivePath}' -d '${directoryPath}'`);
|
|
51
|
+
});
|
|
52
|
+
exports.unzipArchiveToDirectory = unzipArchiveToDirectory;
|
|
53
|
+
const executeDwarfdump = (dSYMPath) => __awaiter(void 0, void 0, void 0, function* () { return (0, utils_1.execute)(`dwarfdump --uuid '${dSYMPath}'`); });
|
|
54
|
+
exports.executeDwarfdump = executeDwarfdump;
|
|
55
|
+
const executeLipo = (objectPath, arch, newObjectPath) => __awaiter(void 0, void 0, void 0, function* () { return (0, utils_1.execute)(`lipo '${objectPath}' -thin ${arch} -output '${newObjectPath}'`); });
|
|
56
|
+
exports.executeLipo = executeLipo;
|
|
57
|
+
const getBaseIntakeUrl = (datadogSite) => {
|
|
58
|
+
if (process.env.DATADOG_DSYM_INTAKE_URL) {
|
|
59
|
+
return process.env.DATADOG_DSYM_INTAKE_URL;
|
|
60
|
+
}
|
|
61
|
+
else if (datadogSite) {
|
|
62
|
+
return 'https://sourcemap-intake.' + datadogSite;
|
|
63
|
+
}
|
|
64
|
+
return 'https://sourcemap-intake.datadoghq.com';
|
|
65
|
+
};
|
|
66
|
+
exports.getBaseIntakeUrl = getBaseIntakeUrl;
|
|
67
|
+
const pluralize = (nb, singular, plural) => {
|
|
68
|
+
if (nb >= 2) {
|
|
69
|
+
return `${nb} ${plural}`;
|
|
70
|
+
}
|
|
71
|
+
return `${nb} ${singular}`;
|
|
72
|
+
};
|
|
73
|
+
exports.pluralize = pluralize;
|
|
74
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/dsyms/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAA4B;AAC5B,2BAAyB;AAEzB,kDAAyB;AAEzB,kEAAyE;AAElE,MAAM,SAAS,GAAG,CAAO,QAAgB,EAAE,EAAE;IAClD,IAAI;QACF,MAAM,KAAK,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAErC,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,eAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAA;KAC9D;IAAC,OAAO,KAAK,EAAE;QACd,2CAA2C;QAC3C,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA,CAAA;AATY,QAAA,SAAS,aASrB;AAEM,MAAM,wBAAwB,GAAG,GAA0B,EAAE;IAClE,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAA;IAC3D,MAAM,aAAa,GAAG,IAAA,iBAAS,EAAC,IAAA,WAAM,GAAE,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAA;IACjE,MAAM,kBAAE,CAAC,KAAK,CAAC,aAAa,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAEhD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA,CAAA;AANY,QAAA,wBA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EAAE;IACvD,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAA;KAC3C;SAAM,IAAI,WAAW,EAAE;QACtB,OAAO,2BAA2B,GAAG,WAAW,CAAA;KACjD;IAED,OAAO,wCAAwC,CAAA;AACjD,CAAC,CAAA;AARY,QAAA,gBAAgB,oBAQ5B;AAEM,MAAM,SAAS,GAAG,CAAC,EAAU,EAAE,QAAgB,EAAE,MAAc,EAAE,EAAE;IACxE,IAAI,EAAE,IAAI,CAAC,EAAE;QACX,OAAO,GAAG,EAAE,IAAI,MAAM,EAAE,CAAA;KACzB;IAED,OAAO,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAA;AAC5B,CAAC,CAAA;AANY,QAAA,SAAS,aAMrB"}
|
|
@@ -12,7 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.LambdaInstrumentCommand = void 0;
|
|
13
13
|
const clipanion_1 = require("clipanion");
|
|
14
14
|
const plugin_1 = require("../../helpers/plugin");
|
|
15
|
+
const lambda_layer_versions_1 = require("../../helpers/serverless/lambda-layer-versions");
|
|
15
16
|
const __1 = require("../..");
|
|
17
|
+
const LAYER_VERSIONS_HELP_STRING = Object.entries(lambda_layer_versions_1.LAMBDA_LAYER_VERSIONS)
|
|
18
|
+
.filter(([key, _]) => key !== 'extension')
|
|
19
|
+
.map(([key, value]) => `${key} - ${value}`)
|
|
20
|
+
.join(', ');
|
|
16
21
|
class LambdaInstrumentCommand extends __1.BaseCommand {
|
|
17
22
|
constructor() {
|
|
18
23
|
super(...arguments);
|
|
@@ -35,7 +40,7 @@ class LambdaInstrumentCommand extends __1.BaseCommand {
|
|
|
35
40
|
description: `Use --env to separate out your staging, development, and production environments. Learn more about the env tag here: https://docs.datadoghq.com/serverless/troubleshooting/serverless_tagging/#the-env-tag`,
|
|
36
41
|
});
|
|
37
42
|
this.extensionVersion = clipanion_1.Option.String('-e,--extension-version,--extensionVersion', {
|
|
38
|
-
description: `Version of the Datadog Lambda Extension layer to apply.
|
|
43
|
+
description: `Version of the Datadog Lambda Extension layer to apply. Defaults to 'latest'. Setting this to 'latest' will use version ${lambda_layer_versions_1.LAMBDA_LAYER_VERSIONS['extension']}. When using the extension, make sure to export DATADOG_API_KEY (or if encrypted, DATADOG_KMS_API_KEY or DATADOG_API_KEY_SECRET_ARN) in your environment as well. Mutually exclusive with the forwarder. Set to 'none' to explicitly disable adding the extension layer. Learn more about the Lambda Extension here: https://docs.datadoghq.com/serverless/libraries_integrations/extension`,
|
|
39
44
|
});
|
|
40
45
|
this.extraTags = clipanion_1.Option.String('--extra-tags,--extraTags', {
|
|
41
46
|
description: `Add custom tags to your Lambda function in Datadog. Must be a list of <key>:<value> separated by commas such as: layer:api,team:intake`,
|
|
@@ -54,7 +59,7 @@ class LambdaInstrumentCommand extends __1.BaseCommand {
|
|
|
54
59
|
});
|
|
55
60
|
this.layerAWSAccount = clipanion_1.Option.String('-a,--layer-account,--layerAccount', { hidden: true });
|
|
56
61
|
this.layerVersion = clipanion_1.Option.String('-v,--layer-version,--layerVersion', {
|
|
57
|
-
description: `Version of the Datadog Lambda Library layer to apply.
|
|
62
|
+
description: `Version of the Datadog Lambda Library layer to apply. Defaults to 'latest'. Setting this to 'latest' will use one of the following versions based on your runtime: ${LAYER_VERSIONS_HELP_STRING}. Setting to 'none' will disable adding the language layer.`,
|
|
58
63
|
});
|
|
59
64
|
this.logging = clipanion_1.Option.String('--logging', {
|
|
60
65
|
description: `Whether to collect logs using the Lambda Extension. Defaults to 'true'`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/lambda/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,iDAAyD;
|
|
1
|
+
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/lambda/instrument.ts"],"names":[],"mappings":";;;;;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BAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,4CAA4C;CAC1D,CAAC,AAHiB,CAGjB"}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PluginCheckCommand = void 0;
|
|
13
13
|
const clipanion_1 = require("clipanion");
|
|
14
|
+
const message_box_1 = require("../../helpers/message-box");
|
|
14
15
|
const plugin_1 = require("../../helpers/plugin");
|
|
15
16
|
const __1 = require("../..");
|
|
16
17
|
class PluginCheckCommand extends __1.BaseCommand {
|
|
@@ -22,6 +23,13 @@ class PluginCheckCommand extends __1.BaseCommand {
|
|
|
22
23
|
}
|
|
23
24
|
execute() {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const packageName = (0, plugin_1.scopeToPackageName)(this.packageOrScope);
|
|
27
|
+
if (this.context.builtinPlugins.includes(packageName)) {
|
|
28
|
+
console.log();
|
|
29
|
+
(0, message_box_1.messageBox)('Built-in plugin 🔌', 'green', [`The plugin ${packageName} is built-in!`]);
|
|
30
|
+
console.log();
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
25
33
|
const succeeded = yield (0, plugin_1.checkPlugin)(this.packageOrScope, this.command);
|
|
26
34
|
return succeeded ? 0 : 1;
|
|
27
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/commands/plugin/check.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/commands/plugin/check.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,2DAAoD;AACpD,iDAAoE;AAEpE,6BAAiC;AAEjC,MAAa,kBAAmB,SAAQ,eAAW;IAAnD;;QAaE,aAAa;QACN,mBAAc,GAAG,kBAAM,CAAC,MAAM,EAAE,CAAA;QAChC,YAAO,GAAG,kBAAM,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAA;IAiBnD,CAAC;IAfc,OAAO;;YAClB,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAE3D,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;gBACrD,OAAO,CAAC,GAAG,EAAE,CAAA;gBACb,IAAA,wBAAU,EAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,cAAc,WAAW,eAAe,CAAC,CAAC,CAAA;gBACrF,OAAO,CAAC,GAAG,EAAE,CAAA;gBAEb,OAAO,CAAC,CAAA;aACT;YAED,MAAM,SAAS,GAAG,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAEtE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,CAAC;KAAA;;AA/BH,gDAgCC;AA/Be,wBAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,AAAxB,CAAwB;AAE7B,wBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,sDAAsD;IACnE,QAAQ,EAAE;QACR,CAAC,8CAA8C,EAAE,+DAA+D,CAAC;QACjH,CAAC,uCAAuC,EAAE,oCAAoC,CAAC;QAC/E,CAAC,+DAA+D,EAAE,8CAA8C,CAAC;KAClH;CACF,CAAC,AARiB,CAQjB"}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PluginInstallCommand = void 0;
|
|
13
13
|
const clipanion_1 = require("clipanion");
|
|
14
|
+
const message_box_1 = require("../../helpers/message-box");
|
|
14
15
|
const plugin_1 = require("../../helpers/plugin");
|
|
15
16
|
const __1 = require("../..");
|
|
16
17
|
class PluginInstallCommand extends __1.BaseCommand {
|
|
@@ -21,7 +22,14 @@ class PluginInstallCommand extends __1.BaseCommand {
|
|
|
21
22
|
}
|
|
22
23
|
execute() {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const
|
|
25
|
+
const packageName = (0, plugin_1.scopeToPackageName)(this.packageOrScope);
|
|
26
|
+
if (this.context.builtinPlugins.includes(packageName)) {
|
|
27
|
+
console.log();
|
|
28
|
+
(0, message_box_1.messageBox)('Built-in plugin 🔌', 'green', [`The plugin ${packageName} is already built-in!`]);
|
|
29
|
+
console.log();
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
const succeeded = yield (0, plugin_1.installPlugin)(packageName);
|
|
25
33
|
return succeeded ? 0 : 1;
|
|
26
34
|
});
|
|
27
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/plugin/install.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/plugin/install.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,2DAAoD;AACpD,iDAAsE;AAEtE,6BAAiC;AAEjC,MAAa,oBAAqB,SAAQ,eAAW;IAArD;;QAeE,aAAa;QACN,mBAAc,GAAG,kBAAM,CAAC,MAAM,EAAE,CAAA;IAiBzC,CAAC;IAfc,OAAO;;YAClB,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAE3D,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;gBACrD,OAAO,CAAC,GAAG,EAAE,CAAA;gBACb,IAAA,wBAAU,EAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,cAAc,WAAW,uBAAuB,CAAC,CAAC,CAAA;gBAC7F,OAAO,CAAC,GAAG,EAAE,CAAA;gBAEb,OAAO,CAAC,CAAA;aACT;YAED,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAa,EAAC,WAAW,CAAC,CAAA;YAElD,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,CAAC;KAAA;;AAhCH,oDAiCC;AAhCe,0BAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,AAA1B,CAA0B;AAE/B,0BAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,8BAA8B;IAC3C,QAAQ,EAAE;QACR;YACE,gDAAgD;YAChD,iEAAiE;SAClE;QACD,CAAC,yCAAyC,EAAE,sCAAsC,CAAC;KACpF;CACF,CAAC,AAViB,CAUjB"}
|
|
@@ -23,6 +23,7 @@ class PluginListCommand extends __1.BaseCommand {
|
|
|
23
23
|
super(...arguments);
|
|
24
24
|
// Positional
|
|
25
25
|
this.json = clipanion_1.Option.Boolean('--json', { required: false });
|
|
26
|
+
this.all = clipanion_1.Option.Boolean('-a,--all', { required: false });
|
|
26
27
|
this.logger = new logger_1.Logger((s) => {
|
|
27
28
|
this.context.stdout.write(s);
|
|
28
29
|
}, logger_1.LogLevel.INFO);
|
|
@@ -31,21 +32,26 @@ class PluginListCommand extends __1.BaseCommand {
|
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
const allPlugins = (0, plugin_1.listAllPlugins)();
|
|
33
34
|
const builtinPlugins = new Set(this.context.builtinPlugins);
|
|
34
|
-
const installablePlugins = allPlugins.filter((
|
|
35
|
+
const installablePlugins = allPlugins.filter((name) => !builtinPlugins.has(name));
|
|
36
|
+
const plugins = this.all
|
|
37
|
+
? [
|
|
38
|
+
...installablePlugins.map((name) => ({ name, isBuiltin: false })),
|
|
39
|
+
...Array.from(builtinPlugins).map((name) => ({ name, isBuiltin: true })),
|
|
40
|
+
]
|
|
41
|
+
: installablePlugins.map((name) => ({ name, isBuiltin: false }));
|
|
35
42
|
if (this.json) {
|
|
36
|
-
this.logger.info(JSON.stringify(
|
|
37
|
-
name
|
|
38
|
-
scope: getScope(
|
|
43
|
+
this.logger.info(JSON.stringify(plugins.map(({ name, isBuiltin }) => ({
|
|
44
|
+
name,
|
|
45
|
+
scope: getScope(name),
|
|
46
|
+
isBuiltin,
|
|
39
47
|
}))));
|
|
40
48
|
return 0;
|
|
41
49
|
}
|
|
42
|
-
if (installablePlugins.length === 0) {
|
|
43
|
-
this.logger.info('All plugins are currently built-in. We will start splitting them in next major release.');
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
50
|
this.logger.info(`The following plugins are available:\n`);
|
|
47
|
-
this.logger.info(
|
|
48
|
-
.map((
|
|
51
|
+
this.logger.info(plugins
|
|
52
|
+
.map(({ name, isBuiltin }) => isBuiltin
|
|
53
|
+
? ` - ${chalk_1.default.bold('(built-in)')} ${chalk_1.default.magenta(name)}`
|
|
54
|
+
: ` - ${chalk_1.default.bold.magenta(name)} (install with ${chalk_1.default.bold.cyan(`datadog-ci plugin install ${getScope(name)}`)})`)
|
|
49
55
|
.join('\n'));
|
|
50
56
|
return 0;
|
|
51
57
|
});
|
|
@@ -58,10 +64,11 @@ PluginListCommand.usage = clipanion_1.Command.Usage({
|
|
|
58
64
|
description: 'List the available plugins.',
|
|
59
65
|
details: `
|
|
60
66
|
This command lists the plugins that can be installed with the \`datadog-ci plugin install\` command.
|
|
61
|
-
|
|
62
|
-
All other plugins are **built-in** and are not listed here.
|
|
63
67
|
`,
|
|
64
|
-
examples: [
|
|
68
|
+
examples: [
|
|
69
|
+
['List the available plugins', 'datadog-ci plugin list'],
|
|
70
|
+
['List all plugins, including built-in plugins', 'datadog-ci plugin list --all'],
|
|
71
|
+
],
|
|
65
72
|
});
|
|
66
73
|
const getScope = (plugin) => plugin.replace('@datadog/datadog-ci-plugin-', '');
|
|
67
74
|
//# sourceMappingURL=list.js.map
|