renovate 39.241.0 → 39.241.2
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/util/git/auth.js
CHANGED
@@ -97,7 +97,7 @@ function getAuthenticationRules(gitUrl, hostType, token) {
|
|
97
97
|
if (!sshPort || is_1.default.emptyString(sshPort)) {
|
98
98
|
// By default, bitbucket-server SSH port is 7999.
|
99
99
|
// For non-default port, the generated auth config will likely be incorrect.
|
100
|
-
sshPort = 7999;
|
100
|
+
sshPort = '7999';
|
101
101
|
}
|
102
102
|
}
|
103
103
|
const url = { ...insteadUrl };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../lib/util/git/auth.ts"],"names":[],"mappings":";;AAsBA,0FAgEC;AAuBD,wDAyDC;AAED,gEAyCC;;AAjND,kEAAkC;AAClC,yDAAgE;AAChE,yCAAsC;AAEtC,sCAA2C;AAC3C,8CAA6C;AAC7C,oCAAiC;AACjC,gCAA2D;AAE3D,+BAAoC;AAEpC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,YAAY;IACZ,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAgB,uCAAuC,CACrD,cAAsB,EACtB,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAY,EAC5D,oBAAwC;IAExC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC;QACtC,eAAM,CAAC,IAAI,CACT,EAAE,IAAI,EAAE,SAAS,EAAE,EACnB,kGAAkG,CACnG,CAAC;QACF,OAAO,EAAE,GAAG,oBAAoB,EAAE,CAAC;IACrC,CAAC;IAED,iGAAiG;IACjG,MAAM,yBAAyB,GAC7B,oBAAoB,EAAE,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAg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,CAAC,KAAK,CAAC,iCAAiC,OAAO,oBAAoB,CAAC,CAAC;QAC3E,oBAAoB,GAAG,uCAAuC,CAC5D,OAAQ,EACR,QAAQ,EACR,oBAAoB,CACrB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,eAAM,CAAC,KAAK,CACV,+BAA+B,QAAQ,CAAC,SAAU,iCAAiC,CACpF,CAAC;IACJ,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { PLATFORM_HOST_TYPES } from '../../constants/platforms';\nimport { logger } from '../../logger';\nimport type { HostRule } from '../../types';\nimport { detectPlatform } from '../common';\nimport { find, getAll } from '../host-rules';\nimport { regEx } from '../regex';\nimport { createURLFromHostOrURL, isHttpUrl } from '../url';\nimport type { AuthenticationRule } from './types';\nimport { parseGitUrl } from './url';\n\nconst githubApiUrls = new Set([\n 'github.com',\n 'api.github.com',\n 'https://api.github.com',\n 'https://api.github.com/',\n]);\n\n/**\n * Add authorization to a Git Url and returns a new environment variables object\n * @returns a new NodeJS.ProcessEnv object without modifying any input parameters\n */\nexport function getGitAuthenticatedEnvironmentVariables(\n originalGitUrl: string,\n { token, username, password, hostType, matchHost }: HostRule,\n environmentVariables?: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n if (!token && !(username && password)) {\n logger.warn(\n { host: matchHost },\n `Could not create environment variable for host as neither token or username and password was set`,\n );\n return { ...environmentVariables };\n }\n\n // check if the environmentVariables already contain a GIT_CONFIG_COUNT or if the process has one\n const gitConfigCountEnvVariable =\n environmentVariables?.GIT_CONFIG_COUNT ?? process.env.GIT_CONFIG_COUNT;\n let gitConfigCount = 0;\n if (gitConfigCountEnvVariable) {\n // passthrough the gitConfigCountEnvVariable environment variable as start value of the index count\n gitConfigCount = parseInt(gitConfigCountEnvVariable, 10);\n if (Number.isNaN(gitConfigCount)) {\n logger.warn(\n {\n GIT_CONFIG_COUNT: process.env.GIT_CONFIG_COUNT,\n },\n `Found GIT_CONFIG_COUNT env variable, but couldn't parse the value to an integer. Ignoring it.`,\n );\n gitConfigCount = 0;\n }\n }\n let authenticationRules: AuthenticationRule[];\n if (token) {\n authenticationRules = getAuthenticationRulesWithToken(\n originalGitUrl,\n hostType,\n token,\n );\n } else {\n const encodedUsername = encodeURIComponent(username!);\n const encodedPassword = encodeURIComponent(password!);\n\n authenticationRules = getAuthenticationRules(\n originalGitUrl,\n hostType,\n `${encodedUsername}:${encodedPassword}`,\n );\n }\n\n // create a shallow copy of the environmentVariables as base so we don't modify the input parameter object\n // add the two new config key and value to the returnEnvironmentVariables object\n // increase the CONFIG_COUNT by one for each rule and add it to the object\n const newEnvironmentVariables = {\n ...environmentVariables,\n };\n for (const rule of authenticationRules) {\n newEnvironmentVariables[`GIT_CONFIG_KEY_${gitConfigCount}`] =\n `url.${rule.url}.insteadOf`;\n newEnvironmentVariables[`GIT_CONFIG_VALUE_${gitConfigCount}`] =\n rule.insteadOf;\n gitConfigCount++;\n }\n newEnvironmentVariables.GIT_CONFIG_COUNT = gitConfigCount.toString();\n\n return newEnvironmentVariables;\n}\n\nfunction getAuthenticationRulesWithToken(\n url: string,\n hostType: string | undefined | null,\n authToken: string,\n): AuthenticationRule[] {\n let token = authToken;\n let type = hostType;\n type ??= detectPlatform(url);\n if (type === 'gitlab') {\n token = `gitlab-ci-token:${authToken}`;\n }\n return getAuthenticationRules(url, type, token);\n}\n\n/**\n * Generates the authentication rules for later git usage for the given host\n * @link https://coolaj86.com/articles/vanilla-devops-git-credentials-cheatsheet/\n * @param gitUrl Git repository URL\n * @param hostType Git host type\n * @param token Authentication token or `username:password` string\n */\nexport function getAuthenticationRules(\n gitUrl: string,\n hostType: string | undefined | null,\n token: string,\n): AuthenticationRule[] {\n const authenticationRules = [];\n const hasUser = token.split(':').length > 1;\n const insteadUrl = parseGitUrl(gitUrl);\n let sshPort = insteadUrl.port;\n\n if (hostType === 'bitbucket-server') {\n // For Bitbucket Server/Data Center, `source` must be `bitbucket-server`\n // to generate HTTP(s) URLs correctly.\n // https://github.com/IonicaBizau/git-url-parse/blob/28828546c148d58bbcff61409915a4e1e8f7eb11/lib/index.js#L304\n insteadUrl.source = 'bitbucket-server';\n\n // sshPort is string, wrong type!\n // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/72361\n // https://github.com/IonicaBizau/parse-path/blob/87f71f273da90f85f6845937a70b7c032eeae4e3/lib/index.js#L45\n if (!sshPort || is.emptyString(sshPort)) {\n // By default, bitbucket-server SSH port is 7999.\n // For non-default port, the generated auth config will likely be incorrect.\n sshPort = 7999;\n }\n }\n\n const url = { ...insteadUrl };\n const protocol = regEx(/^https?$/).test(url.protocol)\n ? url.protocol\n : 'https';\n\n // ssh protocol with user if empty\n url.token = hasUser ? token : `ssh:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n // only edge case, need to stringify ourself because the exact syntax is not supported by the library\n // https://github.com/IonicaBizau/git-url-parse/blob/246c9119fb42c2ea1c280028fe77c53eb34c190c/lib/index.js#L246\n insteadOf: `ssh://git@${insteadUrl.resource}${\n sshPort ? `:${sshPort}` : ''\n }/${insteadUrl.full_name}${insteadUrl.git_suffix ? '.git' : ''}`,\n });\n\n // alternative ssh protocol with user if empty\n url.token = hasUser ? token : `git:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: { ...insteadUrl, port: sshPort }.toString('ssh'),\n });\n\n // https protocol with no user as default fallback\n url.token = token;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: insteadUrl.toString(protocol),\n });\n\n return authenticationRules;\n}\n\nexport function getGitEnvironmentVariables(\n additionalHostTypes: string[] = [],\n): NodeJS.ProcessEnv {\n let environmentVariables: NodeJS.ProcessEnv = {};\n\n // hard-coded logic to use authentication for github.com based on the githubToken for api.github.com\n const gitHubHostRule = find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n if (gitHubHostRule?.token) {\n environmentVariables = getGitAuthenticatedEnvironmentVariables(\n 'https://github.com/',\n gitHubHostRule,\n );\n }\n\n // construct the Set of allowed hostTypes consisting of the standard Git provides\n // plus additionalHostTypes, which are provided as parameter\n const gitAllowedHostTypes = new Set<string>([\n ...PLATFORM_HOST_TYPES,\n ...additionalHostTypes,\n ]);\n\n // filter rules without `matchHost` and `token` or username and password and github api github rules\n const hostRules = getAll()\n .filter((r) => r.matchHost && (r.token ?? (r.username && r.password)))\n .filter((r) => !gitHubHostRule || !githubApiUrls.has(r.matchHost!));\n\n // for each hostRule without hostType we add additional authentication variables to the environmentVariables\n // for each hostRule with hostType we add additional authentication variables to the environmentVariables\n for (const hostRule of hostRules) {\n if (!hostRule.hostType || gitAllowedHostTypes.has(hostRule.hostType)) {\n environmentVariables = addAuthFromHostRule(\n hostRule,\n environmentVariables,\n );\n }\n }\n return environmentVariables;\n}\n\nfunction addAuthFromHostRule(\n hostRule: HostRule,\n env: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n let environmentVariables = env;\n const httpUrl = createURLFromHostOrURL(hostRule.matchHost!)?.toString();\n if (isHttpUrl(httpUrl)) {\n logger.trace(`Adding Git authentication for ${httpUrl} using token auth.`);\n environmentVariables = getGitAuthenticatedEnvironmentVariables(\n httpUrl!,\n hostRule,\n environmentVariables,\n );\n } else {\n logger.debug(\n `Could not parse registryUrl ${hostRule.matchHost!} or not using http(s). Ignoring`,\n );\n }\n return environmentVariables;\n}\n"]}
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../lib/util/git/auth.ts"],"names":[],"mappings":";;AAsBA,0FAgEC;AAuBD,wDAyDC;AAED,gEAyCC;;AAjND,kEAAkC;AAClC,yDAAgE;AAChE,yCAAsC;AAEtC,sCAA2C;AAC3C,8CAA6C;AAC7C,oCAAiC;AACjC,gCAA2D;AAE3D,+BAAoC;AAEpC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,YAAY;IACZ,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC,CAAC;AAEH;;;GAGG;AAC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I,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrE,oBAAoB,GAAG,mBAAmB,CACxC,QAAQ,EACR,oBAAoB,CACrB,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,SAAS,mBAAmB,CAC1B,QAAkB,EAClB,GAAsB;IAEtB,IAAI,oBAAoB,GAAG,GAAG,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAA,4BAAsB,EAAC,QAAQ,CAAC,SAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxE,IAAI,IAAA,eAAS,EAAC,OAAO,CAAC,EAAE,CAAC;QACvB,eAAM,CAAC,KAAK,CAAC,iCAAiC,OAAO,oBAAoB,CAAC,CAAC;QAC3E,oBAAoB,GAAG,uCAAuC,CAC5D,OAAQ,EACR,QAAQ,EACR,oBAAoB,CACrB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,eAAM,CAAC,KAAK,CACV,+BAA+B,QAAQ,CAAC,SAAU,iCAAiC,CACpF,CAAC;IACJ,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { PLATFORM_HOST_TYPES } from '../../constants/platforms';\nimport { logger } from '../../logger';\nimport type { HostRule } from '../../types';\nimport { detectPlatform } from '../common';\nimport { find, getAll } from '../host-rules';\nimport { regEx } from '../regex';\nimport { createURLFromHostOrURL, isHttpUrl } from '../url';\nimport type { AuthenticationRule } from './types';\nimport { parseGitUrl } from './url';\n\nconst githubApiUrls = new Set([\n 'github.com',\n 'api.github.com',\n 'https://api.github.com',\n 'https://api.github.com/',\n]);\n\n/**\n * Add authorization to a Git Url and returns a new environment variables object\n * @returns a new NodeJS.ProcessEnv object without modifying any input parameters\n */\nexport function getGitAuthenticatedEnvironmentVariables(\n originalGitUrl: string,\n { token, username, password, hostType, matchHost }: HostRule,\n environmentVariables?: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n if (!token && !(username && password)) {\n logger.warn(\n { host: matchHost },\n `Could not create environment variable for host as neither token or username and password was set`,\n );\n return { ...environmentVariables };\n }\n\n // check if the environmentVariables already contain a GIT_CONFIG_COUNT or if the process has one\n const gitConfigCountEnvVariable =\n environmentVariables?.GIT_CONFIG_COUNT ?? process.env.GIT_CONFIG_COUNT;\n let gitConfigCount = 0;\n if (gitConfigCountEnvVariable) {\n // passthrough the gitConfigCountEnvVariable environment variable as start value of the index count\n gitConfigCount = parseInt(gitConfigCountEnvVariable, 10);\n if (Number.isNaN(gitConfigCount)) {\n logger.warn(\n {\n GIT_CONFIG_COUNT: process.env.GIT_CONFIG_COUNT,\n },\n `Found GIT_CONFIG_COUNT env variable, but couldn't parse the value to an integer. Ignoring it.`,\n );\n gitConfigCount = 0;\n }\n }\n let authenticationRules: AuthenticationRule[];\n if (token) {\n authenticationRules = getAuthenticationRulesWithToken(\n originalGitUrl,\n hostType,\n token,\n );\n } else {\n const encodedUsername = encodeURIComponent(username!);\n const encodedPassword = encodeURIComponent(password!);\n\n authenticationRules = getAuthenticationRules(\n originalGitUrl,\n hostType,\n `${encodedUsername}:${encodedPassword}`,\n );\n }\n\n // create a shallow copy of the environmentVariables as base so we don't modify the input parameter object\n // add the two new config key and value to the returnEnvironmentVariables object\n // increase the CONFIG_COUNT by one for each rule and add it to the object\n const newEnvironmentVariables = {\n ...environmentVariables,\n };\n for (const rule of authenticationRules) {\n newEnvironmentVariables[`GIT_CONFIG_KEY_${gitConfigCount}`] =\n `url.${rule.url}.insteadOf`;\n newEnvironmentVariables[`GIT_CONFIG_VALUE_${gitConfigCount}`] =\n rule.insteadOf;\n gitConfigCount++;\n }\n newEnvironmentVariables.GIT_CONFIG_COUNT = gitConfigCount.toString();\n\n return newEnvironmentVariables;\n}\n\nfunction getAuthenticationRulesWithToken(\n url: string,\n hostType: string | undefined | null,\n authToken: string,\n): AuthenticationRule[] {\n let token = authToken;\n let type = hostType;\n type ??= detectPlatform(url);\n if (type === 'gitlab') {\n token = `gitlab-ci-token:${authToken}`;\n }\n return getAuthenticationRules(url, type, token);\n}\n\n/**\n * Generates the authentication rules for later git usage for the given host\n * @link https://coolaj86.com/articles/vanilla-devops-git-credentials-cheatsheet/\n * @param gitUrl Git repository URL\n * @param hostType Git host type\n * @param token Authentication token or `username:password` string\n */\nexport function getAuthenticationRules(\n gitUrl: string,\n hostType: string | undefined | null,\n token: string,\n): AuthenticationRule[] {\n const authenticationRules = [];\n const hasUser = token.split(':').length > 1;\n const insteadUrl = parseGitUrl(gitUrl);\n let sshPort = insteadUrl.port;\n\n if (hostType === 'bitbucket-server') {\n // For Bitbucket Server/Data Center, `source` must be `bitbucket-server`\n // to generate HTTP(s) URLs correctly.\n // https://github.com/IonicaBizau/git-url-parse/blob/28828546c148d58bbcff61409915a4e1e8f7eb11/lib/index.js#L304\n insteadUrl.source = 'bitbucket-server';\n\n // sshPort is string, wrong type!\n // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/72361\n // https://github.com/IonicaBizau/parse-path/blob/87f71f273da90f85f6845937a70b7c032eeae4e3/lib/index.js#L45\n if (!sshPort || is.emptyString(sshPort)) {\n // By default, bitbucket-server SSH port is 7999.\n // For non-default port, the generated auth config will likely be incorrect.\n sshPort = '7999';\n }\n }\n\n const url = { ...insteadUrl };\n const protocol = regEx(/^https?$/).test(url.protocol)\n ? url.protocol\n : 'https';\n\n // ssh protocol with user if empty\n url.token = hasUser ? token : `ssh:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n // only edge case, need to stringify ourself because the exact syntax is not supported by the library\n // https://github.com/IonicaBizau/git-url-parse/blob/246c9119fb42c2ea1c280028fe77c53eb34c190c/lib/index.js#L246\n insteadOf: `ssh://git@${insteadUrl.resource}${\n sshPort ? `:${sshPort}` : ''\n }/${insteadUrl.full_name}${insteadUrl.git_suffix ? '.git' : ''}`,\n });\n\n // alternative ssh protocol with user if empty\n url.token = hasUser ? token : `git:${token}`;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: { ...insteadUrl, port: sshPort }.toString('ssh'),\n });\n\n // https protocol with no user as default fallback\n url.token = token;\n authenticationRules.push({\n url: url.toString(protocol),\n insteadOf: insteadUrl.toString(protocol),\n });\n\n return authenticationRules;\n}\n\nexport function getGitEnvironmentVariables(\n additionalHostTypes: string[] = [],\n): NodeJS.ProcessEnv {\n let environmentVariables: NodeJS.ProcessEnv = {};\n\n // hard-coded logic to use authentication for github.com based on the githubToken for api.github.com\n const gitHubHostRule = find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n if (gitHubHostRule?.token) {\n environmentVariables = getGitAuthenticatedEnvironmentVariables(\n 'https://github.com/',\n gitHubHostRule,\n );\n }\n\n // construct the Set of allowed hostTypes consisting of the standard Git provides\n // plus additionalHostTypes, which are provided as parameter\n const gitAllowedHostTypes = new Set<string>([\n ...PLATFORM_HOST_TYPES,\n ...additionalHostTypes,\n ]);\n\n // filter rules without `matchHost` and `token` or username and password and github api github rules\n const hostRules = getAll()\n .filter((r) => r.matchHost && (r.token ?? (r.username && r.password)))\n .filter((r) => !gitHubHostRule || !githubApiUrls.has(r.matchHost!));\n\n // for each hostRule without hostType we add additional authentication variables to the environmentVariables\n // for each hostRule with hostType we add additional authentication variables to the environmentVariables\n for (const hostRule of hostRules) {\n if (!hostRule.hostType || gitAllowedHostTypes.has(hostRule.hostType)) {\n environmentVariables = addAuthFromHostRule(\n hostRule,\n environmentVariables,\n );\n }\n }\n return environmentVariables;\n}\n\nfunction addAuthFromHostRule(\n hostRule: HostRule,\n env: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n let environmentVariables = env;\n const httpUrl = createURLFromHostOrURL(hostRule.matchHost!)?.toString();\n if (isHttpUrl(httpUrl)) {\n logger.trace(`Adding Git authentication for ${httpUrl} using token auth.`);\n environmentVariables = getGitAuthenticatedEnvironmentVariables(\n httpUrl!,\n hostRule,\n environmentVariables,\n );\n } else {\n logger.debug(\n `Could not parse registryUrl ${hostRule.matchHost!} or not using http(s). Ignoring`,\n );\n }\n return environmentVariables;\n}\n"]}
|
package/dist/util/git/url.js
CHANGED
@@ -18,7 +18,7 @@ function getHttpUrl(url, token) {
|
|
18
18
|
const origProtocol = protocol;
|
19
19
|
// Convert non-https URLs to https and strip port
|
20
20
|
if (!(0, regex_1.regEx)(/^https?$/).test(protocol)) {
|
21
|
-
parsedUrl.port = 443;
|
21
|
+
parsedUrl.port = '443';
|
22
22
|
protocol = 'https';
|
23
23
|
}
|
24
24
|
parsedUrl.user = '';
|
package/dist/util/git/url.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../lib/util/git/url.ts"],"names":[],"mappings":";;AAMA,kCAEC;AAED,gCA0CC;AAED,sDA4BC;;AAlFD,0EAAwC;AACxC,yCAAsC;AACtC,sCAA2C;AAC3C,iEAA2C;AAC3C,oCAAiC;AAEjC,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,IAAA,uBAAW,EAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,SAAgB,UAAU,CAAC,GAAW,EAAE,KAAc;IACpD,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,YAAY,GAAG,QAAQ,CAAC;IAE9B,iDAAiD;IACjD,IAAI,CAAC,IAAA,aAAK,EAAC,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,SAAS,CAAC,IAAI,GAAG,
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../lib/util/git/url.ts"],"names":[],"mappings":";;AAMA,kCAEC;AAED,gCA0CC;AAED,sDA4BC;;AAlFD,0EAAwC;AACxC,yCAAsC;AACtC,sCAA2C;AAC3C,iEAA2C;AAC3C,oCAAiC;AAEjC,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,I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ED,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED,SAAgB,qBAAqB,CAAC,GAAW,EAAE,QAAiB;IAClE,IAAI,UAAkB,CAAC;IAEvB,IAAI,CAAC;QACH,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,eAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,kDAAkD,CAAC,CAAC;QAEzE,UAAU,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE/D,IAAI,QAAQ,EAAE,KAAK,EAAE,CAAC;QACpB,eAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QAErD,OAAO,UAAU,CAAC,GAAG,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC7C,eAAM,CAAC,KAAK,CAAC,iDAAiD,GAAG,EAAE,CAAC,CAAC;QACrE,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9D,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE9D,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import gitUrlParse from 'git-url-parse';\nimport { logger } from '../../logger';\nimport { detectPlatform } from '../common';\nimport * as hostRules from '../host-rules';\nimport { regEx } from '../regex';\n\nexport function parseGitUrl(url: string): gitUrlParse.GitUrl {\n return gitUrlParse(url);\n}\n\nexport function getHttpUrl(url: string, token?: string): string {\n const parsedUrl = parseGitUrl(url);\n\n let { protocol } = parsedUrl;\n const origProtocol = protocol;\n\n // Convert non-https URLs to https and strip port\n if (!regEx(/^https?$/).test(protocol)) {\n parsedUrl.port = '443';\n protocol = 'https';\n }\n\n parsedUrl.user = '';\n parsedUrl.token = token ?? '';\n\n switch (detectPlatform(parsedUrl.toString(protocol))) {\n case 'gitlab':\n if (token) {\n parsedUrl.token = token.includes(':')\n ? token\n : `gitlab-ci-token:${token}`;\n }\n break;\n case 'github':\n if (token) {\n parsedUrl.token = token.includes(':')\n ? token\n : `x-access-token:${token}`;\n }\n break;\n case 'bitbucket-server':\n // SSH URLs look like ssh://git@git.my.com:7999/project/repo.git\n // HTTPS URLs look like https://git.my.com/scm/project/repo.git\n // git-url-parse can't detect bitbucket-server from SSH URL\n // and thus doesn't know it should insert '/scm/'\n if (origProtocol === 'ssh') {\n parsedUrl.source = 'bitbucket-server';\n }\n break;\n }\n\n return new URL(parsedUrl.toString(protocol)).href;\n}\n\nexport function getRemoteUrlWithToken(url: string, hostType?: string): string {\n let coercedUrl: string;\n\n try {\n coercedUrl = getHttpUrl(url);\n } catch {\n logger.warn({ url }, `Attempting to use non-git url for git operations`);\n\n coercedUrl = url;\n }\n\n const hostRule = hostRules.find({ url: coercedUrl, hostType });\n\n if (hostRule?.token) {\n logger.debug(`Found hostRules token for url ${url}`);\n\n return getHttpUrl(url, encodeURIComponent(hostRule.token));\n }\n\n if (hostRule?.username && hostRule?.password) {\n logger.debug(`Found hostRules username and password for url ${url}`);\n const encodedUsername = encodeURIComponent(hostRule.username);\n const encodedPassword = encodeURIComponent(hostRule.password);\n\n return getHttpUrl(url, `${encodedUsername}:${encodedPassword}`);\n }\n\n return url;\n}\n"]}
|
@@ -115,17 +115,19 @@ async function start() {
|
|
115
115
|
// resolve global presets immediately
|
116
116
|
config = (0, config_1.mergeChildConfig)(await resolveGlobalExtends(config.globalExtends, config.ignorePresets), config);
|
117
117
|
}
|
118
|
-
// Set allowedHeaders in case hostRules headers are configured in file config
|
118
|
+
// Set allowedHeaders and userAgent in case hostRules headers are configured in file config
|
119
119
|
global_1.GlobalConfig.set({
|
120
120
|
allowedHeaders: config.allowedHeaders,
|
121
|
+
userAgent: config.userAgent,
|
121
122
|
});
|
122
123
|
// initialize all submodules
|
123
124
|
config = await (0, initialize_1.globalInitialize)(config);
|
124
|
-
// Set platform, endpoint and
|
125
|
+
// Set platform, endpoint, allowedHeaders and userAgent in case local presets are used
|
125
126
|
global_1.GlobalConfig.set({
|
126
127
|
allowedHeaders: config.allowedHeaders,
|
127
128
|
platform: config.platform,
|
128
129
|
endpoint: config.endpoint,
|
130
|
+
userAgent: config.userAgent,
|
129
131
|
});
|
130
132
|
await validatePresets(config);
|
131
133
|
(0, remap_1.setGlobalLogLevelRemaps)(config.logLevelRemap);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/workers/global/index.ts"],"names":[],"mappings":";;AAgCA,kDAwBC;AA8BD,0CAQC;AAED,oDAaC;AAED,sBA6IC;;AA5PD,kEAAkC;AAClC,mCAA+B;AAC/B,gEAA0B;AAC1B,4DAA4B;AAC5B,0DAA0B;AAC1B,mEAA6C;AAC7C,yCAAgD;AAChD,gDAAmD;AACnD,kDAA4D;AAC5D,kDAA6D;AAM7D,mEAAwE;AACxE,iDAAuC;AACvC,2DAAmD;AACnD,+DAA8E;AAC9E,yCAAsE;AACtE,8CAA6D;AAC7D,yEAAmD;AACnD,qEAA+C;AAC/C,2EAAqD;AACrD,4CAAqD;AACrD,kDAA6D;AAC7D,wEAAkD;AAClD,iDAA0D;AAC1D,0CAA8C;AAC9C,6CAAgE;AAChE,qCAA0C;AAEnC,KAAK,UAAU,mBAAmB,CACvC,YAA4B,EAC5B,UAA8B;IAE9B,MAAM,UAAU,GAAG,YAAY,CAAC,gBAAgB,CAC9C,YAAY,EACZ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AE,EAAE,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAO,EAAE,CAAC;YACb,gDAAgD;YAChD,eAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAC/B,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,IAAA,2BAAc,EAAC,MAAO,CAAC,CAAC;QAC9B,IAAI,IAAA,iBAAQ,GAAE,KAAK,MAAM,EAAE,CAAC;YAC1B,eAAM,CAAC,IAAI,CACT,kCAAkC,IAAA,iBAAQ,GAAE,6EAA6E,CAC1H,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,YAAY,GAAG,IAAA,oBAAW,GAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,cAAK,CAAC,CAAC;IACnE,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,eAAM,CAAC,IAAI,CACT,EAAE,YAAY,EAAE,EAChB,6EAA6E,CAC9E,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { ERROR } from 'bunyan';\nimport fs from 'fs-extra';\nimport semver from 'semver';\nimport upath from 'upath';\nimport * as configParser from '../../config';\nimport { mergeChildConfig } from '../../config';\nimport { GlobalConfig } from '../../config/global';\nimport { resolveConfigPresets } from '../../config/presets';\nimport { validateConfigSecrets } from '../../config/secrets';\nimport type {\n AllConfig,\n RenovateConfig,\n RenovateRepository,\n} from '../../config/types';\nimport { CONFIG_PRESETS_INVALID } from '../../constants/error-messages';\nimport { pkg } from '../../expose.cjs';\nimport { instrument } from '../../instrumentation';\nimport { exportStats, finalizeReport } from '../../instrumentation/reporting';\nimport { getProblems, logLevel, logger, setMeta } from '../../logger';\nimport { setGlobalLogLevelRemaps } from '../../logger/remap';\nimport * as hostRules from '../../util/host-rules';\nimport * as queue from '../../util/http/queue';\nimport * as throttle from '../../util/http/throttle';\nimport { regexEngineStatus } from '../../util/regex';\nimport { addSecretForSanitizing } from '../../util/sanitize';\nimport * as repositoryWorker from '../repository';\nimport { autodiscoverRepositories } from './autodiscover';\nimport { parseConfigs } from './config/parse';\nimport { globalFinalize, globalInitialize } from './initialize';\nimport { isLimitReached } from './limits';\n\nexport async function getRepositoryConfig(\n globalConfig: RenovateConfig,\n repository: RenovateRepository,\n): Promise<RenovateConfig> {\n const repoConfig = configParser.mergeChildConfig(\n globalConfig,\n is.string(repository) ? { repository } : repository,\n );\n const repoParts = repoConfig.repository.split('/');\n repoParts.pop();\n repoConfig.parentOrg = repoParts.join('/');\n repoConfig.topLevelOrg = repoParts.shift();\n // TODO: types (#22198)\n const platform = GlobalConfig.get('platform')!;\n repoConfig.localDir =\n platform === 'local'\n ? process.cwd()\n : upath.join(\n repoConfig.baseDir,\n `./repos/${platform}/${repoConfig.repository}`,\n );\n await fs.ensureDir(repoConfig.localDir);\n delete repoConfig.baseDir;\n return configParser.filterConfig(repoConfig, 'repository');\n}\n\nfunction getGlobalConfig(): Promise<RenovateConfig> {\n return parseConfigs(process.env, process.argv);\n}\n\nfunction haveReachedLimits(): boolean {\n if (isLimitReached('Commits')) {\n logger.info('Max commits created for this run.');\n return true;\n }\n return false;\n}\n\n/* istanbul ignore next */\nfunction checkEnv(): void {\n const range = pkg.engines!.node!;\n if (process.release?.name !== 'node' || !process.versions?.node) {\n logger.warn(\n { release: process.release, versions: process.versions },\n 'Unknown node environment detected.',\n );\n } else if (!semver.satisfies(process.versions?.node, range)) {\n logger.error(\n { versions: process.versions, range },\n 'Unsupported node environment detected. Please update your node version.',\n );\n }\n}\n\nexport async function validatePresets(config: AllConfig): Promise<void> {\n logger.debug('validatePresets()');\n try {\n await resolveConfigPresets(config);\n } catch (err) /* istanbul ignore next */ {\n logger.error({ err }, CONFIG_PRESETS_INVALID);\n throw new Error(CONFIG_PRESETS_INVALID);\n }\n}\n\nexport async function resolveGlobalExtends(\n globalExtends: string[],\n ignorePresets?: string[],\n): Promise<AllConfig> {\n try {\n // Make a \"fake\" config to pass to resolveConfigPresets and resolve globalPresets\n const config = { extends: globalExtends, ignorePresets };\n const resolvedConfig = await resolveConfigPresets(config);\n return resolvedConfig;\n } catch (err) {\n logger.error({ err }, 'Error resolving config preset');\n throw new Error(CONFIG_PRESETS_INVALID);\n }\n}\n\nexport async function start(): Promise<number> {\n // istanbul ignore next\n if (regexEngineStatus.type === 'available') {\n logger.debug('Using RE2 regex engine');\n } else if (regexEngineStatus.type === 'unavailable') {\n logger.warn(\n { err: regexEngineStatus.err },\n 'RE2 not usable, falling back to RegExp',\n );\n } else if (regexEngineStatus.type === 'ignored') {\n logger.debug('RE2 regex engine is ignored via RENOVATE_X_IGNORE_RE2');\n }\n\n let config: AllConfig;\n try {\n if (is.nonEmptyStringAndNotWhitespace(process.env.AWS_SECRET_ACCESS_KEY)) {\n addSecretForSanitizing(process.env.AWS_SECRET_ACCESS_KEY, 'global');\n }\n if (is.nonEmptyStringAndNotWhitespace(process.env.AWS_SESSION_TOKEN)) {\n addSecretForSanitizing(process.env.AWS_SESSION_TOKEN, 'global');\n }\n\n await instrument('config', async () => {\n // read global config from file, env and cli args\n config = await getGlobalConfig();\n if (is.nonEmptyArray(config?.globalExtends)) {\n // resolve global presets immediately\n config = mergeChildConfig(\n await resolveGlobalExtends(\n config.globalExtends,\n config.ignorePresets,\n ),\n config,\n );\n }\n\n // Set allowedHeaders in case hostRules headers are configured in file config\n GlobalConfig.set({\n allowedHeaders: config.allowedHeaders,\n });\n // initialize all submodules\n config = await globalInitialize(config);\n\n // Set platform, endpoint and allowedHeaders in case local presets are used\n GlobalConfig.set({\n allowedHeaders: config.allowedHeaders,\n platform: config.platform,\n endpoint: config.endpoint,\n });\n\n await validatePresets(config);\n\n setGlobalLogLevelRemaps(config.logLevelRemap);\n\n checkEnv();\n\n // validate secrets. Will throw and abort if invalid\n validateConfigSecrets(config);\n });\n\n // autodiscover repositories (needs to come after platform initialization)\n config = await instrument('discover', () =>\n autodiscoverRepositories(config),\n );\n\n if (is.nonEmptyString(config.writeDiscoveredRepos)) {\n const content = JSON.stringify(config.repositories);\n await fs.writeFile(config.writeDiscoveredRepos, content);\n logger.info(\n `Written discovered repositories to ${config.writeDiscoveredRepos}`,\n );\n return 0;\n }\n\n // Iterate through repositories sequentially\n for (const repository of config.repositories!) {\n if (haveReachedLimits()) {\n break;\n }\n await instrument(\n 'repository',\n async () => {\n const repoConfig = await getRepositoryConfig(config, repository);\n if (repoConfig.hostRules) {\n logger.debug('Reinitializing hostRules for repo');\n hostRules.clear();\n repoConfig.hostRules.forEach((rule) => hostRules.add(rule));\n repoConfig.hostRules = [];\n }\n\n // host rules can change concurrency\n queue.clear();\n throttle.clear();\n\n await repositoryWorker.renovateRepository(repoConfig);\n setMeta({});\n },\n {\n attributes: {\n repository:\n typeof repository === 'string'\n ? repository\n : repository.repository,\n },\n },\n );\n }\n\n finalizeReport();\n await exportStats(config);\n } catch (err) /* istanbul ignore next */ {\n if (err.message.startsWith('Init: ')) {\n logger.fatal(\n { errorMessage: err.message.substring(6) },\n 'Initialization error',\n );\n } else {\n logger.fatal({ err }, 'Unknown error');\n }\n if (!config!) {\n // return early if we can't parse config options\n logger.debug(`Missing config`);\n return 2;\n }\n } finally {\n await globalFinalize(config!);\n if (logLevel() === 'info') {\n logger.info(\n `Renovate was run at log level \"${logLevel()}\". Set LOG_LEVEL=debug in environment variables to see extended debug logs.`,\n );\n }\n }\n const loggerErrors = getProblems().filter((p) => p.level >= ERROR);\n if (loggerErrors.length) {\n logger.info(\n { loggerErrors },\n 'Renovate is exiting with a non-zero code due to the following logged errors',\n );\n return 1;\n }\n return 0;\n}\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/workers/global/index.ts"],"names":[],"mappings":";;AAgCA,kDAwBC;AA8BD,0CAQC;AAED,oDAaC;AAED,sBA+IC;;AA9PD,kEAAkC;AAClC,m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C,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { ERROR } from 'bunyan';\nimport fs from 'fs-extra';\nimport semver from 'semver';\nimport upath from 'upath';\nimport * as configParser from '../../config';\nimport { mergeChildConfig } from '../../config';\nimport { GlobalConfig } from '../../config/global';\nimport { resolveConfigPresets } from '../../config/presets';\nimport { validateConfigSecrets } from '../../config/secrets';\nimport type {\n AllConfig,\n RenovateConfig,\n RenovateRepository,\n} from '../../config/types';\nimport { CONFIG_PRESETS_INVALID } from '../../constants/error-messages';\nimport { pkg } from '../../expose.cjs';\nimport { instrument } from '../../instrumentation';\nimport { exportStats, finalizeReport } from '../../instrumentation/reporting';\nimport { getProblems, logLevel, logger, setMeta } from '../../logger';\nimport { setGlobalLogLevelRemaps } from '../../logger/remap';\nimport * as hostRules from '../../util/host-rules';\nimport * as queue from '../../util/http/queue';\nimport * as throttle from '../../util/http/throttle';\nimport { regexEngineStatus } from '../../util/regex';\nimport { addSecretForSanitizing } from '../../util/sanitize';\nimport * as repositoryWorker from '../repository';\nimport { autodiscoverRepositories } from './autodiscover';\nimport { parseConfigs } from './config/parse';\nimport { globalFinalize, globalInitialize } from './initialize';\nimport { isLimitReached } from './limits';\n\nexport async function getRepositoryConfig(\n globalConfig: RenovateConfig,\n repository: RenovateRepository,\n): Promise<RenovateConfig> {\n const repoConfig = configParser.mergeChildConfig(\n globalConfig,\n is.string(repository) ? { repository } : repository,\n );\n const repoParts = repoConfig.repository.split('/');\n repoParts.pop();\n repoConfig.parentOrg = repoParts.join('/');\n repoConfig.topLevelOrg = repoParts.shift();\n // TODO: types (#22198)\n const platform = GlobalConfig.get('platform')!;\n repoConfig.localDir =\n platform === 'local'\n ? process.cwd()\n : upath.join(\n repoConfig.baseDir,\n `./repos/${platform}/${repoConfig.repository}`,\n );\n await fs.ensureDir(repoConfig.localDir);\n delete repoConfig.baseDir;\n return configParser.filterConfig(repoConfig, 'repository');\n}\n\nfunction getGlobalConfig(): Promise<RenovateConfig> {\n return parseConfigs(process.env, process.argv);\n}\n\nfunction haveReachedLimits(): boolean {\n if (isLimitReached('Commits')) {\n logger.info('Max commits created for this run.');\n return true;\n }\n return false;\n}\n\n/* istanbul ignore next */\nfunction checkEnv(): void {\n const range = pkg.engines!.node!;\n if (process.release?.name !== 'node' || !process.versions?.node) {\n logger.warn(\n { release: process.release, versions: process.versions },\n 'Unknown node environment detected.',\n );\n } else if (!semver.satisfies(process.versions?.node, range)) {\n logger.error(\n { versions: process.versions, range },\n 'Unsupported node environment detected. Please update your node version.',\n );\n }\n}\n\nexport async function validatePresets(config: AllConfig): Promise<void> {\n logger.debug('validatePresets()');\n try {\n await resolveConfigPresets(config);\n } catch (err) /* istanbul ignore next */ {\n logger.error({ err }, CONFIG_PRESETS_INVALID);\n throw new Error(CONFIG_PRESETS_INVALID);\n }\n}\n\nexport async function resolveGlobalExtends(\n globalExtends: string[],\n ignorePresets?: string[],\n): Promise<AllConfig> {\n try {\n // Make a \"fake\" config to pass to resolveConfigPresets and resolve globalPresets\n const config = { extends: globalExtends, ignorePresets };\n const resolvedConfig = await resolveConfigPresets(config);\n return resolvedConfig;\n } catch (err) {\n logger.error({ err }, 'Error resolving config preset');\n throw new Error(CONFIG_PRESETS_INVALID);\n }\n}\n\nexport async function start(): Promise<number> {\n // istanbul ignore next\n if (regexEngineStatus.type === 'available') {\n logger.debug('Using RE2 regex engine');\n } else if (regexEngineStatus.type === 'unavailable') {\n logger.warn(\n { err: regexEngineStatus.err },\n 'RE2 not usable, falling back to RegExp',\n );\n } else if (regexEngineStatus.type === 'ignored') {\n logger.debug('RE2 regex engine is ignored via RENOVATE_X_IGNORE_RE2');\n }\n\n let config: AllConfig;\n try {\n if (is.nonEmptyStringAndNotWhitespace(process.env.AWS_SECRET_ACCESS_KEY)) {\n addSecretForSanitizing(process.env.AWS_SECRET_ACCESS_KEY, 'global');\n }\n if (is.nonEmptyStringAndNotWhitespace(process.env.AWS_SESSION_TOKEN)) {\n addSecretForSanitizing(process.env.AWS_SESSION_TOKEN, 'global');\n }\n\n await instrument('config', async () => {\n // read global config from file, env and cli args\n config = await getGlobalConfig();\n if (is.nonEmptyArray(config?.globalExtends)) {\n // resolve global presets immediately\n config = mergeChildConfig(\n await resolveGlobalExtends(\n config.globalExtends,\n config.ignorePresets,\n ),\n config,\n );\n }\n\n // Set allowedHeaders and userAgent in case hostRules headers are configured in file config\n GlobalConfig.set({\n allowedHeaders: config.allowedHeaders,\n userAgent: config.userAgent,\n });\n // initialize all submodules\n config = await globalInitialize(config);\n\n // Set platform, endpoint, allowedHeaders and userAgent in case local presets are used\n GlobalConfig.set({\n allowedHeaders: config.allowedHeaders,\n platform: config.platform,\n endpoint: config.endpoint,\n userAgent: config.userAgent,\n });\n\n await validatePresets(config);\n\n setGlobalLogLevelRemaps(config.logLevelRemap);\n\n checkEnv();\n\n // validate secrets. Will throw and abort if invalid\n validateConfigSecrets(config);\n });\n\n // autodiscover repositories (needs to come after platform initialization)\n config = await instrument('discover', () =>\n autodiscoverRepositories(config),\n );\n\n if (is.nonEmptyString(config.writeDiscoveredRepos)) {\n const content = JSON.stringify(config.repositories);\n await fs.writeFile(config.writeDiscoveredRepos, content);\n logger.info(\n `Written discovered repositories to ${config.writeDiscoveredRepos}`,\n );\n return 0;\n }\n\n // Iterate through repositories sequentially\n for (const repository of config.repositories!) {\n if (haveReachedLimits()) {\n break;\n }\n await instrument(\n 'repository',\n async () => {\n const repoConfig = await getRepositoryConfig(config, repository);\n if (repoConfig.hostRules) {\n logger.debug('Reinitializing hostRules for repo');\n hostRules.clear();\n repoConfig.hostRules.forEach((rule) => hostRules.add(rule));\n repoConfig.hostRules = [];\n }\n\n // host rules can change concurrency\n queue.clear();\n throttle.clear();\n\n await repositoryWorker.renovateRepository(repoConfig);\n setMeta({});\n },\n {\n attributes: {\n repository:\n typeof repository === 'string'\n ? repository\n : repository.repository,\n },\n },\n );\n }\n\n finalizeReport();\n await exportStats(config);\n } catch (err) /* istanbul ignore next */ {\n if (err.message.startsWith('Init: ')) {\n logger.fatal(\n { errorMessage: err.message.substring(6) },\n 'Initialization error',\n );\n } else {\n logger.fatal({ err }, 'Unknown error');\n }\n if (!config!) {\n // return early if we can't parse config options\n logger.debug(`Missing config`);\n return 2;\n }\n } finally {\n await globalFinalize(config!);\n if (logLevel() === 'info') {\n logger.info(\n `Renovate was run at log level \"${logLevel()}\". Set LOG_LEVEL=debug in environment variables to see extended debug logs.`,\n );\n }\n }\n const loggerErrors = getProblems().filter((p) => p.level >= ERROR);\n if (loggerErrors.length) {\n logger.info(\n { loggerErrors },\n 'Renovate is exiting with a non-zero code due to the following logged errors',\n );\n return 1;\n }\n return 0;\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "renovate",
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
4
|
-
"version": "39.241.
|
4
|
+
"version": "39.241.2",
|
5
5
|
"type": "commonjs",
|
6
6
|
"bin": {
|
7
7
|
"renovate": "dist/renovate.js",
|
@@ -285,7 +285,7 @@
|
|
285
285
|
"@types/diff": "7.0.2",
|
286
286
|
"@types/eslint-config-prettier": "6.11.3",
|
287
287
|
"@types/fs-extra": "11.0.4",
|
288
|
-
"@types/git-url-parse": "
|
288
|
+
"@types/git-url-parse": "16.0.0",
|
289
289
|
"@types/github-url-from-git": "1.5.3",
|
290
290
|
"@types/global-agent": "3.0.0",
|
291
291
|
"@types/ini": "4.1.1",
|