renovate 42.27.3 → 42.27.5

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.
@@ -0,0 +1,7 @@
1
+ import type { Decorator } from '../util/decorator';
2
+ import type { SpanParameters } from './types';
3
+ /**
4
+ * instruments a decorated method.
5
+ */
6
+ export declare function instrument<T>({ name, attributes, ignoreParentSpan, kind, }: SpanParameters): Decorator<T>;
7
+ export declare function instrumentStandalone<T extends (...args: any[]) => any>({ name, attributes, ignoreParentSpan, kind, }: SpanParameters, fn: T): T;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.instrument = instrument;
4
+ exports.instrumentStandalone = instrumentStandalone;
5
+ const api_1 = require("@opentelemetry/api");
6
+ const decorator_1 = require("../util/decorator");
7
+ const _1 = require(".");
8
+ /**
9
+ * instruments a decorated method.
10
+ */
11
+ function instrument({ name, attributes, ignoreParentSpan, kind = api_1.SpanKind.INTERNAL, }) {
12
+ return (0, decorator_1.decorate)(async ({ callback }) => {
13
+ return await (0, _1.instrument)(name, callback, {
14
+ attributes,
15
+ root: ignoreParentSpan,
16
+ kind,
17
+ });
18
+ });
19
+ }
20
+ function instrumentStandalone({ name, attributes, ignoreParentSpan, kind = api_1.SpanKind.INTERNAL, }, fn) {
21
+ return async function (...args) {
22
+ return await (0, _1.instrument)(name, () => fn(...args), {
23
+ attributes,
24
+ root: ignoreParentSpan,
25
+ kind,
26
+ });
27
+ };
28
+ }
29
+ //# sourceMappingURL=decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../lib/instrumentation/decorator.ts"],"names":[],"mappings":";;AASA,gCAaC;AAED,oDAgBC;AAxCD,4CAA8C;AAE9C,iDAA6C;AAE7C,wBAAiD;AAEjD;;GAEG;AACH,SAAgB,UAAU,CAAI,EAC5B,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,IAAI,GAAG,cAAQ,CAAC,QAAQ,GACT;IACf,OAAO,IAAA,oBAAQ,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrC,OAAO,MAAM,IAAA,aAAc,EAAC,IAAI,EAAE,QAAQ,EAAE;YAC1C,UAAU;YACV,IAAI,EAAE,gBAAgB;YACtB,IAAI;SACL,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,oBAAoB,CAClC,EACE,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,IAAI,GAAG,cAAQ,CAAC,QAAQ,GACT,EACjB,EAAK;IAEL,OAAO,KAAK,WAAW,GAAG,IAAW;QACnC,OAAO,MAAM,IAAA,aAAc,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;YACnD,UAAU;YACV,IAAI,EAAE,gBAAgB;YACtB,IAAI;SACL,CAAC,CAAC;IACL,CAAM,CAAC;AACT,CAAC","sourcesContent":["import { SpanKind } from '@opentelemetry/api';\nimport type { Decorator } from '../util/decorator';\nimport { decorate } from '../util/decorator';\nimport type { SpanParameters } from './types';\nimport { instrument as instrumentFunc } from '.';\n\n/**\n * instruments a decorated method.\n */\nexport function instrument<T>({\n name,\n attributes,\n ignoreParentSpan,\n kind = SpanKind.INTERNAL,\n}: SpanParameters): Decorator<T> {\n return decorate(async ({ callback }) => {\n return await instrumentFunc(name, callback, {\n attributes,\n root: ignoreParentSpan,\n kind,\n });\n });\n}\n\nexport function instrumentStandalone<T extends (...args: any[]) => any>(\n {\n name,\n attributes,\n ignoreParentSpan,\n kind = SpanKind.INTERNAL,\n }: SpanParameters,\n fn: T,\n): T {\n return async function (...args: any[]) {\n return await instrumentFunc(name, () => fn(...args), {\n attributes,\n root: ignoreParentSpan,\n kind,\n });\n } as T;\n}\n"]}
@@ -3,11 +3,13 @@ import type { RenovateSplit } from '../config/types';
3
3
  import type { BunyanRecord } from '../logger/types';
4
4
  import type { PackageFile } from '../modules/manager/types';
5
5
  import type { BranchCache } from '../util/cache/repository/types';
6
+ import type { GitOperationType } from '../util/git/types';
6
7
  export type RenovateSpanOptions = {
7
8
  attributes?: RenovateSpanAttributes;
8
9
  } & SpanOptions;
9
10
  export type RenovateSpanAttributes = {
10
11
  [ATTR_RENOVATE_SPLIT]?: RenovateSplit;
12
+ [ATTR_VCS_GIT_OPERATION_TYPE]?: GitOperationType;
11
13
  } & Attributes;
12
14
  /**
13
15
  * The instrumentation decorator parameters.
@@ -53,4 +55,13 @@ export interface DependencyStatus {
53
55
  total: number;
54
56
  }
55
57
  export declare const ATTR_RENOVATE_SPLIT = "renovate.split";
58
+ /**
59
+ * the Git Version Control System (VCS)'s Operation Type
60
+ *
61
+ * @see GitOperationType
62
+ *
63
+ */
64
+ export declare const ATTR_VCS_GIT_OPERATION_TYPE = "vcs.git.operation.type";
65
+ /** the Git Version Control System (VCS)'s subcommand */
66
+ export declare const ATTR_VCS_GIT_SUBCOMMAND = "vcs.git.subcommand";
56
67
  export {};
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ATTR_RENOVATE_SPLIT = void 0;
3
+ exports.ATTR_VCS_GIT_SUBCOMMAND = exports.ATTR_VCS_GIT_OPERATION_TYPE = exports.ATTR_RENOVATE_SPLIT = void 0;
4
4
  exports.ATTR_RENOVATE_SPLIT = 'renovate.split';
5
+ /**
6
+ * the Git Version Control System (VCS)'s Operation Type
7
+ *
8
+ * @see GitOperationType
9
+ *
10
+ */
11
+ exports.ATTR_VCS_GIT_OPERATION_TYPE = 'vcs.git.operation.type';
12
+ /** the Git Version Control System (VCS)'s subcommand */
13
+ exports.ATTR_VCS_GIT_SUBCOMMAND = 'vcs.git.subcommand';
5
14
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/instrumentation/types.ts"],"names":[],"mappings":";;;AAkEa,QAAA,mBAAmB,GAAG,gBAAgB,CAAC","sourcesContent":["import type { Attributes, SpanKind, SpanOptions } from '@opentelemetry/api';\nimport type { RenovateSplit } from '../config/types';\nimport type { BunyanRecord } from '../logger/types';\nimport type { PackageFile } from '../modules/manager/types';\nimport type { BranchCache } from '../util/cache/repository/types';\n\nexport type RenovateSpanOptions = {\n attributes?: RenovateSpanAttributes;\n} & SpanOptions;\n\nexport type RenovateSpanAttributes = {\n [ATTR_RENOVATE_SPLIT]?: RenovateSplit;\n} & Attributes;\n\n/**\n * The instrumentation decorator parameters.\n */\nexport interface SpanParameters {\n /**\n * The name of the span\n */\n name: string;\n\n /**\n * Attributes which should be added to the span\n */\n attributes?: Attributes | undefined;\n\n /**\n * Should this span be added to the root span or to the current active span\n */\n ignoreParentSpan?: boolean;\n\n /**\n * Type of span this represents. Default: SpanKind.Internal\n */\n kind?: SpanKind;\n}\n\nexport interface Report {\n problems: BunyanRecord[];\n repositories: Record<string, RepoReport>;\n}\n\ninterface RepoReport {\n problems: BunyanRecord[];\n branches: Partial<BranchCache>[];\n packageFiles: Record<string, PackageFile[]>;\n libYearsWithStatus?: LibYearsWithStatus;\n}\n\nexport interface LibYearsWithStatus {\n libYears: LibYears;\n dependencyStatus: DependencyStatus;\n}\n\nexport interface LibYears {\n total: number;\n managers: Record<string, number>;\n}\n\nexport interface DependencyStatus {\n outdated: number;\n total: number;\n}\n\nexport const ATTR_RENOVATE_SPLIT = 'renovate.split';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/instrumentation/types.ts"],"names":[],"mappings":";;;AAoEa,QAAA,mBAAmB,GAAG,gBAAgB,CAAC;AAEpD;;;;;GAKG;AACU,QAAA,2BAA2B,GAAG,wBAAwB,CAAC;AAEpE,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,oBAAoB,CAAC","sourcesContent":["import type { Attributes, SpanKind, SpanOptions } from '@opentelemetry/api';\nimport type { RenovateSplit } from '../config/types';\nimport type { BunyanRecord } from '../logger/types';\nimport type { PackageFile } from '../modules/manager/types';\nimport type { BranchCache } from '../util/cache/repository/types';\nimport type { GitOperationType } from '../util/git/types';\n\nexport type RenovateSpanOptions = {\n attributes?: RenovateSpanAttributes;\n} & SpanOptions;\n\nexport type RenovateSpanAttributes = {\n [ATTR_RENOVATE_SPLIT]?: RenovateSplit;\n [ATTR_VCS_GIT_OPERATION_TYPE]?: GitOperationType;\n} & Attributes;\n\n/**\n * The instrumentation decorator parameters.\n */\nexport interface SpanParameters {\n /**\n * The name of the span\n */\n name: string;\n\n /**\n * Attributes which should be added to the span\n */\n attributes?: Attributes | undefined;\n\n /**\n * Should this span be added to the root span or to the current active span\n */\n ignoreParentSpan?: boolean;\n\n /**\n * Type of span this represents. Default: SpanKind.Internal\n */\n kind?: SpanKind;\n}\n\nexport interface Report {\n problems: BunyanRecord[];\n repositories: Record<string, RepoReport>;\n}\n\ninterface RepoReport {\n problems: BunyanRecord[];\n branches: Partial<BranchCache>[];\n packageFiles: Record<string, PackageFile[]>;\n libYearsWithStatus?: LibYearsWithStatus;\n}\n\nexport interface LibYearsWithStatus {\n libYears: LibYears;\n dependencyStatus: DependencyStatus;\n}\n\nexport interface LibYears {\n total: number;\n managers: Record<string, number>;\n}\n\nexport interface DependencyStatus {\n outdated: number;\n total: number;\n}\n\nexport const ATTR_RENOVATE_SPLIT = 'renovate.split';\n\n/**\n * the Git Version Control System (VCS)'s Operation Type\n *\n * @see GitOperationType\n *\n */\nexport const ATTR_VCS_GIT_OPERATION_TYPE = 'vcs.git.operation.type';\n\n/** the Git Version Control System (VCS)'s subcommand */\nexport const ATTR_VCS_GIT_SUBCOMMAND = 'vcs.git.subcommand';\n"]}
@@ -67,6 +67,9 @@ export declare const CrowConfig: z.ZodPipeline<z.ZodEffects<z.ZodString, string
67
67
  image?: string | undefined;
68
68
  }>>>;
69
69
  }, "strip", z.ZodTypeAny, {
70
+ clone?: Record<string, {
71
+ image?: string | undefined;
72
+ }> | undefined;
70
73
  steps?: Record<string, {
71
74
  image?: string | undefined;
72
75
  }> | {
@@ -79,13 +82,13 @@ export declare const CrowConfig: z.ZodPipeline<z.ZodEffects<z.ZodString, string
79
82
  name: string;
80
83
  image?: string | undefined;
81
84
  }[] | undefined;
82
- clone?: Record<string, {
83
- image?: string | undefined;
84
- }> | undefined;
85
85
  services?: Record<string, {
86
86
  image?: string | undefined;
87
87
  }> | undefined;
88
88
  }, {
89
+ clone?: Record<string, {
90
+ image?: string | undefined;
91
+ }> | undefined;
89
92
  steps?: Record<string, {
90
93
  image?: string | undefined;
91
94
  }> | {
@@ -98,9 +101,6 @@ export declare const CrowConfig: z.ZodPipeline<z.ZodEffects<z.ZodString, string
98
101
  name: string;
99
102
  image?: string | undefined;
100
103
  }[] | undefined;
101
- clone?: Record<string, {
102
- image?: string | undefined;
103
- }> | undefined;
104
104
  services?: Record<string, {
105
105
  image?: string | undefined;
106
106
  }> | undefined;
@@ -16,7 +16,7 @@ export declare function setUserRepoConfig({ gitIgnoredAuthors, gitAuthor, }: Ren
16
16
  export declare function getSubmodules(): Promise<string[]>;
17
17
  export declare function cloneSubmodules(shouldClone: boolean, cloneSubmodulesFilter: string[] | undefined): Promise<void>;
18
18
  export declare function isCloned(): boolean;
19
- export declare function syncGit(): Promise<void>;
19
+ export declare const syncGit: () => Promise<void>;
20
20
  export declare function getRepoStatus(path?: string): Promise<StatusResult>;
21
21
  export declare function branchExists(branchName: string): boolean;
22
22
  export declare function getBranchCommit(branchName: string): LongCommitSha | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GIT_MINIMUM_VERSION = exports.RENOVATE_FORK_UPSTREAM = exports.setPrivateKey = exports.setNoVerify = void 0;
3
+ exports.syncGit = exports.GIT_MINIMUM_VERSION = exports.RENOVATE_FORK_UPSTREAM = exports.setPrivateKey = exports.setNoVerify = void 0;
4
4
  exports.gitRetry = gitRetry;
5
5
  exports.validateGitVersion = validateGitVersion;
6
6
  exports.fetchRevSpec = fetchRevSpec;
@@ -12,7 +12,6 @@ exports.setUserRepoConfig = setUserRepoConfig;
12
12
  exports.getSubmodules = getSubmodules;
13
13
  exports.cloneSubmodules = cloneSubmodules;
14
14
  exports.isCloned = isCloned;
15
- exports.syncGit = syncGit;
16
15
  exports.getRepoStatus = getRepoStatus;
17
16
  exports.branchExists = branchExists;
18
17
  exports.getBranchCommit = getBranchCommit;
@@ -56,6 +55,8 @@ const upath_1 = tslib_1.__importDefault(require("upath"));
56
55
  const app_strings_1 = require("../../config/app-strings");
57
56
  const global_1 = require("../../config/global");
58
57
  const error_messages_1 = require("../../constants/error-messages");
58
+ const instrumentation_1 = require("../../instrumentation");
59
+ const decorator_1 = require("../../instrumentation/decorator");
59
60
  const logger_1 = require("../../logger");
60
61
  const external_host_error_1 = require("../../types/errors/external-host-error");
61
62
  const limits_1 = require("../../workers/global/limits");
@@ -70,6 +71,7 @@ const behind_base_branch_cache_1 = require("./behind-base-branch-cache");
70
71
  const config_1 = require("./config");
71
72
  const conflicts_cache_1 = require("./conflicts-cache");
72
73
  const error_1 = require("./error");
74
+ const instrument_1 = require("./instrument");
73
75
  const modified_cache_1 = require("./modified-cache");
74
76
  const private_key_1 = require("./private-key");
75
77
  var config_2 = require("./config");
@@ -168,7 +170,7 @@ let privateKeySet = false;
168
170
  exports.GIT_MINIMUM_VERSION = '2.33.0'; // git show-current
169
171
  async function validateGitVersion() {
170
172
  let version;
171
- const globalGit = (0, simple_git_1.simpleGit)();
173
+ const globalGit = (0, instrument_1.instrumentGit)((0, simple_git_1.simpleGit)());
172
174
  try {
173
175
  const { major, minor, patch, installed } = await globalGit.version();
174
176
  /* v8 ignore next 4 -- TODO: add test */
@@ -236,11 +238,11 @@ async function initRepo(args) {
236
238
  config.additionalBranches = [];
237
239
  config.branchIsModified = {};
238
240
  // TODO: safe to pass all env variables? use `getChildEnv` instead?
239
- git = (0, simple_git_1.simpleGit)(global_1.GlobalConfig.get('localDir'), (0, config_1.simpleGitConfig)()).env({
241
+ git = (0, instrument_1.instrumentGit)((0, simple_git_1.simpleGit)(global_1.GlobalConfig.get('localDir'), (0, config_1.simpleGitConfig)()).env({
240
242
  ...(0, env_1.getEnv)(),
241
243
  LANG: 'C.UTF-8',
242
244
  LC_ALL: 'C.UTF-8',
243
- });
245
+ }));
244
246
  gitInitialized = false;
245
247
  submodulesInitizialized = false;
246
248
  await fetchBranchCommits();
@@ -338,7 +340,7 @@ async function cloneSubmodules(shouldClone, cloneSubmodulesFilter) {
338
340
  }
339
341
  submodulesInitizialized = true;
340
342
  const gitEnv = (0, utils_1.getChildEnv)({ env: (0, auth_1.getGitEnvironmentVariables)() });
341
- await syncGit();
343
+ await (0, exports.syncGit)();
342
344
  const submodules = await getSubmodules();
343
345
  for (const submodule of submodules) {
344
346
  if (!(0, string_match_1.matchRegexOrGlobList)(submodule, cloneSubmodulesFilter ?? ['*'])) {
@@ -357,7 +359,7 @@ async function cloneSubmodules(shouldClone, cloneSubmodulesFilter) {
357
359
  function isCloned() {
358
360
  return gitInitialized;
359
361
  }
360
- async function syncGit() {
362
+ exports.syncGit = (0, decorator_1.instrumentStandalone)({ name: 'syncGit' }, async function () {
361
363
  if (gitInitialized) {
362
364
  /* v8 ignore next 3 -- TODO: add test */
363
365
  if ((0, env_1.getEnv)().RENOVATE_X_CLEAR_HOOKS) {
@@ -375,65 +377,69 @@ async function syncGit() {
375
377
  const gitHead = upath_1.default.join(localDir, '.git/HEAD');
376
378
  let clone = true;
377
379
  if (await fs_extra_1.default.pathExists(gitHead)) {
378
- logger_1.logger.debug(`syncGit(): Found existing git repository, attempting git fetch`);
379
- try {
380
- await git.raw(['remote', 'set-url', 'origin', config.url]);
381
- const fetchStart = Date.now();
382
- await gitRetry(() => git.fetch(['--prune', 'origin']));
383
- config.currentBranch =
384
- config.currentBranch || (await getDefaultBranch(git));
385
- await resetToBranch(config.currentBranch);
386
- await cleanLocalBranches();
387
- const durationMs = Math.round(Date.now() - fetchStart);
388
- logger_1.logger.info({ durationMs }, 'git fetch completed');
389
- clone = false;
390
- /* v8 ignore next -- TODO: add test */
391
- }
392
- catch (err) {
393
- if (err.message === error_messages_1.REPOSITORY_EMPTY) {
394
- throw err;
380
+ await (0, instrumentation_1.instrument)('fetch', async () => {
381
+ logger_1.logger.debug(`syncGit(): Found existing git repository, attempting git fetch`);
382
+ try {
383
+ await git.raw(['remote', 'set-url', 'origin', config.url]);
384
+ const fetchStart = Date.now();
385
+ await gitRetry(() => git.fetch(['--prune', 'origin']));
386
+ config.currentBranch =
387
+ config.currentBranch || (await getDefaultBranch(git));
388
+ await resetToBranch(config.currentBranch);
389
+ await cleanLocalBranches();
390
+ const durationMs = Math.round(Date.now() - fetchStart);
391
+ logger_1.logger.info({ durationMs }, 'git fetch completed');
392
+ clone = false;
393
+ /* v8 ignore next -- TODO: add test */
395
394
  }
396
- logger_1.logger.info({ err }, 'git fetch error, falling back to git clone');
397
- }
395
+ catch (err) {
396
+ if (err.message === error_messages_1.REPOSITORY_EMPTY) {
397
+ throw err;
398
+ }
399
+ logger_1.logger.info({ err }, 'git fetch error, falling back to git clone');
400
+ }
401
+ });
398
402
  }
399
403
  if (clone) {
400
- const cloneStart = Date.now();
401
- try {
402
- const opts = [];
403
- if (config.defaultBranch) {
404
- opts.push('-b', config.defaultBranch);
405
- }
406
- if (config.fullClone) {
407
- logger_1.logger.debug('Performing full clone');
408
- }
409
- else {
410
- logger_1.logger.debug('Performing blobless clone');
411
- opts.push('--filter=blob:none');
412
- }
413
- if (config.extraCloneOpts) {
414
- Object.entries(config.extraCloneOpts).forEach((e) =>
415
- // TODO: types (#22198)
416
- opts.push(e[0], `${e[1]}`));
417
- }
418
- const emptyDirAndClone = async () => {
419
- await fs_extra_1.default.emptyDir(localDir);
420
- await git.clone(config.url, '.', opts);
421
- };
422
- await gitRetry(() => emptyDirAndClone());
423
- /* v8 ignore next 10 -- TODO: add test */
424
- }
425
- catch (err) {
426
- logger_1.logger.debug({ err }, 'git clone error');
427
- if (err.message?.includes('No space left on device')) {
428
- throw new Error(error_messages_1.SYSTEM_INSUFFICIENT_DISK_SPACE);
404
+ await (0, instrumentation_1.instrument)('clone', async () => {
405
+ const cloneStart = Date.now();
406
+ try {
407
+ const opts = [];
408
+ if (config.defaultBranch) {
409
+ opts.push('-b', config.defaultBranch);
410
+ }
411
+ if (config.fullClone) {
412
+ logger_1.logger.debug('Performing full clone');
413
+ }
414
+ else {
415
+ logger_1.logger.debug('Performing blobless clone');
416
+ opts.push('--filter=blob:none');
417
+ }
418
+ if (config.extraCloneOpts) {
419
+ Object.entries(config.extraCloneOpts).forEach((e) =>
420
+ // TODO: types (#22198)
421
+ opts.push(e[0], `${e[1]}`));
422
+ }
423
+ const emptyDirAndClone = async () => {
424
+ await (0, instrumentation_1.instrument)(`fs.emptyDir(${localDir})`, () => fs_extra_1.default.emptyDir(localDir));
425
+ await git.clone(config.url, '.', opts);
426
+ };
427
+ await gitRetry(() => (0, instrumentation_1.instrument)('emptyDirAndClone', emptyDirAndClone));
428
+ /* v8 ignore next 10 -- TODO: add test */
429
429
  }
430
- if (err.message === error_messages_1.REPOSITORY_EMPTY) {
431
- throw err;
430
+ catch (err) {
431
+ logger_1.logger.debug({ err }, 'git clone error');
432
+ if (err.message?.includes('No space left on device')) {
433
+ throw new Error(error_messages_1.SYSTEM_INSUFFICIENT_DISK_SPACE);
434
+ }
435
+ if (err.message === error_messages_1.REPOSITORY_EMPTY) {
436
+ throw err;
437
+ }
438
+ throw new external_host_error_1.ExternalHostError(err, 'git');
432
439
  }
433
- throw new external_host_error_1.ExternalHostError(err, 'git');
434
- }
435
- const durationMs = Math.round(Date.now() - cloneStart);
436
- logger_1.logger.debug({ durationMs }, 'git clone completed');
440
+ const durationMs = Math.round(Date.now() - cloneStart);
441
+ logger_1.logger.debug({ durationMs }, 'git clone completed');
442
+ });
437
443
  }
438
444
  try {
439
445
  config.currentBranchSha = (await git.raw(['rev-parse', 'HEAD'])).trim();
@@ -446,7 +452,7 @@ async function syncGit() {
446
452
  throw err;
447
453
  }
448
454
  // This will only happen now if set in global config
449
- await cloneSubmodules(!!config.cloneSubmodules, config.cloneSubmodulesFilter);
455
+ await (0, instrumentation_1.instrument)('cloneSubmodules', () => cloneSubmodules(!!config.cloneSubmodules, config.cloneSubmodulesFilter));
450
456
  try {
451
457
  const latestCommit = (await git.log({ n: 1 })).latest;
452
458
  logger_1.logger.debug({ latestCommit }, 'latest repository commit');
@@ -471,19 +477,22 @@ async function syncGit() {
471
477
  // If upstreamUrl is set then the bot is running in fork mode
472
478
  // The "upstream" remote is the original repository which was forked from
473
479
  if (config.upstreamUrl) {
474
- logger_1.logger.debug(`Bringing default branch up-to-date with ${exports.RENOVATE_FORK_UPSTREAM}, to get latest config`);
475
- // Add remote if it does not exist
476
- const remotes = await git.getRemotes(true);
477
- if (!remotes.some((remote) => remote.name === exports.RENOVATE_FORK_UPSTREAM)) {
478
- logger_1.logger.debug(`Adding remote ${exports.RENOVATE_FORK_UPSTREAM}`);
479
- await git.addRemote(exports.RENOVATE_FORK_UPSTREAM, config.upstreamUrl);
480
- }
481
- await syncForkWithUpstream(config.currentBranch);
482
- await fetchBranchCommits(false);
480
+ const { upstreamUrl } = config;
481
+ await (0, instrumentation_1.instrument)('sync with upstreamUrl', async () => {
482
+ logger_1.logger.debug(`Bringing default branch up-to-date with ${exports.RENOVATE_FORK_UPSTREAM}, to get latest config`);
483
+ // Add remote if it does not exist
484
+ const remotes = await git.getRemotes(true);
485
+ if (!remotes.some((remote) => remote.name === exports.RENOVATE_FORK_UPSTREAM)) {
486
+ logger_1.logger.debug(`Adding remote ${exports.RENOVATE_FORK_UPSTREAM}`);
487
+ await git.addRemote(exports.RENOVATE_FORK_UPSTREAM, upstreamUrl);
488
+ }
489
+ await syncForkWithUpstream(config.currentBranch);
490
+ await fetchBranchCommits(false);
491
+ });
483
492
  }
484
493
  config.currentBranchSha = (await git.revparse('HEAD')).trim();
485
494
  logger_1.logger.debug(`Current branch SHA: ${config.currentBranchSha}`);
486
- }
495
+ });
487
496
  async function getRepoStatus(path) {
488
497
  if ((0, is_1.isString)(path)) {
489
498
  const localDir = global_1.GlobalConfig.get('localDir');
@@ -493,7 +502,7 @@ async function getRepoStatus(path) {
493
502
  throw new Error(error_messages_1.INVALID_PATH);
494
503
  }
495
504
  }
496
- await syncGit();
505
+ await (0, exports.syncGit)();
497
506
  return git.status(path ? [path] : []);
498
507
  }
499
508
  function branchExists(branchName) {
@@ -506,7 +515,7 @@ function getBranchCommit(branchName) {
506
515
  async function getCommitMessages() {
507
516
  logger_1.logger.debug('getCommitMessages');
508
517
  if (global_1.GlobalConfig.get('platform') !== 'local') {
509
- await syncGit();
518
+ await (0, exports.syncGit)();
510
519
  }
511
520
  try {
512
521
  const res = await git.log({
@@ -522,7 +531,7 @@ async function getCommitMessages() {
522
531
  }
523
532
  async function checkoutBranch(branchName) {
524
533
  logger_1.logger.debug(`Setting current branch to ${branchName}`);
525
- await syncGit();
534
+ await (0, exports.syncGit)();
526
535
  try {
527
536
  await gitRetry(() => git.checkout(submodulesInitizialized
528
537
  ? ['-f', '--recurse-submodules', branchName, '--']
@@ -551,7 +560,7 @@ async function checkoutBranch(branchName) {
551
560
  }
552
561
  async function checkoutBranchFromRemote(branchName, remoteName) {
553
562
  logger_1.logger.debug(`Checking out branch ${branchName} from remote ${remoteName}`);
554
- await syncGit();
563
+ await (0, exports.syncGit)();
555
564
  try {
556
565
  await gitRetry(() => git.checkoutBranch(branchName, `${remoteName}/${branchName}`));
557
566
  config.currentBranch = branchName;
@@ -594,7 +603,7 @@ async function forcePushToRemote(branchName, remote) {
594
603
  }
595
604
  }
596
605
  async function getFileList() {
597
- await syncGit();
606
+ await (0, exports.syncGit)();
598
607
  const branch = config.currentBranch;
599
608
  let files;
600
609
  try {
@@ -631,7 +640,7 @@ async function isBranchBehindBase(branchName, baseBranch) {
631
640
  return isBehind;
632
641
  }
633
642
  logger_1.logger.debug('branch.isBehindBase(): using git to calculate');
634
- await syncGit();
643
+ await (0, exports.syncGit)();
635
644
  try {
636
645
  const behindCount = (await git.raw(['rev-list', '--count', `${branchSha}..${baseBranchSha}`])).trim();
637
646
  isBehind = behindCount !== '0';
@@ -665,7 +674,7 @@ async function isBranchModified(branchName, baseBranch) {
665
674
  return isModified;
666
675
  }
667
676
  logger_1.logger.debug('branch.isModified(): using git to calculate');
668
- await syncGit();
677
+ await (0, exports.syncGit)();
669
678
  const committedAuthors = new Set();
670
679
  try {
671
680
  const commits = await git.log([
@@ -734,7 +743,7 @@ async function isBranchConflicted(baseBranch, branch) {
734
743
  }
735
744
  logger_1.logger.debug('branch.isConflicted(): using git to calculate');
736
745
  let result = false;
737
- await syncGit();
746
+ await (0, exports.syncGit)();
738
747
  await writeGitAuthor();
739
748
  const origBranch = config.currentBranch;
740
749
  try {
@@ -769,7 +778,7 @@ async function isBranchConflicted(baseBranch, branch) {
769
778
  return result;
770
779
  }
771
780
  async function deleteBranch(branchName) {
772
- await syncGit();
781
+ await (0, exports.syncGit)();
773
782
  try {
774
783
  const deleteCommand = ['push', '--delete', 'origin', branchName];
775
784
  if ((0, config_1.getNoVerify)().includes('push')) {
@@ -804,7 +813,7 @@ async function deleteBranch(branchName) {
804
813
  async function mergeToLocal(refSpecToMerge) {
805
814
  let status;
806
815
  try {
807
- await syncGit();
816
+ await (0, exports.syncGit)();
808
817
  await writeGitAuthor();
809
818
  await git.reset(simple_git_1.ResetMode.HARD);
810
819
  await gitRetry(() => git.checkout([
@@ -830,7 +839,7 @@ async function mergeToLocal(refSpecToMerge) {
830
839
  async function mergeBranch(branchName) {
831
840
  let status;
832
841
  try {
833
- await syncGit();
842
+ await (0, exports.syncGit)();
834
843
  await writeGitAuthor();
835
844
  await git.reset(simple_git_1.ResetMode.HARD);
836
845
  await gitRetry(() => git.checkout(['-B', branchName, 'origin/' + branchName]));
@@ -857,7 +866,7 @@ async function mergeBranch(branchName) {
857
866
  }
858
867
  }
859
868
  async function getBranchLastCommitTime(branchName) {
860
- await syncGit();
869
+ await (0, exports.syncGit)();
861
870
  try {
862
871
  const time = await git.show(['-s', '--format=%ai', 'origin/' + branchName]);
863
872
  return new Date(Date.parse(time));
@@ -878,7 +887,7 @@ function getBranchFilesFromCommit(referenceCommit) {
878
887
  return getBranchFilesFromRef(referenceCommit);
879
888
  }
880
889
  async function getBranchFilesFromRef(refName) {
881
- await syncGit();
890
+ await (0, exports.syncGit)();
882
891
  try {
883
892
  const diff = await gitRetry(() => git.diffSummary([refName, `${refName}^`]));
884
893
  return diff.files.map((file) => file.file);
@@ -894,7 +903,7 @@ async function getBranchFilesFromRef(refName) {
894
903
  }
895
904
  }
896
905
  async function getFile(filePath, branchName) {
897
- await syncGit();
906
+ await (0, exports.syncGit)();
898
907
  try {
899
908
  const content = await git.show([
900
909
  'origin/' + (branchName ?? config.currentBranch) + ':' + filePath,
@@ -918,7 +927,7 @@ async function getFiles(fileNames) {
918
927
  return fileContentMap;
919
928
  }
920
929
  async function hasDiff(sourceRef, targetRef) {
921
- await syncGit();
930
+ await (0, exports.syncGit)();
922
931
  try {
923
932
  return ((await gitRetry(() => git.diff([sourceRef, targetRef, '--']))) !== '');
924
933
  }
@@ -948,7 +957,7 @@ async function handleCommitAuth(localDir) {
948
957
  */
949
958
  async function prepareCommit({ branchName, files, message, force = false, }) {
950
959
  const localDir = global_1.GlobalConfig.get('localDir');
951
- await syncGit();
960
+ await (0, exports.syncGit)();
952
961
  logger_1.logger.debug(`Preparing files for committing to branch ${branchName}`);
953
962
  await handleCommitAuth(localDir);
954
963
  try {
@@ -1059,7 +1068,7 @@ async function prepareCommit({ branchName, files, message, force = false, }) {
1059
1068
  }
1060
1069
  }
1061
1070
  async function pushCommit({ sourceRef, targetRef, files, pushOptions, }) {
1062
- await syncGit();
1071
+ await (0, exports.syncGit)();
1063
1072
  logger_1.logger.debug(`Pushing refSpec ${sourceRef}:${targetRef ?? sourceRef}`);
1064
1073
  let result = false;
1065
1074
  try {
@@ -1086,7 +1095,7 @@ async function pushCommit({ sourceRef, targetRef, files, pushOptions, }) {
1086
1095
  return result;
1087
1096
  }
1088
1097
  async function fetchBranch(branchName) {
1089
- await syncGit();
1098
+ await (0, exports.syncGit)();
1090
1099
  logger_1.logger.debug(`Fetching branch ${branchName}`);
1091
1100
  try {
1092
1101
  const ref = `refs/heads/${branchName}:refs/remotes/origin/${branchName}`;
@@ -1268,7 +1277,7 @@ async function listCommitTree(commitSha) {
1268
1277
  return result;
1269
1278
  }
1270
1279
  async function localBranchExists(branchName) {
1271
- await syncGit();
1280
+ await (0, exports.syncGit)();
1272
1281
  const localBranches = await git.branchLocal();
1273
1282
  return localBranches.all.includes(branchName);
1274
1283
  }
@@ -1315,7 +1324,7 @@ async function syncForkWithUpstream(branchName) {
1315
1324
  async function getRemotes() {
1316
1325
  logger_1.logger.debug('git.getRemotes()');
1317
1326
  try {
1318
- await syncGit();
1327
+ await (0, exports.syncGit)();
1319
1328
  const remotes = await git.getRemotes();
1320
1329
  logger_1.logger.debug(`Found remotes: ${remotes.map((r) => r.name).join(', ')}`);
1321
1330
  return remotes.map((remote) => remote.name);