@datadog/datadog-ci 0.17.6 → 0.17.7

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.
@@ -31,7 +31,7 @@ describe('execute', () => {
31
31
  const cli = makeCli();
32
32
  const context = createMockContext();
33
33
  process.env = { DATADOG_API_KEY: 'PLACEHOLDER' };
34
- const code = yield cli.run(['commit', 'upload', '--dry-run'], context);
34
+ const code = yield cli.run(['git-metadata', 'upload', '--dry-run'], context);
35
35
  return { context, code };
36
36
  });
37
37
  test('runCLI', () => __awaiter(void 0, void 0, void 0, function* () {
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +1,8 @@
1
+ import { CommitInfo } from './interfaces';
1
2
  export declare const renderGitError: (errorMessage: string) => string;
2
3
  export declare const renderConfigurationError: (error: Error) => string;
3
4
  export declare const renderFailedUpload: (errorMessage: string) => string;
4
5
  export declare const renderRetriedUpload: (errorMessage: string, attempt: number) => string;
5
- export declare const renderUpload = "Uploading\n";
6
6
  export declare const renderSuccessfulCommand: (duration: number, dryRun: boolean) => string;
7
- export declare const renderCommandInfo: (dryRun: boolean) => string;
7
+ export declare const renderDryRunWarning: () => string;
8
+ export declare const renderCommandInfo: (commit: CommitInfo) => string;
@@ -3,7 +3,7 @@ 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.renderSuccessfulCommand = exports.renderUpload = exports.renderRetriedUpload = exports.renderFailedUpload = exports.renderConfigurationError = exports.renderGitError = void 0;
6
+ exports.renderCommandInfo = exports.renderDryRunWarning = exports.renderSuccessfulCommand = exports.renderRetriedUpload = exports.renderFailedUpload = exports.renderConfigurationError = exports.renderGitError = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const formatting_1 = require("../../helpers/formatting");
9
9
  const renderGitError = (errorMessage) => chalk_1.default.red(`${formatting_1.ICONS.FAILED} An error occured while invoking git: ${errorMessage}
@@ -15,7 +15,6 @@ const renderFailedUpload = (errorMessage) => chalk_1.default.red(`${formatting_1
15
15
  exports.renderFailedUpload = renderFailedUpload;
16
16
  const renderRetriedUpload = (errorMessage, attempt) => chalk_1.default.yellow(`[attempt ${attempt}] Retrying upload: ${errorMessage}\n`);
17
17
  exports.renderRetriedUpload = renderRetriedUpload;
18
- exports.renderUpload = 'Uploading\n';
19
18
  const renderSuccessfulCommand = (duration, dryRun) => {
20
19
  if (dryRun) {
21
20
  return chalk_1.default.green(`${formatting_1.ICONS.SUCCESS} [DRYRUN] Handled in ${duration} seconds.\n`);
@@ -25,10 +24,8 @@ const renderSuccessfulCommand = (duration, dryRun) => {
25
24
  }
26
25
  };
27
26
  exports.renderSuccessfulCommand = renderSuccessfulCommand;
28
- const renderCommandInfo = (dryRun) => {
29
- if (dryRun) {
30
- return chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} DRY-RUN MODE ENABLED. WILL NOT UPLOAD\n`);
31
- }
32
- return chalk_1.default.green('Starting upload. \n');
33
- };
27
+ const renderDryRunWarning = () => chalk_1.default.yellow(`${formatting_1.ICONS.WARNING} DRY-RUN MODE ENABLED. WILL NOT UPLOAD\n`);
28
+ exports.renderDryRunWarning = renderDryRunWarning;
29
+ const renderCommandInfo = (commit) => `Reporting commit ${commit.hash} from repository ${commit.remote}.
30
+ ${commit.trackedFiles.length} tracked file paths will be reported.\n`;
34
31
  exports.renderCommandInfo = renderCommandInfo;
@@ -36,7 +36,9 @@ class UploadCommand extends clipanion_1.Command {
36
36
  execute() {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  const initialTime = new Date().getTime();
39
- this.context.stdout.write(renderer_1.renderCommandInfo(this.dryRun));
39
+ if (this.dryRun) {
40
+ this.context.stdout.write(renderer_1.renderDryRunWarning());
41
+ }
40
42
  const metricsLogger = metrics_1.getMetricsLogger({
41
43
  datadogSite: process.env.DATADOG_SITE,
42
44
  defaultTags: [`cli_version:${this.cliVersion}`],
@@ -51,6 +53,7 @@ class UploadCommand extends clipanion_1.Command {
51
53
  if (payload === undefined) {
52
54
  return 0;
53
55
  }
56
+ this.context.stdout.write(renderer_1.renderCommandInfo(payload));
54
57
  try {
55
58
  const requestBuilder = this.getRequestBuilder();
56
59
  const status = yield this.uploadRepository(requestBuilder)(payload, {
@@ -63,7 +66,9 @@ class UploadCommand extends clipanion_1.Command {
63
66
  this.context.stdout.write(renderer_1.renderRetriedUpload(e.message, attempt));
64
67
  metricsLogger.logger.increment('retries', 1);
65
68
  },
66
- onUpload: () => this.context.stdout.write(renderer_1.renderUpload),
69
+ onUpload: () => {
70
+ return;
71
+ },
67
72
  retries: 5,
68
73
  });
69
74
  metricsLogger.logger.increment('success', 1);
@@ -122,6 +127,6 @@ UploadCommand.usage = clipanion_1.Command.Usage({
122
127
  `,
123
128
  examples: [['Upload the current commit details', 'datadog-ci report-commits upload']],
124
129
  });
125
- UploadCommand.addPath('commit', 'upload');
130
+ UploadCommand.addPath('git-metadata', 'upload');
126
131
  UploadCommand.addOption('dryRun', clipanion_1.Command.Boolean('--dry-run'));
127
132
  UploadCommand.addOption('repositoryURL', clipanion_1.Command.String('--repository-url'));
@@ -226,7 +226,10 @@ export interface ConfigOverride {
226
226
  basicAuth?: BasicAuthCredentials;
227
227
  body?: string;
228
228
  bodyType?: string;
229
- cookies?: string;
229
+ cookies?: string | {
230
+ append?: boolean;
231
+ value: string;
232
+ };
230
233
  defaultStepTimeout?: number;
231
234
  deviceIds?: string[];
232
235
  executionRule?: ExecutionRule;
@@ -13,7 +13,10 @@ export declare const getTestsList: (api: APIHelper, config: SyntheticsCIConfig,
13
13
  basicAuth?: import("./interfaces").BasicAuthCredentials | undefined;
14
14
  body?: string | undefined;
15
15
  bodyType?: string | undefined;
16
- cookies?: string | undefined;
16
+ cookies?: string | {
17
+ append?: boolean | undefined;
18
+ value: string;
19
+ } | undefined;
17
20
  defaultStepTimeout?: number | undefined;
18
21
  deviceIds?: string[] | undefined;
19
22
  executionRule?: import("./interfaces").ExecutionRule | undefined;
@@ -34,7 +37,10 @@ export declare const getTestsList: (api: APIHelper, config: SyntheticsCIConfig,
34
37
  basicAuth?: import("./interfaces").BasicAuthCredentials | undefined;
35
38
  body?: string | undefined;
36
39
  bodyType?: string | undefined;
37
- cookies?: string | undefined;
40
+ cookies?: string | {
41
+ append?: boolean | undefined;
42
+ value: string;
43
+ } | undefined;
38
44
  defaultStepTimeout?: number | undefined;
39
45
  deviceIds?: string[] | undefined;
40
46
  executionRule?: import("./interfaces").ExecutionRule | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/datadog-ci",
3
- "version": "0.17.6",
3
+ "version": "0.17.7",
4
4
  "description": "Run datadog actions from the CI.",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://github.com/DataDog/datadog-ci",