Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(git-submodules): sequential submodules processing (#11659) #11661

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 27 additions & 34 deletions lib/manager/git-submodules/extract.ts
Expand Up @@ -98,40 +98,33 @@ export default async function extractPackageFile(
return null;
}

const deps = (
await Promise.all(
depNames.map(async ({ name, path }) => {
try {
const [currentDigest] = (await git.subModule(['status', path]))
.trim()
.replace(/^[-+]/, '')
.split(/\s/);
const subModuleUrl = await getUrl(git, gitModulesPath, name);
// hostRules only understands HTTP URLs
// Find HTTP URL, then apply token
let httpSubModuleUrl = getHttpUrl(subModuleUrl);
httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl);
const currentValue = await getBranch(
gitModulesPath,
name,
httpSubModuleUrl
);
return {
depName: path,
lookupName: getHttpUrl(subModuleUrl),
currentValue,
currentDigest,
};
} catch (err) /* istanbul ignore next */ {
logger.warn(
{ err },
'Error mapping git submodules during extraction'
);
return null;
}
})
)
).filter(Boolean);
const deps = [];
for (const { name, path } of depNames) {
try {
const [currentDigest] = (await git.subModule(['status', path]))
.trim()
.replace(/^[-+]/, '')
.split(/\s/);
const subModuleUrl = await getUrl(git, gitModulesPath, name);
// hostRules only understands HTTP URLs
// Find HTTP URL, then apply token
let httpSubModuleUrl = getHttpUrl(subModuleUrl);
httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl);
const currentValue = await getBranch(
gitModulesPath,
name,
httpSubModuleUrl
);
deps.push({
depName: path,
lookupName: getHttpUrl(subModuleUrl),
currentValue,
currentDigest,
});
} catch (err) /* istanbul ignore next */ {
logger.warn({ err }, 'Error mapping git submodules during extraction');
}
}

return { deps, datasource: datasourceGitRefs.id };
}