From 2320159fca7ab3936c6e894a7afdc341e54da76d Mon Sep 17 00:00:00 2001 From: Maxime Brunet Date: Tue, 19 Nov 2024 16:24:24 -0800 Subject: [PATCH] Log packageFileName --- lib/modules/manager/poetry/artifacts.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/modules/manager/poetry/artifacts.ts b/lib/modules/manager/poetry/artifacts.ts index 98da1df7d3fdc2..a64cfd1d4e6ad8 100644 --- a/lib/modules/manager/poetry/artifacts.ts +++ b/lib/modules/manager/poetry/artifacts.ts @@ -117,7 +117,10 @@ function getPoetrySources(content: string): PoetrySource[] { return sourceArray; } -async function getMatchingHostRule(url: string | undefined): Promise { +async function getMatchingHostRule( + url: string | undefined, + packageFileName: string, +): Promise { const scopedMatch = find({ hostType: PypiDatasource.id, url }); const hostRule = is.nonEmptyObject(scopedMatch) ? scopedMatch : find({ url }); if (hostRule) { @@ -126,7 +129,7 @@ async function getMatchingHostRule(url: string | undefined): Promise { const parsedUrl = parseUrl(url); if (!parsedUrl) { - logger.once.debug({ url }, 'Failed to parse URL'); + logger.once.debug({ url, packageFileName }, 'Failed to parse URL'); return {}; } @@ -138,7 +141,10 @@ async function getMatchingHostRule(url: string | undefined): Promise { password: accessToken, }; } - logger.once.debug({ url }, 'Could not get Google access token'); + logger.once.debug( + { url, packageFileName }, + 'Could not get Google access token', + ); } return {}; @@ -146,12 +152,16 @@ async function getMatchingHostRule(url: string | undefined): Promise { async function getSourceCredentialVars( pyprojectContent: string, + packageFileName: string, ): Promise { const poetrySources = getPoetrySources(pyprojectContent); const envVars: NodeJS.ProcessEnv = {}; for (const source of poetrySources) { - const matchingHostRule = await getMatchingHostRule(source.url); + const matchingHostRule = await getMatchingHostRule( + source.url, + packageFileName, + ); const formattedSourceName = source.name .replace(regEx(/(\.|-)+/g), '_') .toUpperCase(); @@ -215,7 +225,10 @@ export async function updateArtifacts({ config.constraints?.poetry ?? getPoetryRequirement(newPackageFileContent, existingLockFileContent); const extraEnv = { - ...(await getSourceCredentialVars(newPackageFileContent)), + ...(await getSourceCredentialVars( + newPackageFileContent, + packageFileName, + )), ...getGitEnvironmentVariables(['poetry']), PIP_CACHE_DIR: await ensureCacheDir('pip'), };