@datadog/datadog-ci 2.34.0 → 2.35.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/README.md +12 -9
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/dsyms/utils.js +4 -11
- package/dist/commands/dsyms/utils.js.map +1 -1
- package/dist/commands/elf-symbols/cli.d.ts +1 -0
- package/dist/commands/elf-symbols/cli.js +5 -0
- package/dist/commands/elf-symbols/cli.js.map +1 -0
- package/dist/commands/elf-symbols/elf-constants.d.ts +256 -0
- package/dist/commands/elf-symbols/elf-constants.js +462 -0
- package/dist/commands/elf-symbols/elf-constants.js.map +1 -0
- package/dist/commands/elf-symbols/elf.d.ts +103 -0
- package/dist/commands/elf-symbols/elf.js +428 -0
- package/dist/commands/elf-symbols/elf.js.map +1 -0
- package/dist/commands/elf-symbols/helpers.d.ts +4 -0
- package/dist/commands/elf-symbols/helpers.js +29 -0
- package/dist/commands/elf-symbols/helpers.js.map +1 -0
- package/dist/commands/elf-symbols/interfaces.d.ts +14 -0
- package/dist/commands/elf-symbols/interfaces.js +7 -0
- package/dist/commands/elf-symbols/interfaces.js.map +1 -0
- package/dist/commands/elf-symbols/renderer.d.ts +18 -0
- package/dist/commands/elf-symbols/renderer.js +84 -0
- package/dist/commands/elf-symbols/renderer.js.map +1 -0
- package/dist/commands/elf-symbols/upload.d.ts +25 -0
- package/dist/commands/elf-symbols/upload.js +363 -0
- package/dist/commands/elf-symbols/upload.js.map +1 -0
- package/dist/commands/git-metadata/upload.d.ts +0 -1
- package/dist/commands/git-metadata/upload.js +1 -11
- package/dist/commands/git-metadata/upload.js.map +1 -1
- package/dist/commands/synthetics/api.js +1 -1
- package/dist/commands/synthetics/api.js.map +1 -1
- package/dist/commands/synthetics/compatibility.d.ts +2 -0
- package/dist/commands/synthetics/compatibility.js +19 -0
- package/dist/commands/synthetics/compatibility.js.map +1 -0
- package/dist/commands/synthetics/interfaces.d.ts +3 -2
- package/dist/commands/synthetics/reporters/default.js +2 -1
- package/dist/commands/synthetics/reporters/default.js.map +1 -1
- package/dist/commands/synthetics/run-tests-command.d.ts +1 -1
- package/dist/commands/synthetics/run-tests-command.js +8 -10
- package/dist/commands/synthetics/run-tests-command.js.map +1 -1
- package/dist/commands/synthetics/run-tests-lib.js +4 -10
- package/dist/commands/synthetics/run-tests-lib.js.map +1 -1
- package/dist/commands/synthetics/test.js +1 -1
- package/dist/commands/synthetics/test.js.map +1 -1
- package/dist/commands/synthetics/upload-application-command.js +1 -1
- package/dist/commands/synthetics/upload-application-command.js.map +1 -1
- package/dist/commands/synthetics/utils/public.d.ts +1 -0
- package/dist/commands/synthetics/utils/public.js +12 -1
- package/dist/commands/synthetics/utils/public.js.map +1 -1
- package/dist/commands/trace/interfaces.d.ts +1 -0
- package/dist/commands/trace/trace.d.ts +1 -0
- package/dist/commands/trace/trace.js +12 -2
- package/dist/commands/trace/trace.js.map +1 -1
- package/dist/helpers/tags.d.ts +1 -1
- package/dist/helpers/tags.js.map +1 -1
- package/dist/helpers/utils.d.ts +4 -0
- package/dist/helpers/utils.js +8 -1
- package/dist/helpers/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,428 @@
|
|
|
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.getBuildId = exports.getOutputFilenameFromBuildId = exports.copyElfDebugInfo = exports.computeFileHash = exports.getElfFileMetadata = exports.getSectionInfo = exports.isSupportedElfType = exports.isSupportedArch = exports.getBuildIds = exports.readElfProgramHeaderTable = exports.readElfProgramHeader = exports.readElfSectionHeaderTable = exports.readElfSectionHeader = exports.readElfHeader = exports.createReaderFromFile = exports.FileReader = void 0;
|
|
16
|
+
const crypto_1 = require("crypto");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const utils_1 = require("../../helpers/utils");
|
|
19
|
+
const elf_constants_1 = require("./elf-constants");
|
|
20
|
+
class FileReader {
|
|
21
|
+
constructor(fd) {
|
|
22
|
+
this.fd = fd;
|
|
23
|
+
}
|
|
24
|
+
read(length, position = 0) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (!this.buffer || this.buffer.length < length) {
|
|
27
|
+
this.buffer = Buffer.alloc(length);
|
|
28
|
+
}
|
|
29
|
+
const { buffer, bytesRead } = yield this.fd.read(this.buffer, 0, length, position);
|
|
30
|
+
return buffer.subarray(0, bytesRead);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
close() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
yield this.fd.close();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.FileReader = FileReader;
|
|
40
|
+
const createReaderFromFile = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const fd = yield fs_1.default.promises.open(filename, 'r');
|
|
42
|
+
return new FileReader(fd);
|
|
43
|
+
});
|
|
44
|
+
exports.createReaderFromFile = createReaderFromFile;
|
|
45
|
+
const createReadFunctions = (buffer, littleEndian, elfClass) => {
|
|
46
|
+
let position = 0;
|
|
47
|
+
const readAndIncrementPos = (inc, read) => {
|
|
48
|
+
const value = read(position);
|
|
49
|
+
position += inc;
|
|
50
|
+
return value;
|
|
51
|
+
};
|
|
52
|
+
const bufferReadUInt16 = (littleEndian ? buffer.readUInt16LE : buffer.readUInt16BE).bind(buffer);
|
|
53
|
+
const bufferReadUInt32 = (littleEndian ? buffer.readUInt32LE : buffer.readUInt32BE).bind(buffer);
|
|
54
|
+
const bufferReadBigUInt64 = (littleEndian ? buffer.readBigUInt64LE : buffer.readBigUInt64BE).bind(buffer);
|
|
55
|
+
const readUInt16 = () => readAndIncrementPos(2, bufferReadUInt16);
|
|
56
|
+
const readUInt32 = () => readAndIncrementPos(4, bufferReadUInt32);
|
|
57
|
+
const readBigUInt64 = () => readAndIncrementPos(8, bufferReadBigUInt64);
|
|
58
|
+
const readBigUInt32Or64 = elfClass === elf_constants_1.ElfClass.ELFCLASS32 ? () => BigInt(readUInt32()) : readBigUInt64;
|
|
59
|
+
return { readUInt16, readUInt32, readBigUInt32Or64 };
|
|
60
|
+
};
|
|
61
|
+
const SUPPORTED_ARCHS = [
|
|
62
|
+
elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_AARCH64],
|
|
63
|
+
elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_X86_64],
|
|
64
|
+
elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_ARM],
|
|
65
|
+
];
|
|
66
|
+
const SUPPORTED_ELF_TYPES = [elf_constants_1.ELF_TYPES_DESCRIPTION[elf_constants_1.ElfFileType.ET_DYN], elf_constants_1.ELF_TYPES_DESCRIPTION[elf_constants_1.ElfFileType.ET_EXEC]];
|
|
67
|
+
const BFD_TARGET_FOR_ARCH = {
|
|
68
|
+
[elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_AARCH64]]: 'elf64-littleaarch64',
|
|
69
|
+
[elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_X86_64]]: 'elf64-x86_64',
|
|
70
|
+
};
|
|
71
|
+
const GENERIC_BFD_TARGET_FOR_ARCH = {
|
|
72
|
+
[elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_AARCH64]]: 'elf64-little',
|
|
73
|
+
[elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_X86_64]]: 'elf64-little',
|
|
74
|
+
};
|
|
75
|
+
const getBFDTargetForArch = (arch, littleEndian, elfClass) => {
|
|
76
|
+
if (arch === elf_constants_1.MACHINE_TYPES_DESCRIPTION[elf_constants_1.MachineType.EM_X86_64]) {
|
|
77
|
+
return `elf${elfClass}-x86-64`;
|
|
78
|
+
}
|
|
79
|
+
return `elf${elfClass}-${littleEndian ? 'little' : 'big'}${arch}`;
|
|
80
|
+
};
|
|
81
|
+
const getGenericBFDTargetForArch = (_arch, littleEndian, elfClass) => {
|
|
82
|
+
return `elf${elfClass}-${littleEndian ? 'little' : 'big'}`;
|
|
83
|
+
};
|
|
84
|
+
// Read the first 24 bytes of the file to get the ELF header (up to and including e_version field)
|
|
85
|
+
const getElfHeaderStart = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
const fd = yield fs_1.default.promises.open(filename, 'r');
|
|
87
|
+
const buffer = Buffer.alloc(24);
|
|
88
|
+
yield fd.read(buffer, 0, 24, 0);
|
|
89
|
+
yield fd.close();
|
|
90
|
+
return buffer;
|
|
91
|
+
});
|
|
92
|
+
const readElfHeader = (reader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
+
const result = { isElf: false };
|
|
94
|
+
try {
|
|
95
|
+
const IDENT_SIZE = 16;
|
|
96
|
+
const identBuffer = yield reader.read(IDENT_SIZE);
|
|
97
|
+
// check magic number: 0x7F followed by 'ELF' in ASCII
|
|
98
|
+
if (identBuffer.toString('hex', 0, 4) !== '7f454c46') {
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
result.isElf = true;
|
|
102
|
+
const elfClass = identBuffer.readUint8(4);
|
|
103
|
+
const data = identBuffer.readUint8(5);
|
|
104
|
+
const elfVersion = identBuffer.readUint8(6);
|
|
105
|
+
const abi = identBuffer.readUint8(7);
|
|
106
|
+
const abiVersion = identBuffer.readUint8(8);
|
|
107
|
+
if (elfClass !== elf_constants_1.ElfClass.ELFCLASS32 && elfClass !== elf_constants_1.ElfClass.ELFCLASS64) {
|
|
108
|
+
throw new Error(`Not a valid ELF file. Class '${elfClass}' is invalid.`);
|
|
109
|
+
}
|
|
110
|
+
if (data < 1 || data > 2) {
|
|
111
|
+
throw new Error(`Not a valid ELF file. Endianness '${data}' is invalid`);
|
|
112
|
+
}
|
|
113
|
+
const littleEndian = data === 1;
|
|
114
|
+
if (elfVersion !== 1) {
|
|
115
|
+
throw new Error(`Not a valid ELF file. Version '${elfVersion}' is invalid`);
|
|
116
|
+
}
|
|
117
|
+
const headerSize = elfClass === 1 ? 52 : 64;
|
|
118
|
+
const headerSizeLeft = headerSize - IDENT_SIZE;
|
|
119
|
+
const headerBuffer = yield reader.read(headerSizeLeft, IDENT_SIZE);
|
|
120
|
+
const { readUInt32, readUInt16, readBigUInt32Or64 } = createReadFunctions(headerBuffer, littleEndian, elfClass);
|
|
121
|
+
const type = readUInt16();
|
|
122
|
+
const machine = readUInt16();
|
|
123
|
+
const version = readUInt32();
|
|
124
|
+
if (version !== 1) {
|
|
125
|
+
throw new Error(`Not a valid ELF file. Version '${version}' is invalid`);
|
|
126
|
+
}
|
|
127
|
+
const entry = readBigUInt32Or64();
|
|
128
|
+
const phoff = readBigUInt32Or64();
|
|
129
|
+
const shoff = readBigUInt32Or64();
|
|
130
|
+
const flags = readUInt32();
|
|
131
|
+
const ehsize = readUInt16();
|
|
132
|
+
const phentsize = readUInt16();
|
|
133
|
+
const phnum = readUInt16();
|
|
134
|
+
const shentsize = readUInt16();
|
|
135
|
+
const shnum = readUInt16();
|
|
136
|
+
const shstrndx = readUInt16();
|
|
137
|
+
if ((elfClass === 1 && ehsize !== 0x34) || (elfClass === 2 && ehsize !== 0x40)) {
|
|
138
|
+
throw Error(`Invalid ELF file. Unexpected header size '${ehsize}'`);
|
|
139
|
+
}
|
|
140
|
+
result.elfHeader = {
|
|
141
|
+
// e_indent content
|
|
142
|
+
elfClass,
|
|
143
|
+
data,
|
|
144
|
+
elfVersion,
|
|
145
|
+
abi,
|
|
146
|
+
abiVersion,
|
|
147
|
+
littleEndian,
|
|
148
|
+
e_type: type,
|
|
149
|
+
e_machine: machine,
|
|
150
|
+
e_version: version,
|
|
151
|
+
e_entry: entry,
|
|
152
|
+
e_phoff: phoff,
|
|
153
|
+
e_shoff: shoff,
|
|
154
|
+
e_flags: flags,
|
|
155
|
+
e_ehsize: ehsize,
|
|
156
|
+
e_phentsize: phentsize,
|
|
157
|
+
e_phnum: phnum,
|
|
158
|
+
e_shentsize: shentsize,
|
|
159
|
+
e_shnum: shnum,
|
|
160
|
+
e_shstrndx: shstrndx,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
result.error = error;
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
});
|
|
168
|
+
exports.readElfHeader = readElfHeader;
|
|
169
|
+
const readElfSectionHeader = (reader, elfHeader, index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
+
const buf = yield reader.read(elfHeader.e_shentsize, Number(elfHeader.e_shoff) + index * elfHeader.e_shentsize);
|
|
171
|
+
const { readUInt32, readBigUInt32Or64 } = createReadFunctions(buf, elfHeader.littleEndian, elfHeader.elfClass);
|
|
172
|
+
return {
|
|
173
|
+
name: '',
|
|
174
|
+
sh_name: readUInt32(),
|
|
175
|
+
sh_type: readUInt32(),
|
|
176
|
+
sh_flags: readBigUInt32Or64(),
|
|
177
|
+
sh_addr: readBigUInt32Or64(),
|
|
178
|
+
sh_offset: readBigUInt32Or64(),
|
|
179
|
+
sh_size: readBigUInt32Or64(),
|
|
180
|
+
sh_link: readUInt32(),
|
|
181
|
+
sh_info: readUInt32(),
|
|
182
|
+
sh_addralign: readBigUInt32Or64(),
|
|
183
|
+
sh_entsize: readBigUInt32Or64(),
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
exports.readElfSectionHeader = readElfSectionHeader;
|
|
187
|
+
const readElfSectionHeaderTable = (reader, elfHeader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
|
+
if (elfHeader.e_shnum === 0) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const sectionHeaders = new Array(elfHeader.e_shnum);
|
|
192
|
+
for (let i = 0; i < elfHeader.e_shnum; i++) {
|
|
193
|
+
sectionHeaders[i] = yield (0, exports.readElfSectionHeader)(reader, elfHeader, i);
|
|
194
|
+
}
|
|
195
|
+
// add section names
|
|
196
|
+
if (elfHeader.e_shstrndx < sectionHeaders.length &&
|
|
197
|
+
sectionHeaders[elfHeader.e_shstrndx].sh_type === elf_constants_1.SectionHeaderType.SHT_STRTAB) {
|
|
198
|
+
const shstrtab = sectionHeaders[elfHeader.e_shstrndx];
|
|
199
|
+
const buf = yield reader.read(Number(shstrtab.sh_size), Number(shstrtab.sh_offset));
|
|
200
|
+
for (const sectionHeader of sectionHeaders) {
|
|
201
|
+
const nameOffset = sectionHeader.sh_name;
|
|
202
|
+
if (nameOffset < buf.length) {
|
|
203
|
+
const nullByteOffset = buf.indexOf(0, nameOffset);
|
|
204
|
+
sectionHeader.name = buf.toString('ascii', nameOffset, nullByteOffset);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return sectionHeaders;
|
|
209
|
+
});
|
|
210
|
+
exports.readElfSectionHeaderTable = readElfSectionHeaderTable;
|
|
211
|
+
const readElfProgramHeader = (reader, elfHeader, index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
212
|
+
const buf = yield reader.read(elfHeader.e_phentsize, Number(elfHeader.e_phoff) + index * elfHeader.e_phentsize);
|
|
213
|
+
const { readUInt32, readBigUInt32Or64 } = createReadFunctions(buf, elfHeader.littleEndian, elfHeader.elfClass);
|
|
214
|
+
if (elfHeader.elfClass === elf_constants_1.ElfClass.ELFCLASS32) {
|
|
215
|
+
return {
|
|
216
|
+
p_type: readUInt32(),
|
|
217
|
+
p_offset: readBigUInt32Or64(),
|
|
218
|
+
p_vaddr: readBigUInt32Or64(),
|
|
219
|
+
p_paddr: readBigUInt32Or64(),
|
|
220
|
+
p_filesz: readBigUInt32Or64(),
|
|
221
|
+
p_memsz: readBigUInt32Or64(),
|
|
222
|
+
p_flags: readUInt32(),
|
|
223
|
+
p_align: readBigUInt32Or64(),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
return {
|
|
228
|
+
p_type: readUInt32(),
|
|
229
|
+
p_flags: readUInt32(),
|
|
230
|
+
p_offset: readBigUInt32Or64(),
|
|
231
|
+
p_vaddr: readBigUInt32Or64(),
|
|
232
|
+
p_paddr: readBigUInt32Or64(),
|
|
233
|
+
p_filesz: readBigUInt32Or64(),
|
|
234
|
+
p_memsz: readBigUInt32Or64(),
|
|
235
|
+
p_align: readBigUInt32Or64(),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
exports.readElfProgramHeader = readElfProgramHeader;
|
|
240
|
+
const readElfProgramHeaderTable = (reader, elfHeader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
241
|
+
if (elfHeader.e_phnum === 0) {
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
const programHeaders = new Array(elfHeader.e_phnum);
|
|
245
|
+
for (let i = 0; i < elfHeader.e_phnum; i++) {
|
|
246
|
+
programHeaders[i] = yield (0, exports.readElfProgramHeader)(reader, elfHeader, i);
|
|
247
|
+
}
|
|
248
|
+
return programHeaders;
|
|
249
|
+
});
|
|
250
|
+
exports.readElfProgramHeaderTable = readElfProgramHeaderTable;
|
|
251
|
+
const readElfNote = (reader, sectionHeader, elfHeader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
252
|
+
const buf = yield reader.read(Number(sectionHeader.sh_size), Number(sectionHeader.sh_offset));
|
|
253
|
+
// read elf note header
|
|
254
|
+
const { readUInt32 } = createReadFunctions(buf, elfHeader.littleEndian, elfHeader.elfClass);
|
|
255
|
+
const namesz = readUInt32();
|
|
256
|
+
const descsz = readUInt32();
|
|
257
|
+
const type = readUInt32();
|
|
258
|
+
const name = buf.toString('ascii', 12, 12 + namesz);
|
|
259
|
+
const align = Number(sectionHeader.sh_addralign);
|
|
260
|
+
const descOffset = 12 + namesz;
|
|
261
|
+
// align to descOffset to `align` bytes without division
|
|
262
|
+
const alignedDescOffset = descOffset + ((align - (descOffset % align)) % align);
|
|
263
|
+
const desc = buf.subarray(alignedDescOffset, alignedDescOffset + descsz);
|
|
264
|
+
return { type, name, desc };
|
|
265
|
+
});
|
|
266
|
+
const getBuildIds = (reader, sectionHeaders, elfHeader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
267
|
+
let gnuBuildId = '';
|
|
268
|
+
let goBuildId = '';
|
|
269
|
+
const gnuBuildIdSection = sectionHeaders.find((section) => section.sh_type === elf_constants_1.SectionHeaderType.SHT_NOTE && section.name === '.note.gnu.build-id');
|
|
270
|
+
if (gnuBuildIdSection) {
|
|
271
|
+
const { type, name, desc } = yield readElfNote(reader, gnuBuildIdSection, elfHeader);
|
|
272
|
+
if (type === elf_constants_1.NoteType.NT_GNU_BUILD_ID || name === 'GNU') {
|
|
273
|
+
gnuBuildId = desc.toString('hex');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const goBuildIdSection = sectionHeaders.find((section) => section.sh_type === elf_constants_1.SectionHeaderType.SHT_NOTE && section.name === '.note.go.buildid');
|
|
277
|
+
if (goBuildIdSection) {
|
|
278
|
+
const { type, name, desc } = yield readElfNote(reader, goBuildIdSection, elfHeader);
|
|
279
|
+
if (type === elf_constants_1.NoteType.NT_GO_BUILD_ID || name === 'Go') {
|
|
280
|
+
goBuildId = desc.toString('ascii');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return { gnuBuildId, goBuildId };
|
|
284
|
+
});
|
|
285
|
+
exports.getBuildIds = getBuildIds;
|
|
286
|
+
const isSupportedArch = (arch) => {
|
|
287
|
+
return SUPPORTED_ARCHS.includes(arch);
|
|
288
|
+
};
|
|
289
|
+
exports.isSupportedArch = isSupportedArch;
|
|
290
|
+
const isSupportedElfType = (type) => {
|
|
291
|
+
return SUPPORTED_ELF_TYPES.includes(type);
|
|
292
|
+
};
|
|
293
|
+
exports.isSupportedElfType = isSupportedElfType;
|
|
294
|
+
const getSectionInfo = (sections) => {
|
|
295
|
+
const hasDebugInfo = sections.some((section) => section.name === '.debug_info');
|
|
296
|
+
const hasSymbols = sections.some((section) => section.name === '.symtab');
|
|
297
|
+
const hasCode = sections.some((section) => section.name === '.text' && section.sh_type === elf_constants_1.SectionHeaderType.SHT_PROGBITS);
|
|
298
|
+
return { hasDebugInfo, hasSymbols, hasCode };
|
|
299
|
+
};
|
|
300
|
+
exports.getSectionInfo = getSectionInfo;
|
|
301
|
+
const getElfFileMetadata = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
302
|
+
const metadata = {
|
|
303
|
+
filename,
|
|
304
|
+
isElf: false,
|
|
305
|
+
littleEndian: false,
|
|
306
|
+
elfClass: 0,
|
|
307
|
+
arch: '',
|
|
308
|
+
gnuBuildId: '',
|
|
309
|
+
goBuildId: '',
|
|
310
|
+
fileHash: '',
|
|
311
|
+
type: '',
|
|
312
|
+
hasDebugInfo: false,
|
|
313
|
+
hasSymbols: false,
|
|
314
|
+
hasCode: false,
|
|
315
|
+
};
|
|
316
|
+
let fileHandle;
|
|
317
|
+
try {
|
|
318
|
+
fileHandle = yield fs_1.default.promises.open(filename, 'r');
|
|
319
|
+
const reader = new FileReader(fileHandle);
|
|
320
|
+
const { isElf, elfHeader, error } = yield (0, exports.readElfHeader)(reader);
|
|
321
|
+
if (isElf) {
|
|
322
|
+
metadata.littleEndian = elfHeader.littleEndian;
|
|
323
|
+
metadata.elfClass = elfHeader.elfClass === elf_constants_1.ElfClass.ELFCLASS64 ? 64 : 32;
|
|
324
|
+
metadata.arch = elf_constants_1.MACHINE_TYPES_DESCRIPTION[elfHeader.e_machine];
|
|
325
|
+
metadata.type = elf_constants_1.ELF_TYPES_DESCRIPTION[elfHeader.e_type];
|
|
326
|
+
}
|
|
327
|
+
metadata.error = error;
|
|
328
|
+
metadata.isElf = isElf;
|
|
329
|
+
if (!isElf || error || !(0, exports.isSupportedArch)(metadata.arch) || !(0, exports.isSupportedElfType)(metadata.type)) {
|
|
330
|
+
return metadata;
|
|
331
|
+
}
|
|
332
|
+
const sectionHeaders = yield (0, exports.readElfSectionHeaderTable)(reader, elfHeader);
|
|
333
|
+
const { gnuBuildId, goBuildId } = yield (0, exports.getBuildIds)(reader, sectionHeaders, elfHeader);
|
|
334
|
+
const { hasDebugInfo, hasSymbols, hasCode } = (0, exports.getSectionInfo)(sectionHeaders);
|
|
335
|
+
let fileHash = '';
|
|
336
|
+
if (hasCode) {
|
|
337
|
+
// Only compute file hash if the file has code:
|
|
338
|
+
// if the file has no code, it is likely a debug info file and its hash is useless
|
|
339
|
+
fileHash = yield (0, exports.computeFileHash)(filename);
|
|
340
|
+
}
|
|
341
|
+
Object.assign(metadata, { fileHash, gnuBuildId, goBuildId, hasDebugInfo, hasSymbols, hasCode });
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
metadata.error = error;
|
|
345
|
+
}
|
|
346
|
+
finally {
|
|
347
|
+
if (fileHandle) {
|
|
348
|
+
yield fileHandle.close();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return metadata;
|
|
352
|
+
});
|
|
353
|
+
exports.getElfFileMetadata = getElfFileMetadata;
|
|
354
|
+
// Compute a file hash as SHA256 checksum of the first and last 4096 bytes of the file
|
|
355
|
+
// and the file size represented as a big endian uint64. Only the first 16 bytes (128 bits)
|
|
356
|
+
// of the hash are used.
|
|
357
|
+
const computeFileHash = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
358
|
+
const fd = yield fs_1.default.promises.open(filename, 'r');
|
|
359
|
+
try {
|
|
360
|
+
const stats = yield fd.stat();
|
|
361
|
+
const fileSize = stats.size;
|
|
362
|
+
const hash = (0, crypto_1.createHash)('sha256');
|
|
363
|
+
const buffer = Buffer.alloc(4096);
|
|
364
|
+
let { bytesRead } = yield fd.read(buffer, 0, 4096);
|
|
365
|
+
hash.update(buffer.slice(0, bytesRead));
|
|
366
|
+
({ bytesRead } = yield fd.read(buffer, 0, 4096, Math.max(0, fileSize - 4096)));
|
|
367
|
+
hash.update(buffer.slice(0, bytesRead));
|
|
368
|
+
buffer.writeBigUInt64BE(BigInt(fileSize), 0);
|
|
369
|
+
hash.update(buffer.slice(0, 8));
|
|
370
|
+
return hash.digest('hex').slice(0, 32);
|
|
371
|
+
}
|
|
372
|
+
finally {
|
|
373
|
+
yield fd.close();
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
exports.computeFileHash = computeFileHash;
|
|
377
|
+
const getSupportedBfdTargetsInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
378
|
+
var _a;
|
|
379
|
+
const { stdout } = yield (0, utils_1.execute)('objcopy --help');
|
|
380
|
+
const groups = (_a = /supported targets: (?<targets>.*)$/m.exec(stdout.toString())) === null || _a === void 0 ? void 0 : _a.groups;
|
|
381
|
+
if (groups) {
|
|
382
|
+
return groups.targets.split(/\s*/);
|
|
383
|
+
}
|
|
384
|
+
return [];
|
|
385
|
+
});
|
|
386
|
+
const getSupportedBfdTargets = (() => {
|
|
387
|
+
let promise;
|
|
388
|
+
return () => (promise =
|
|
389
|
+
promise ||
|
|
390
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
391
|
+
const targets = yield getSupportedBfdTargetsInternal();
|
|
392
|
+
return targets;
|
|
393
|
+
}))());
|
|
394
|
+
})();
|
|
395
|
+
const replaceElfHeader = (targetFilename, sourceFilename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
396
|
+
const sourceElfHeader = yield getElfHeaderStart(sourceFilename);
|
|
397
|
+
const fd2 = yield fs_1.default.promises.open(targetFilename, 'r+');
|
|
398
|
+
yield fd2.write(sourceElfHeader, 0, sourceElfHeader.length, 0);
|
|
399
|
+
yield fd2.close();
|
|
400
|
+
});
|
|
401
|
+
const copyElfDebugInfo = (filename, outputFile, elfFileMetadata, compressDebugSections) => __awaiter(void 0, void 0, void 0, function* () {
|
|
402
|
+
const supportedTargets = yield getSupportedBfdTargets();
|
|
403
|
+
let bfdTargetOption = '';
|
|
404
|
+
const bfdTarget = getBFDTargetForArch(elfFileMetadata.arch, elfFileMetadata.littleEndian, elfFileMetadata.elfClass);
|
|
405
|
+
if (!supportedTargets.includes(bfdTarget)) {
|
|
406
|
+
// To be able to use `objcopy` on a file with a different architecture than the host, we need to give the BFD target
|
|
407
|
+
const genericBfdTarget = getGenericBFDTargetForArch(elfFileMetadata.arch, elfFileMetadata.littleEndian, elfFileMetadata.elfClass);
|
|
408
|
+
bfdTargetOption = `-I ${genericBfdTarget}`;
|
|
409
|
+
}
|
|
410
|
+
const compressDebugSectionsOption = compressDebugSections ? '--compress-debug-sections' : '';
|
|
411
|
+
// Remove .gdb_index section as it is not needed and can be quite big
|
|
412
|
+
yield (0, utils_1.execute)(`objcopy ${bfdTargetOption} --only-keep-debug ${compressDebugSectionsOption} --remove-section=.gdb_index ${filename} ${outputFile}`);
|
|
413
|
+
if (bfdTargetOption) {
|
|
414
|
+
// Replace the ELF header in the extracted debug info file with the one from the initial file
|
|
415
|
+
yield replaceElfHeader(outputFile, filename);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
exports.copyElfDebugInfo = copyElfDebugInfo;
|
|
419
|
+
const getOutputFilenameFromBuildId = (buildId) => {
|
|
420
|
+
// Go build id may contain slashes, replace them with dashes so it can be used as a filename
|
|
421
|
+
return buildId.replace(/\//g, '-');
|
|
422
|
+
};
|
|
423
|
+
exports.getOutputFilenameFromBuildId = getOutputFilenameFromBuildId;
|
|
424
|
+
const getBuildId = (fileMetadata) => {
|
|
425
|
+
return fileMetadata.gnuBuildId || fileMetadata.goBuildId || fileMetadata.fileHash;
|
|
426
|
+
};
|
|
427
|
+
exports.getBuildId = getBuildId;
|
|
428
|
+
//# sourceMappingURL=elf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elf.js","sourceRoot":"","sources":["../../../src/commands/elf-symbols/elf.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,4CAAmB;AAEnB,+CAA2C;AAE3C,mDAQwB;AAwExB,MAAa,UAAU;IAIrB,YAAY,EAA0B;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAEY,IAAI,CAAC,MAAc,EAAE,QAAQ,GAAG,CAAC;;YAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE;gBAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;aACnC;YACD,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;YAEhF,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;QACtC,CAAC;KAAA;IAEY,KAAK;;YAChB,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC;KAAA;CACF;AApBD,gCAoBC;AAEM,MAAM,oBAAoB,GAAG,CAAO,QAAgB,EAAuB,EAAE;IAClF,MAAM,EAAE,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE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|
|
2
|
+
import { MultipartPayload, UploadOptions } from '../../helpers/upload';
|
|
3
|
+
export declare const getElfRequestBuilder: (apiKey: string, cliVersion: string, site: string) => (args: import("axios").AxiosRequestConfig<any>) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
+
export declare const uploadMultipartHelper: (requestBuilder: RequestBuilder, payload: MultipartPayload, opts: UploadOptions) => Promise<import("../../helpers/upload").UploadStatus>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.uploadMultipartHelper = exports.getElfRequestBuilder = void 0;
|
|
13
|
+
const base_intake_url_1 = require("../../helpers/base-intake-url");
|
|
14
|
+
const upload_1 = require("../../helpers/upload");
|
|
15
|
+
const utils_1 = require("../../helpers/utils");
|
|
16
|
+
const getElfRequestBuilder = (apiKey, cliVersion, site) => (0, utils_1.getRequestBuilder)({
|
|
17
|
+
apiKey,
|
|
18
|
+
baseUrl: (0, base_intake_url_1.getBaseSourcemapIntakeUrl)(site),
|
|
19
|
+
headers: new Map([
|
|
20
|
+
['DD-EVP-ORIGIN', 'datadog-ci elf-symbols'],
|
|
21
|
+
['DD-EVP-ORIGIN-VERSION', cliVersion],
|
|
22
|
+
]),
|
|
23
|
+
overrideUrl: 'api/v2/srcmap',
|
|
24
|
+
});
|
|
25
|
+
exports.getElfRequestBuilder = getElfRequestBuilder;
|
|
26
|
+
// This function exists partially just to make mocking network calls easier.
|
|
27
|
+
const uploadMultipartHelper = (requestBuilder, payload, opts) => __awaiter(void 0, void 0, void 0, function* () { return (0, upload_1.upload)(requestBuilder)(payload, opts); });
|
|
28
|
+
exports.uploadMultipartHelper = uploadMultipartHelper;
|
|
29
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/commands/elf-symbols/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAuE;AAEvE,iDAA4E;AAC5E,+CAAqD;AAE9C,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,UAAkB,EAAE,IAAY,EAAE,EAAE,CACvF,IAAA,yBAAiB,EAAC;IAChB,MAAM;IACN,OAAO,EAAE,IAAA,2CAAyB,EAAC,IAAI,CAAC;IACxC,OAAO,EAAE,IAAI,GAAG,CAAC;QACf,CAAC,eAAe,EAAE,wBAAwB,CAAC;QAC3C,CAAC,uBAAuB,EAAE,UAAU,CAAC;KACtC,CAAC;IACF,WAAW,EAAE,eAAe;CAC7B,CAAC,CAAA;AATS,QAAA,oBAAoB,wBAS7B;AAEJ,4EAA4E;AACrE,MAAM,qBAAqB,GAAG,CACnC,cAA8B,EAC9B,OAAyB,EACzB,IAAmB,EACnB,EAAE,kDAAC,OAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA,GAAA,CAAA;AAJ7B,QAAA,qBAAqB,yBAIQ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const TYPE_ELF_DEBUG_INFOS = "elf_symbol_file";
|
|
2
|
+
export declare const VALUE_NAME_ELF_DEBUG_INFOS = "elf_symbol_file";
|
|
3
|
+
export declare const ELF_DEBUG_INFOS_FILENAME = "elf_symbol_file";
|
|
4
|
+
export interface MappingMetadata {
|
|
5
|
+
arch?: string;
|
|
6
|
+
cli_version: string;
|
|
7
|
+
git_commit_sha?: string;
|
|
8
|
+
git_repository_url?: string;
|
|
9
|
+
platform?: string;
|
|
10
|
+
gnu_build_id: string;
|
|
11
|
+
go_build_id: string;
|
|
12
|
+
file_hash: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ELF_DEBUG_INFOS_FILENAME = exports.VALUE_NAME_ELF_DEBUG_INFOS = exports.TYPE_ELF_DEBUG_INFOS = void 0;
|
|
4
|
+
exports.TYPE_ELF_DEBUG_INFOS = 'elf_symbol_file';
|
|
5
|
+
exports.VALUE_NAME_ELF_DEBUG_INFOS = 'elf_symbol_file';
|
|
6
|
+
exports.ELF_DEBUG_INFOS_FILENAME = 'elf_symbol_file';
|
|
7
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/commands/elf-symbols/interfaces.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,iBAAiB,CAAA;AACxC,QAAA,0BAA0B,GAAG,iBAAiB,CAAA;AAC9C,QAAA,wBAAwB,GAAG,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UploadStatus } from '../../helpers/upload';
|
|
2
|
+
export interface UploadInfo {
|
|
3
|
+
fileType: string;
|
|
4
|
+
location: string;
|
|
5
|
+
platform: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const renderCommandInfo: (dryRun: boolean, symbolsLocation: string) => string;
|
|
8
|
+
export declare const renderCommandSummary: (statuses: UploadStatus[], duration: number, dryRun: boolean) => string;
|
|
9
|
+
export declare const renderMissingBuildId: (path: string) => string;
|
|
10
|
+
export declare const renderGitWarning: (errorMessage: string) => string;
|
|
11
|
+
export declare const renderWarning: (errorMessage: string) => string;
|
|
12
|
+
export declare const renderArgumentMissingError: (argumentName: string) => string;
|
|
13
|
+
export declare const renderInvalidSymbolsLocation: (symbolsDirectory: string) => string;
|
|
14
|
+
export declare const renderMissingBinUtils: () => string;
|
|
15
|
+
export declare const renderGeneralizedError: (error: any) => string;
|
|
16
|
+
export declare const renderFailedUpload: (filePath: string, errorMessage: string) => string;
|
|
17
|
+
export declare const renderRetriedUpload: (filePath: string, errorMessage: string, attempt: number) => string;
|
|
18
|
+
export declare const renderUpload: (filePath: string, buildId: string) => string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderUpload = exports.renderRetriedUpload = exports.renderFailedUpload = exports.renderGeneralizedError = exports.renderMissingBinUtils = exports.renderInvalidSymbolsLocation = exports.renderArgumentMissingError = exports.renderWarning = exports.renderGitWarning = exports.renderMissingBuildId = exports.renderCommandSummary = exports.renderCommandInfo = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const formatting_1 = require("../../helpers/formatting");
|
|
9
|
+
const upload_1 = require("../../helpers/upload");
|
|
10
|
+
const utils_1 = require("../../helpers/utils");
|
|
11
|
+
const renderCommandInfo = (dryRun, symbolsLocation) => {
|
|
12
|
+
let fullString = '';
|
|
13
|
+
if (dryRun) {
|
|
14
|
+
fullString += chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} DRY-RUN MODE ENABLED. WILL NOT UPLOAD SYMBOLS\n`);
|
|
15
|
+
}
|
|
16
|
+
const startStr = chalk_1.default.green('Starting upload. \n');
|
|
17
|
+
fullString += startStr;
|
|
18
|
+
fullString += chalk_1.default.green(`Uploading symbols from location ${symbolsLocation}\n`);
|
|
19
|
+
fullString += chalk_1.default.green(`After upload is successful symbol files will be processed and ready to use within the next 5 minutes.\n`);
|
|
20
|
+
return fullString;
|
|
21
|
+
};
|
|
22
|
+
exports.renderCommandInfo = renderCommandInfo;
|
|
23
|
+
const renderCommandSummary = (statuses, duration, dryRun) => {
|
|
24
|
+
const results = new Map();
|
|
25
|
+
statuses.forEach((status) => {
|
|
26
|
+
if (!results.has(status)) {
|
|
27
|
+
results.set(status, 0);
|
|
28
|
+
}
|
|
29
|
+
results.set(status, results.get(status) + 1);
|
|
30
|
+
});
|
|
31
|
+
const output = ['', chalk_1.default.bold('Command summary:')];
|
|
32
|
+
if (results.get(upload_1.UploadStatus.Failure)) {
|
|
33
|
+
output.push(chalk_1.default.red(`${formatting_1.ICONS.FAILED} Some symbol files may not been uploaded correctly.`));
|
|
34
|
+
}
|
|
35
|
+
else if (results.get(upload_1.UploadStatus.Skipped)) {
|
|
36
|
+
output.push(chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} Some symbol files have been skipped.`));
|
|
37
|
+
}
|
|
38
|
+
else if (results.get(upload_1.UploadStatus.Success)) {
|
|
39
|
+
if (dryRun) {
|
|
40
|
+
output.push(chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} [DRYRUN] Handled symbol ${(0, utils_1.pluralize)(results.get(upload_1.UploadStatus.Success), 'file', 'files')} with success in ${duration} seconds.`));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
output.push(chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} Uploaded symbol ${(0, utils_1.pluralize)(results.get(upload_1.UploadStatus.Success), 'file', 'files')} in ${duration} seconds.`));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
output.push(chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} No actions were taken. Did you specify the correct path?`));
|
|
48
|
+
}
|
|
49
|
+
return output.join('\n') + '\n';
|
|
50
|
+
};
|
|
51
|
+
exports.renderCommandSummary = renderCommandSummary;
|
|
52
|
+
const renderMissingBuildId = (path) => chalk_1.default.red(`${formatting_1.ICONS.FAILED} Error: Invalid or missing 'build_id' file. Expected at path ${path}`);
|
|
53
|
+
exports.renderMissingBuildId = renderMissingBuildId;
|
|
54
|
+
const renderGitWarning = (errorMessage) => chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} An error occured while invoking git: ${errorMessage}
|
|
55
|
+
Make sure the command is running within your git repository to fully leverage Datadog's git integration.
|
|
56
|
+
To ignore this warning use the --disable-git flag.\n`);
|
|
57
|
+
exports.renderGitWarning = renderGitWarning;
|
|
58
|
+
const renderWarning = (errorMessage) => chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} ${errorMessage}.\n`);
|
|
59
|
+
exports.renderWarning = renderWarning;
|
|
60
|
+
const renderArgumentMissingError = (argumentName) => chalk_1.default.red(`${formatting_1.ICONS.FAILED} Error: parameter "${argumentName}" is required.\n`);
|
|
61
|
+
exports.renderArgumentMissingError = renderArgumentMissingError;
|
|
62
|
+
const renderInvalidSymbolsLocation = (symbolsDirectory) => chalk_1.default.red(`${formatting_1.ICONS.FAILED} Failed to get symbols files - ${symbolsDirectory} is not a file, nor a directory.\n`);
|
|
63
|
+
exports.renderInvalidSymbolsLocation = renderInvalidSymbolsLocation;
|
|
64
|
+
const renderMissingBinUtils = () => chalk_1.default.red(`${formatting_1.ICONS.FAILED} Could not find required 'objcopy' program. Please install binutils.\n`);
|
|
65
|
+
exports.renderMissingBinUtils = renderMissingBinUtils;
|
|
66
|
+
const renderGeneralizedError = (error) => {
|
|
67
|
+
let str = chalk_1.default.red(`${formatting_1.ICONS.FAILED} Error: ${error}\n`);
|
|
68
|
+
str += error.stack;
|
|
69
|
+
return str;
|
|
70
|
+
};
|
|
71
|
+
exports.renderGeneralizedError = renderGeneralizedError;
|
|
72
|
+
const renderFailedUpload = (filePath, errorMessage) => {
|
|
73
|
+
const filePathBold = `[${chalk_1.default.bold.dim(filePath)}]`;
|
|
74
|
+
return chalk_1.default.red(`${formatting_1.ICONS.FAILED} Failed upload for ${filePathBold}: ${errorMessage}\n`);
|
|
75
|
+
};
|
|
76
|
+
exports.renderFailedUpload = renderFailedUpload;
|
|
77
|
+
const renderRetriedUpload = (filePath, errorMessage, attempt) => {
|
|
78
|
+
const sourcemapPathBold = `[${chalk_1.default.bold.dim(filePath)}]`;
|
|
79
|
+
return chalk_1.default.yellow(`[attempt ${attempt}] Retrying upload ${sourcemapPathBold}: ${errorMessage}\n`);
|
|
80
|
+
};
|
|
81
|
+
exports.renderRetriedUpload = renderRetriedUpload;
|
|
82
|
+
const renderUpload = (filePath, buildId) => `Uploading debug info for ELF file ${filePath} with buildId ${buildId}\n`;
|
|
83
|
+
exports.renderUpload = renderUpload;
|
|
84
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/elf-symbols/renderer.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,yDAA8C;AAC9C,iDAAiD;AACjD,+CAA6C;AAQtC,MAAM,iBAAiB,GAAG,CAAC,MAAe,EAAE,eAAuB,EAAE,EAAE;IAC5E,IAAI,UAAU,GAAG,EAAE,CAAA;IACnB,IAAI,MAAM,EAAE;QACV,UAAU,IAAI,eAAK,CAAC,MAAM,CAAC,GAAG,kBAAK,CAAC,OAAO,kDAAkD,CAAC,CAAA;KAC/F;IACD,MAAM,QAAQ,GAAG,eAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAEnD,UAAU,IAAI,QAAQ,CAAA;IACtB,UAAU,IAAI,eAAK,CAAC,KAAK,CAAC,mCAAmC,eAAe,IAAI,CAAC,CAAA;IAEjF,UAAU,IAAI,eAAK,CAAC,KAAK,CACvB,yGAAyG,CAC1G,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAfY,QAAA,iBAAiB,qBAe7B;AAEM,MAAM,oBAAoB,GAAG,C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