From c56ebbbffac3ed191aee1ebf45dbbb15c2030f10 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 5 Jan 2019 10:58:01 +0100 Subject: [PATCH] refactor(docker): massageRegistry --- lib/datasource/docker/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/datasource/docker/index.js b/lib/datasource/docker/index.js index 25e265b530..6a8345323b 100644 --- a/lib/datasource/docker/index.js +++ b/lib/datasource/docker/index.js @@ -11,16 +11,16 @@ module.exports = { getPkgReleases, }; -function massageRegistry(config, input) { +function massageRegistry(input, registryUrls) { let registry = input; - if (!registry && is.nonEmptyArray(config.registryUrls)) { - [registry] = config.registryUrls; + if (!registry && is.nonEmptyArray(registryUrls)) { + [registry] = registryUrls; } if (!registry || registry === 'docker.io') { - registry = 'index.docker.io'; // eslint-disable-line no-param-reassign + registry = 'index.docker.io'; } if (!registry.match('$https?://')) { - registry = `https://${registry}`; // eslint-disable-line no-param-reassign + registry = `https://${registry}`; } return registry; } @@ -190,7 +190,7 @@ async function getManifestResponse(registry, repository, tag) { async function getDigest(config, newValue) { const { dockerRegistry, depName } = config; logger.debug(`getDigest(${dockerRegistry}, ${depName}, ${newValue})`); - const massagedRegistry = massageRegistry(config, dockerRegistry); + const massagedRegistry = massageRegistry(dockerRegistry, config.registryUrls); const repository = getRepository(depName, dockerRegistry); const newTag = newValue || 'latest'; try { @@ -317,7 +317,7 @@ async function getTags(registry, repository) { async function getPkgReleases(purl, config = {}) { const { fullname, qualifiers } = purl; const { registry } = qualifiers; - const massagedRegistry = massageRegistry(config, registry); + const massagedRegistry = massageRegistry(registry, config.registryUrls); const repository = getRepository(fullname, registry); const tags = await getTags(massagedRegistry, repository); if (!tags) { -- GitLab