@datadog/datadog-ci 2.6.0 → 2.8.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/commands/git-metadata/gitdb.d.ts +7 -0
- package/dist/commands/git-metadata/gitdb.js +267 -0
- package/dist/commands/git-metadata/gitdb.js.map +1 -0
- package/dist/commands/git-metadata/renderer.d.ts +0 -1
- package/dist/commands/git-metadata/renderer.js +8 -11
- package/dist/commands/git-metadata/renderer.js.map +1 -1
- package/dist/commands/git-metadata/upload.d.ts +9 -2
- package/dist/commands/git-metadata/upload.js +106 -46
- package/dist/commands/git-metadata/upload.js.map +1 -1
- package/dist/commands/git-metadata/utils.d.ts +16 -0
- package/dist/commands/git-metadata/utils.js +57 -0
- package/dist/commands/git-metadata/utils.js.map +1 -0
- package/dist/commands/lambda/constants.d.ts +1 -0
- package/dist/commands/lambda/constants.js +3 -2
- package/dist/commands/lambda/constants.js.map +1 -1
- package/dist/commands/lambda/functions/commons.d.ts +26 -25
- package/dist/commands/lambda/functions/commons.js +67 -93
- package/dist/commands/lambda/functions/commons.js.map +1 -1
- package/dist/commands/lambda/functions/instrument.d.ts +6 -5
- package/dist/commands/lambda/functions/instrument.js +11 -11
- package/dist/commands/lambda/functions/instrument.js.map +1 -1
- package/dist/commands/lambda/functions/uninstrument.d.ts +6 -5
- package/dist/commands/lambda/functions/uninstrument.js +11 -10
- package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
- package/dist/commands/lambda/instrument.d.ts +2 -0
- package/dist/commands/lambda/instrument.js +43 -27
- package/dist/commands/lambda/instrument.js.map +1 -1
- package/dist/commands/lambda/interfaces.d.ts +13 -10
- package/dist/commands/lambda/loggroup.d.ts +10 -7
- package/dist/commands/lambda/loggroup.js +45 -26
- package/dist/commands/lambda/loggroup.js.map +1 -1
- package/dist/commands/lambda/tags.d.ts +7 -5
- package/dist/commands/lambda/tags.js +29 -17
- package/dist/commands/lambda/tags.js.map +1 -1
- package/dist/commands/lambda/uninstrument.d.ts +1 -0
- package/dist/commands/lambda/uninstrument.js +32 -18
- package/dist/commands/lambda/uninstrument.js.map +1 -1
- package/dist/commands/synthetics/command.d.ts +1 -0
- package/dist/commands/synthetics/command.js +5 -3
- package/dist/commands/synthetics/command.js.map +1 -1
- package/dist/commands/synthetics/mobile.d.ts +1 -2
- package/dist/commands/synthetics/mobile.js +34 -9
- package/dist/commands/synthetics/mobile.js.map +1 -1
- package/dist/commands/synthetics/run-test.js +1 -1
- package/dist/commands/synthetics/run-test.js.map +1 -1
- package/dist/commands/synthetics/utils.d.ts +9 -10
- package/dist/commands/synthetics/utils.js +16 -10
- package/dist/commands/synthetics/utils.js.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/helpers/interfaces.d.ts +2 -2
- package/dist/helpers/retry.d.ts +1 -1
- package/dist/helpers/retry.js +3 -2
- package/dist/helpers/retry.js.map +1 -1
- package/package.json +9 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import * as simpleGit from 'simple-git';
|
|
3
|
+
import { RequestBuilder } from '../../helpers/interfaces';
|
|
4
|
+
import { Logger } from './utils';
|
|
5
|
+
export declare const uploadToGitDB: (log: Logger, request: RequestBuilder, git: simpleGit.SimpleGit, dryRun: boolean, repositoryURL?: string | undefined) => Promise<void>;
|
|
6
|
+
export declare const uploadPackfiles: (log: Logger, request: RequestBuilder, repoURL: string, headCommit: string, packfilePaths: string[]) => Promise<void>;
|
|
7
|
+
export declare const uploadPackfile: (log: Logger, request: RequestBuilder, repoURL: string, headCommit: string, packfilePath: string) => Promise<AxiosResponse<any>>;
|
|
@@ -0,0 +1,267 @@
|
|
|
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.uploadPackfile = exports.uploadPackfiles = exports.uploadToGitDB = void 0;
|
|
16
|
+
const child_process_1 = __importDefault(require("child_process"));
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const promises_1 = require("fs/promises");
|
|
19
|
+
const os_1 = __importDefault(require("os"));
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
22
|
+
const retry_1 = require("../../helpers/retry");
|
|
23
|
+
const git_1 = require("./git");
|
|
24
|
+
const API_TIMEOUT = 15000;
|
|
25
|
+
// we only consider recent commits to avoid uploading the whole repository
|
|
26
|
+
// at most 1000 commits or > 1 month of data is considered.
|
|
27
|
+
const MAX_HISTORY = {
|
|
28
|
+
maxCommits: 1000,
|
|
29
|
+
oldestCommits: '1 month ago',
|
|
30
|
+
};
|
|
31
|
+
const uploadToGitDB = (log, request, git, dryRun, repositoryURL) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
let repoURL;
|
|
33
|
+
if (repositoryURL) {
|
|
34
|
+
repoURL = repositoryURL;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
try {
|
|
38
|
+
repoURL = yield git_1.gitRemote(git);
|
|
39
|
+
log.debug(`Syncing repository ${repoURL}`);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
log.warn(`Failed getting repository URL: ${err}`);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
yield unshallowRepositoryWhenNeeded(log, git);
|
|
47
|
+
let latestCommits;
|
|
48
|
+
try {
|
|
49
|
+
latestCommits = yield getLatestLocalCommits(git);
|
|
50
|
+
if (latestCommits.length === 0) {
|
|
51
|
+
log.debug('No local commits found.');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
log.debug(`${latestCommits.length} commits found, asking GitDB which ones are missing.`);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
log.warn(`Failed getting local commits: ${err}`);
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
let commitsToExclude;
|
|
61
|
+
try {
|
|
62
|
+
commitsToExclude = yield getKnownCommits(log, request, repoURL, latestCommits);
|
|
63
|
+
log.debug(`${commitsToExclude.length} commits already in GitDB.`);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
log.warn(`Failed getting commits to exclude: ${err}`);
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
// Get the list of all objects (commits, trees) to upload. This list can be quite long
|
|
70
|
+
// so quite memory intensive (multiple MBs).
|
|
71
|
+
let objectsToUpload;
|
|
72
|
+
try {
|
|
73
|
+
objectsToUpload = yield getObjectsToUpload(git, commitsToExclude);
|
|
74
|
+
log.debug(`${objectsToUpload.length} objects to upload.`);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
log.warn(`Failed getting objects to upload: ${err}`);
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
let packfiles;
|
|
81
|
+
let tmpDir;
|
|
82
|
+
try {
|
|
83
|
+
;
|
|
84
|
+
[packfiles, tmpDir] = yield generatePackFilesForCommits(log, objectsToUpload);
|
|
85
|
+
log.debug(`${packfiles.length} packfiles generated.`);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
log.warn(`Failed generating packfiles: ${err}`);
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
if (dryRun) {
|
|
93
|
+
log.debug(`Dry-run enabled, not uploading anything.`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
log.debug(`Uploading packfiles...`);
|
|
97
|
+
yield exports.uploadPackfiles(log, request, repoURL, latestCommits[0], packfiles);
|
|
98
|
+
log.debug('Successfully uploaded packfiles.');
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
log.warn(`Failed to upload packfiles: ${err}`);
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
if (tmpDir !== undefined) {
|
|
106
|
+
fs_1.default.rmSync(tmpDir, { recursive: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
exports.uploadToGitDB = uploadToGitDB;
|
|
111
|
+
const getLatestLocalCommits = (git) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
// we add some boundaries to avoid retrieving ALL commits here.
|
|
113
|
+
const logResult = yield git.log([`-n ${MAX_HISTORY.maxCommits}`, `--since="${MAX_HISTORY.oldestCommits}"`]);
|
|
114
|
+
return logResult.all.map((c) => c.hash);
|
|
115
|
+
});
|
|
116
|
+
const unshallowRepositoryWhenNeeded = (log, git) => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
const isShallow = (yield git.revparse('--is-shallow-repository')) === 'true';
|
|
118
|
+
if (isShallow) {
|
|
119
|
+
log.info('[unshallow] Git repository is a shallow clone., unshallowing it...');
|
|
120
|
+
log.info('[unshallow] Setting remote.origin.partialclonefilter to "blob:none" to avoid fetching file content');
|
|
121
|
+
yield git.addConfig('remote.origin.partialclonefilter', 'blob:none');
|
|
122
|
+
log.info(`[unshallow] Running git fetch --shallow-since="${MAX_HISTORY.oldestCommits}" --update-shallow --refetch`);
|
|
123
|
+
yield git.fetch([`--shallow-since="${MAX_HISTORY.oldestCommits}"`, '--update-shallow', '--refetch']);
|
|
124
|
+
log.info('[unshallow] Fetch completed.');
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
// getKnownCommits asks the backend which of the given commits are already known
|
|
128
|
+
const getKnownCommits = (log, request, repoURL, latestCommits) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
const localCommitData = JSON.stringify({
|
|
130
|
+
meta: {
|
|
131
|
+
repository_url: repoURL,
|
|
132
|
+
},
|
|
133
|
+
data: latestCommits.map((commit) => ({
|
|
134
|
+
id: commit,
|
|
135
|
+
type: 'commit',
|
|
136
|
+
})),
|
|
137
|
+
});
|
|
138
|
+
const response = yield runRequest(log, 'search_commits', () => request({
|
|
139
|
+
url: '/api/v2/git/repository/search_commits',
|
|
140
|
+
headers: {
|
|
141
|
+
'Content-Type': 'application/json',
|
|
142
|
+
},
|
|
143
|
+
data: localCommitData,
|
|
144
|
+
method: 'POST',
|
|
145
|
+
timeout: API_TIMEOUT,
|
|
146
|
+
}));
|
|
147
|
+
const commits = response.data;
|
|
148
|
+
if (!commits || commits.data === undefined) {
|
|
149
|
+
throw new Error(`Invalid API response: ${response}`);
|
|
150
|
+
}
|
|
151
|
+
return commits.data.map((c) => {
|
|
152
|
+
if (c.type !== 'commit' || c.id === undefined) {
|
|
153
|
+
throw new Error('Invalid commit type response');
|
|
154
|
+
}
|
|
155
|
+
return validateCommit(c.id);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
const validateCommit = (sha) => {
|
|
159
|
+
const isValidSha1 = (s) => /^[0-9a-f]{40}$/.test(s);
|
|
160
|
+
const isValidSha256 = (s) => /^[0-9a-f]{64}$/.test(s);
|
|
161
|
+
if (!isValidSha1(sha) && !isValidSha256(sha)) {
|
|
162
|
+
throw new Error(`Invalid commit format: ${sha}`);
|
|
163
|
+
}
|
|
164
|
+
return sha;
|
|
165
|
+
};
|
|
166
|
+
const getObjectsToUpload = (git, commitsToExclude) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
+
const rawResponse = yield git.raw([
|
|
168
|
+
'rev-list',
|
|
169
|
+
'--objects',
|
|
170
|
+
'--no-object-names',
|
|
171
|
+
'--filter=blob:none',
|
|
172
|
+
`--since="${MAX_HISTORY.oldestCommits}"`,
|
|
173
|
+
'HEAD',
|
|
174
|
+
].concat(commitsToExclude.map((sha) => '^' + sha)));
|
|
175
|
+
const commitsToInclude = rawResponse.split('\n').filter((c) => c !== '');
|
|
176
|
+
return commitsToInclude;
|
|
177
|
+
});
|
|
178
|
+
const generatePackFilesForCommits = (log, commits) => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
|
+
if (commits.length === 0) {
|
|
180
|
+
return [[], undefined];
|
|
181
|
+
}
|
|
182
|
+
const generatePackfiles = (baseTmpPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
+
const randomPrefix = String(Math.floor(Math.random() * 10000));
|
|
184
|
+
const tmpPath = yield promises_1.mkdtemp(path_1.default.join(baseTmpPath, 'dd-packfiles-'));
|
|
185
|
+
const packfilePath = path_1.default.join(tmpPath, randomPrefix);
|
|
186
|
+
const packObjectResults = child_process_1.default
|
|
187
|
+
.execSync(`git pack-objects --compression=9 --max-pack-size=3m ${packfilePath}`, {
|
|
188
|
+
input: commits.join('\n'),
|
|
189
|
+
})
|
|
190
|
+
.toString()
|
|
191
|
+
.split('\n')
|
|
192
|
+
.filter((sha) => sha.length > 0)
|
|
193
|
+
.map((sha) => `${packfilePath}-${sha}.pack`);
|
|
194
|
+
return [packObjectResults, tmpPath];
|
|
195
|
+
});
|
|
196
|
+
// Try using tmp folder first:
|
|
197
|
+
try {
|
|
198
|
+
return yield generatePackfiles(os_1.default.tmpdir());
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
/**
|
|
202
|
+
* The generation of pack files in the temporary folder (from `os.tmpdir()`)
|
|
203
|
+
* sometimes fails in certain CI setups with the error message
|
|
204
|
+
* `unable to rename temporary pack file: Invalid cross-device link`.
|
|
205
|
+
* The reason why is unclear.
|
|
206
|
+
*
|
|
207
|
+
* A workaround is to attempt to generate the pack files in `process.cwd()`.
|
|
208
|
+
* While this works most of the times, it's not ideal since it affects the git status.
|
|
209
|
+
* This workaround is intended to be temporary.
|
|
210
|
+
*
|
|
211
|
+
* TODO: fix issue and remove workaround.
|
|
212
|
+
*/
|
|
213
|
+
log.warn(`Failed generation of packfiles in tmpdir: ${err}`);
|
|
214
|
+
log.warn(`Generating them in ${process.cwd()} instead`);
|
|
215
|
+
return generatePackfiles(process.cwd());
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
const uploadPackfiles = (log, request, repoURL, headCommit, packfilePaths) => __awaiter(void 0, void 0, void 0, function* () {
|
|
219
|
+
// this loop makes sure requests are performed sequentially
|
|
220
|
+
for (const pack of packfilePaths) {
|
|
221
|
+
yield exports.uploadPackfile(log, request, repoURL, headCommit, pack);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
exports.uploadPackfiles = uploadPackfiles;
|
|
225
|
+
const uploadPackfile = (log, request, repoURL, headCommit, packfilePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
226
|
+
const pushedSha = JSON.stringify({
|
|
227
|
+
data: {
|
|
228
|
+
id: headCommit,
|
|
229
|
+
type: 'commit',
|
|
230
|
+
},
|
|
231
|
+
meta: {
|
|
232
|
+
repository_url: repoURL,
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
const form = new form_data_1.default();
|
|
236
|
+
form.append('pushedSha', pushedSha, { contentType: 'application/json' });
|
|
237
|
+
const packFileContent = fs_1.default.readFileSync(packfilePath);
|
|
238
|
+
// The original filename includes a random prefix, so we remove it here
|
|
239
|
+
const [, filename] = path_1.default.basename(packfilePath).split('-');
|
|
240
|
+
form.append('packfile', packFileContent, {
|
|
241
|
+
filename,
|
|
242
|
+
contentType: 'application/octet-stream',
|
|
243
|
+
});
|
|
244
|
+
return runRequest(log, 'packfile', () => request({
|
|
245
|
+
url: '/api/v2/git/repository/packfile',
|
|
246
|
+
headers: Object.assign({}, form.getHeaders()),
|
|
247
|
+
timeout: API_TIMEOUT,
|
|
248
|
+
data: form,
|
|
249
|
+
method: 'POST',
|
|
250
|
+
}));
|
|
251
|
+
});
|
|
252
|
+
exports.uploadPackfile = uploadPackfile;
|
|
253
|
+
// runRequest will run the passed request, with retries of retriable errors + logging of any retry attempt.
|
|
254
|
+
const runRequest = (log, reqName, request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
255
|
+
return retry_1.retryRequest(request, {
|
|
256
|
+
retries: 2,
|
|
257
|
+
onRetry: (e, attempt) => {
|
|
258
|
+
let errorMessage = `${e}`;
|
|
259
|
+
const maybeHttpError = e;
|
|
260
|
+
if (maybeHttpError.response && maybeHttpError.response.statusText) {
|
|
261
|
+
errorMessage = `${maybeHttpError.message} (${maybeHttpError.response.statusText})`;
|
|
262
|
+
}
|
|
263
|
+
log.warn(`[attempt ${attempt}] Retrying ${reqName} request: ${errorMessage}`);
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
//# sourceMappingURL=gitdb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitdb.js","sourceRoot":"","sources":["../../../src/commands/git-metadata/gitdb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAAyC;AACzC,4CAAmB;AACnB,0CAAmC;AACnC,4CAAmB;AACnB,gDAAuB;AAGvB,0DAAgC;AAIhC,+CAAgD;AAEhD,+BAA6C;AAG7C,MAAM,WAAW,GAAG,KAAK,CAAA;AAEzB,0EAA0E;AAC1E,2DAA2D;AAC3D,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,aAAa;CAC7B,CAAA;AAEM,MAAM,aAAa,GAAG,CAC3B,GAAW,EACX,OAAuB,EACvB,GAAwB,EACxB,MAAe,EACf,aAAsB,EACtB,EAAE;IACF,IAAI,OAA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Q,CAAC,UAAU,GAAG,CAAA;aACnF;YACD,GAAG,CAAC,IAAI,CAAC,YAAY,OAAO,cAAc,OAAO,aAAa,YAAY,EAAE,CAAC,CAAA;QAC/E,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommitInfo } from './interfaces';
|
|
2
|
-
export declare const renderGitError: (errorMessage: string) => string;
|
|
3
2
|
export declare const renderConfigurationError: (error: Error) => string;
|
|
4
3
|
export declare const renderFailedUpload: (errorMessage: string) => string;
|
|
5
4
|
export declare const renderRetriedUpload: (errorMessage: string, attempt: number) => string;
|
|
@@ -3,30 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderCommandInfo = exports.renderDryRunWarning = exports.renderSuccessfulCommand = exports.renderRetriedUpload = exports.renderFailedUpload = exports.renderConfigurationError =
|
|
6
|
+
exports.renderCommandInfo = exports.renderDryRunWarning = exports.renderSuccessfulCommand = exports.renderRetriedUpload = exports.renderFailedUpload = exports.renderConfigurationError = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const formatting_1 = require("../../helpers/formatting");
|
|
9
|
-
const
|
|
10
|
-
Make sure the command is running within your git repository.\n`);
|
|
11
|
-
exports.renderGitError = renderGitError;
|
|
12
|
-
const renderConfigurationError = (error) => chalk_1.default.red(`${formatting_1.ICONS.FAILED} Configuration error: ${error}.\n`);
|
|
9
|
+
const renderConfigurationError = (error) => `${formatting_1.ICONS.FAILED} Configuration error: ${error}.`;
|
|
13
10
|
exports.renderConfigurationError = renderConfigurationError;
|
|
14
|
-
const renderFailedUpload = (errorMessage) =>
|
|
11
|
+
const renderFailedUpload = (errorMessage) => `${formatting_1.ICONS.FAILED} Failed upload: ${errorMessage}`;
|
|
15
12
|
exports.renderFailedUpload = renderFailedUpload;
|
|
16
|
-
const renderRetriedUpload = (errorMessage, attempt) =>
|
|
13
|
+
const renderRetriedUpload = (errorMessage, attempt) => `[attempt ${attempt}] Retrying upload: ${errorMessage}`;
|
|
17
14
|
exports.renderRetriedUpload = renderRetriedUpload;
|
|
18
15
|
const renderSuccessfulCommand = (duration, dryRun) => {
|
|
19
16
|
if (dryRun) {
|
|
20
|
-
return chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} [DRYRUN] Handled in ${duration} seconds
|
|
17
|
+
return chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} [DRYRUN] Handled in ${duration} seconds.`);
|
|
21
18
|
}
|
|
22
19
|
else {
|
|
23
|
-
return chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} Uploaded in ${duration} seconds
|
|
20
|
+
return chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} Uploaded in ${duration} seconds.`);
|
|
24
21
|
}
|
|
25
22
|
};
|
|
26
23
|
exports.renderSuccessfulCommand = renderSuccessfulCommand;
|
|
27
|
-
const renderDryRunWarning = () =>
|
|
24
|
+
const renderDryRunWarning = () => `${formatting_1.ICONS.WARNING} DRY-RUN MODE ENABLED. WILL NOT UPLOAD`;
|
|
28
25
|
exports.renderDryRunWarning = renderDryRunWarning;
|
|
29
26
|
const renderCommandInfo = (commit) => `Reporting commit ${commit.hash} from repository ${commit.remote}.
|
|
30
|
-
${commit.trackedFiles.length} tracked file paths will be reported
|
|
27
|
+
${commit.trackedFiles.length} tracked file paths will be reported.`;
|
|
31
28
|
exports.renderCommandInfo = renderCommandInfo;
|
|
32
29
|
//# sourceMappingURL=renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/git-metadata/renderer.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,yDAA8C;AAIvC,MAAM,
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/commands/git-metadata/renderer.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,yDAA8C;AAIvC,MAAM,wBAAwB,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,GAAG,kBAAK,CAAC,MAAM,yBAAyB,KAAK,GAAG,CAAA;AAA7F,QAAA,wBAAwB,4BAAqE;AAEnG,MAAM,kBAAkB,GAAG,CAAC,YAAoB,EAAE,EAAE,CAAC,GAAG,kBAAK,CAAC,MAAM,mBAAmB,YAAY,EAAE,CAAA;AAA/F,QAAA,kBAAkB,sBAA6E;AAErG,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,OAAe,EAAE,EAAE,CAC3E,YAAY,OAAO,sBAAsB,YAAY,EAAE,CAAA;AAD5C,QAAA,mBAAmB,uBACyB;AAElD,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAE,MAAe,EAAE,EAAE;IAC3E,IAAI,MAAM,EAAE;QACV,OAAO,eAAK,CAAC,KAAK,CAAC,GAAG,kBAAK,CAAC,OAAO,wBAAwB,QAAQ,WAAW,CAAC,CAAA;KAChF;SAAM;QACL,OAAO,eAAK,CAAC,KAAK,CAAC,GAAG,kBAAK,CAAC,OAAO,gBAAgB,QAAQ,WAAW,CAAC,CAAA;KACxE;AACH,CAAC,CAAA;AANY,QAAA,uBAAuB,2BAMnC;AAEM,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,GAAG,kBAAK,CAAC,OAAO,wCAAwC,CAAA;AAApF,QAAA,mBAAmB,uBAAiE;AAE1F,MAAM,iBAAiB,GAAG,CAAC,MAAkB,EAAE,EAAE,CACtD,oBAAoB,MAAM,CAAC,IAAI,oBAAoB,MAAM,CAAC,MAAM;EAChE,MAAM,CAAC,YAAY,CAAC,MAAM,uCAAuC,CAAA;AAFtD,QAAA,iBAAiB,qBAEqC"}
|
|
@@ -5,7 +5,14 @@ export declare class UploadCommand extends Command {
|
|
|
5
5
|
private cliVersion;
|
|
6
6
|
private config;
|
|
7
7
|
private dryRun;
|
|
8
|
+
private verbose;
|
|
9
|
+
private gitSync;
|
|
10
|
+
private directory;
|
|
11
|
+
private logger;
|
|
8
12
|
constructor();
|
|
9
|
-
execute(): Promise<1 | 0
|
|
10
|
-
private
|
|
13
|
+
execute(): Promise<1 | 0>;
|
|
14
|
+
private uploadToGitDB;
|
|
15
|
+
private uploadToSrcmapTrack;
|
|
16
|
+
private getSrcmapRequestBuilder;
|
|
17
|
+
private getApiRequestBuilder;
|
|
11
18
|
}
|
|
@@ -23,8 +23,10 @@ const upload_1 = require("../../helpers/upload");
|
|
|
23
23
|
const utils_1 = require("../../helpers/utils");
|
|
24
24
|
const api_1 = require("./api");
|
|
25
25
|
const git_1 = require("./git");
|
|
26
|
+
const gitdb_1 = require("./gitdb");
|
|
26
27
|
const library_1 = require("./library");
|
|
27
28
|
const renderer_1 = require("./renderer");
|
|
29
|
+
const utils_2 = require("./utils");
|
|
28
30
|
class UploadCommand extends clipanion_1.Command {
|
|
29
31
|
constructor() {
|
|
30
32
|
super();
|
|
@@ -32,13 +34,32 @@ class UploadCommand extends clipanion_1.Command {
|
|
|
32
34
|
apiKey: process.env.DATADOG_API_KEY,
|
|
33
35
|
};
|
|
34
36
|
this.dryRun = false;
|
|
37
|
+
this.verbose = false;
|
|
38
|
+
this.gitSync = false;
|
|
39
|
+
this.directory = '';
|
|
40
|
+
this.logger = new utils_2.Logger((s) => {
|
|
41
|
+
this.context.stdout.write(s);
|
|
42
|
+
}, utils_2.LogLevel.INFO);
|
|
35
43
|
this.cliVersion = require('../../../package.json').version;
|
|
36
44
|
}
|
|
37
45
|
execute() {
|
|
38
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const initialTime =
|
|
47
|
+
const initialTime = Date.now();
|
|
48
|
+
if (this.verbose) {
|
|
49
|
+
this.logger = new utils_2.Logger((s) => {
|
|
50
|
+
this.context.stdout.write(s);
|
|
51
|
+
}, utils_2.LogLevel.DEBUG);
|
|
52
|
+
}
|
|
40
53
|
if (this.dryRun) {
|
|
41
|
-
this.
|
|
54
|
+
this.logger.warn(renderer_1.renderDryRunWarning());
|
|
55
|
+
}
|
|
56
|
+
if (this.directory) {
|
|
57
|
+
// change working dir
|
|
58
|
+
process.chdir(this.directory);
|
|
59
|
+
}
|
|
60
|
+
if (!this.config.apiKey) {
|
|
61
|
+
this.logger.error(renderer_1.renderConfigurationError(new errors_1.InvalidConfigurationError(`Missing ${chalk_1.default.bold('DATADOG_API_KEY')} in your environment`)));
|
|
62
|
+
return 1;
|
|
42
63
|
}
|
|
43
64
|
const metricsLogger = metrics_1.getMetricsLogger({
|
|
44
65
|
datadogSite: process.env.DATADOG_SITE,
|
|
@@ -50,33 +71,84 @@ class UploadCommand extends clipanion_1.Command {
|
|
|
50
71
|
datadogSite: api_1.datadogSite,
|
|
51
72
|
metricsLogger: metricsLogger.logger,
|
|
52
73
|
});
|
|
53
|
-
|
|
74
|
+
const apiRequestBuilder = this.getApiRequestBuilder(this.config.apiKey);
|
|
75
|
+
const srcmapRequestBuilder = this.getSrcmapRequestBuilder(this.config.apiKey);
|
|
76
|
+
let inError = false;
|
|
54
77
|
try {
|
|
55
|
-
|
|
78
|
+
this.logger.info('Uploading list of tracked files...');
|
|
79
|
+
const elapsed = yield utils_2.timedExecAsync(this.uploadToSrcmapTrack.bind(this), {
|
|
80
|
+
requestBuilder: srcmapRequestBuilder,
|
|
81
|
+
apiKeyValidator,
|
|
82
|
+
metricsLogger,
|
|
83
|
+
});
|
|
84
|
+
metricsLogger.logger.increment('sci.success', 1);
|
|
85
|
+
this.logger.info(`${this.dryRun ? '[DRYRUN] ' : ''}Successfully uploaded tracked files in ${elapsed} seconds.`);
|
|
56
86
|
}
|
|
57
|
-
catch (
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
catch (err) {
|
|
88
|
+
this.logger.error(`Failed upload of tracked files: ${err}`);
|
|
89
|
+
inError = true;
|
|
90
|
+
}
|
|
91
|
+
if (this.gitSync) {
|
|
92
|
+
try {
|
|
93
|
+
this.logger.info('Syncing GitDB...');
|
|
94
|
+
const elapsed = yield utils_2.timedExecAsync(this.uploadToGitDB.bind(this), {
|
|
95
|
+
requestBuilder: apiRequestBuilder,
|
|
96
|
+
});
|
|
97
|
+
metricsLogger.logger.increment('gitdb.success', 1);
|
|
98
|
+
this.logger.info(`${this.dryRun ? '[DRYRUN] ' : ''}Successfully synced git DB in ${elapsed} seconds.`);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.log('error writing to git db');
|
|
102
|
+
this.logger.warn(`Could not write to GitDB: ${err}`);
|
|
60
103
|
}
|
|
61
|
-
return;
|
|
62
104
|
}
|
|
63
|
-
this.context.stdout.write(renderer_1.renderCommandInfo(payload));
|
|
64
|
-
let status;
|
|
65
105
|
try {
|
|
66
|
-
|
|
106
|
+
yield metricsLogger.flush();
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
this.logger.warn(`WARN: ${err}`);
|
|
110
|
+
}
|
|
111
|
+
if (inError) {
|
|
112
|
+
this.logger.error('Command failed. See messages above for more details.');
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
this.logger.info(renderer_1.renderSuccessfulCommand((Date.now() - initialTime) / 1000, this.dryRun));
|
|
116
|
+
return 0;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
uploadToGitDB(opts) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
yield gitdb_1.uploadToGitDB(this.logger, opts.requestBuilder, yield git_1.newSimpleGit(), this.dryRun, this.repositoryURL);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
uploadToSrcmapTrack(opts) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const generatePayload = () => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
try {
|
|
128
|
+
return yield git_1.getCommitInfo(yield git_1.newSimpleGit(), this.repositoryURL);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
if (e instanceof Error) {
|
|
132
|
+
this.logger.error(renderer_1.renderFailedUpload(e.message));
|
|
133
|
+
}
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const sendPayload = (commit) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
let status;
|
|
67
139
|
if (this.dryRun) {
|
|
68
140
|
status = upload_1.UploadStatus.Success;
|
|
69
141
|
}
|
|
70
142
|
else {
|
|
71
|
-
status = yield library_1.uploadRepository(requestBuilder, this.cliVersion)(
|
|
72
|
-
apiKeyValidator,
|
|
143
|
+
status = yield library_1.uploadRepository(opts.requestBuilder, this.cliVersion)(commit, {
|
|
144
|
+
apiKeyValidator: opts.apiKeyValidator,
|
|
73
145
|
onError: (e) => {
|
|
74
|
-
this.
|
|
75
|
-
metricsLogger.logger.increment('failed', 1);
|
|
146
|
+
this.logger.error(renderer_1.renderFailedUpload(e.message));
|
|
147
|
+
opts.metricsLogger.logger.increment('sci.failed', 1);
|
|
76
148
|
},
|
|
77
149
|
onRetry: (e, attempt) => {
|
|
78
|
-
this.
|
|
79
|
-
metricsLogger.logger.increment('retries', 1);
|
|
150
|
+
this.logger.warn(renderer_1.renderRetriedUpload(e.message, attempt));
|
|
151
|
+
opts.metricsLogger.logger.increment('sci.retries', 1);
|
|
80
152
|
},
|
|
81
153
|
onUpload: () => {
|
|
82
154
|
return;
|
|
@@ -84,40 +156,19 @@ class UploadCommand extends clipanion_1.Command {
|
|
|
84
156
|
retries: 5,
|
|
85
157
|
});
|
|
86
158
|
}
|
|
87
|
-
metricsLogger.logger.increment('success', 1);
|
|
88
|
-
const totalTime = (Date.now() - initialTime) / 1000;
|
|
89
159
|
if (status !== upload_1.UploadStatus.Success) {
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
this.context.stdout.write(renderer_1.renderSuccessfulCommand(totalTime, this.dryRun));
|
|
94
|
-
metricsLogger.logger.gauge('duration', totalTime);
|
|
95
|
-
return 0;
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
if (error instanceof errors_1.InvalidConfigurationError) {
|
|
99
|
-
this.context.stdout.write(renderer_1.renderConfigurationError(error));
|
|
100
|
-
return 1;
|
|
101
|
-
}
|
|
102
|
-
// Otherwise unknown error, let's propagate the exception
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
finally {
|
|
106
|
-
try {
|
|
107
|
-
yield metricsLogger.flush();
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
this.context.stdout.write(`WARN: ${err}\n`);
|
|
160
|
+
this.logger.error(`${formatting_1.ICONS.FAILED} Error uploading commit information.`);
|
|
161
|
+
throw new Error('Could not upload commit information');
|
|
111
162
|
}
|
|
112
|
-
}
|
|
163
|
+
});
|
|
164
|
+
const payload = yield generatePayload();
|
|
165
|
+
this.logger.info(renderer_1.renderCommandInfo(payload));
|
|
166
|
+
yield sendPayload(payload);
|
|
113
167
|
});
|
|
114
168
|
}
|
|
115
|
-
|
|
116
|
-
if (!this.config.apiKey) {
|
|
117
|
-
throw new errors_1.InvalidConfigurationError(`Missing ${chalk_1.default.bold('DATADOG_API_KEY')} in your environment.`);
|
|
118
|
-
}
|
|
169
|
+
getSrcmapRequestBuilder(apiKey) {
|
|
119
170
|
return utils_1.getRequestBuilder({
|
|
120
|
-
apiKey
|
|
171
|
+
apiKey,
|
|
121
172
|
baseUrl: api_1.getBaseIntakeUrl(),
|
|
122
173
|
headers: new Map([
|
|
123
174
|
['DD-EVP-ORIGIN', 'datadog-ci git-metadata'],
|
|
@@ -126,6 +177,12 @@ class UploadCommand extends clipanion_1.Command {
|
|
|
126
177
|
overrideUrl: 'api/v2/srcmap',
|
|
127
178
|
});
|
|
128
179
|
}
|
|
180
|
+
getApiRequestBuilder(apiKey) {
|
|
181
|
+
return utils_1.getRequestBuilder({
|
|
182
|
+
apiKey,
|
|
183
|
+
baseUrl: 'https://' + api_1.apiHost,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
129
186
|
}
|
|
130
187
|
exports.UploadCommand = UploadCommand;
|
|
131
188
|
UploadCommand.usage = clipanion_1.Command.Usage({
|
|
@@ -138,5 +195,8 @@ UploadCommand.usage = clipanion_1.Command.Usage({
|
|
|
138
195
|
});
|
|
139
196
|
UploadCommand.addPath('git-metadata', 'upload');
|
|
140
197
|
UploadCommand.addOption('dryRun', clipanion_1.Command.Boolean('--dry-run'));
|
|
198
|
+
UploadCommand.addOption('verbose', clipanion_1.Command.Boolean('--verbose'));
|
|
199
|
+
UploadCommand.addOption('directory', clipanion_1.Command.String('--directory'));
|
|
200
|
+
UploadCommand.addOption('gitSync', clipanion_1.Command.Boolean('--git-sync'));
|
|
141
201
|
UploadCommand.addOption('repositoryURL', clipanion_1.Command.String('--repository-url'));
|
|
142
202
|
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/git-metadata/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,yCAAiC;AAEjC,
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/git-metadata/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,yCAAiC;AAEjC,iDAAwE;AACxE,iDAA8D;AAC9D,yDAA8C;AAE9C,mDAAqE;AACrE,iDAAiD;AACjD,+CAAqD;AAErD,+BAA4D;AAC5D,+BAAiD;AACjD,mCAAqC;AAErC,uCAA0C;AAC1C,yCAOmB;AACnB,mCAAwD;AAExD,MAAa,aAAc,SAAQ,mBAAO;IAwBxC;QACE,KAAK,EAAE,CAAA;QAZD,WAAM,GAAG;YACf,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;SACpC,CAAA;QACO,WAAM,GAAG,KAAK,CAAA;QACd,YAAO,GAAG,KAAK,CAAA;QAC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mBAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;AAChE,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,mBAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;AACnE,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,mBAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;AACjE,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,mBAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const timedExecAsync: <I, O>(f: (input: I) => Promise<O>, input: I) => Promise<number>;
|
|
2
|
+
export declare enum LogLevel {
|
|
3
|
+
DEBUG = 1,
|
|
4
|
+
INFO = 2,
|
|
5
|
+
WARN = 3,
|
|
6
|
+
ERROR = 4
|
|
7
|
+
}
|
|
8
|
+
export declare class Logger {
|
|
9
|
+
private loglevel;
|
|
10
|
+
private writeMessage;
|
|
11
|
+
constructor(writeMessage: (s: string) => void, loglevel: LogLevel);
|
|
12
|
+
error(s: string): void;
|
|
13
|
+
warn(s: string): void;
|
|
14
|
+
info(s: string): void;
|
|
15
|
+
debug(s: string): void;
|
|
16
|
+
}
|