From 40a59cc9e0687a6302a5a5992949564af6b507c7 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Mon, 15 Mar 2021 14:23:38 +0100 Subject: [PATCH] feat: use short renovate image names (#9133) Co-authored-by: Rhys Arkins --- lib/manager/bundler/artifacts.ts | 2 +- lib/manager/cargo/artifacts.ts | 2 +- lib/manager/cocoapods/artifacts.ts | 2 +- lib/manager/composer/artifacts.ts | 2 +- lib/manager/gomod/artifacts.ts | 2 +- lib/manager/gradle-wrapper/artifacts.ts | 2 +- lib/manager/gradle/index.ts | 2 +- lib/manager/helmv3/artifacts.ts | 2 +- lib/manager/mix/artifacts.ts | 2 +- lib/manager/npm/post-update/lerna.ts | 2 +- lib/manager/npm/post-update/npm.ts | 2 +- lib/manager/npm/post-update/pnpm.ts | 2 +- lib/manager/npm/post-update/yarn.ts | 2 +- lib/manager/nuget/artifacts.ts | 2 +- lib/manager/pip_requirements/artifacts.ts | 2 +- lib/manager/pip_setup/extract.ts | 2 +- lib/manager/pipenv/artifacts.ts | 2 +- lib/manager/poetry/artifacts.ts | 2 +- lib/util/exec/__snapshots__/exec.spec.ts.snap | 2 +- lib/util/exec/docker/index.ts | 9 ++---- lib/util/exec/exec.spec.ts | 32 ++++++++++--------- 21 files changed, 38 insertions(+), 41 deletions(-) diff --git a/lib/manager/bundler/artifacts.ts b/lib/manager/bundler/artifacts.ts index 0bb071edfab14e..a02d7263b796b7 100644 --- a/lib/manager/bundler/artifacts.ts +++ b/lib/manager/bundler/artifacts.ts @@ -139,7 +139,7 @@ export async function updateArtifacts( GEM_HOME: await getGemHome(config), }, docker: { - image: 'renovate/ruby', + image: 'ruby', tagScheme: 'ruby', tagConstraint: await getRubyConstraint(updateArtifact), preCommands, diff --git a/lib/manager/cargo/artifacts.ts b/lib/manager/cargo/artifacts.ts index a64e67ddee4a7f..4ceea9bfcb6af5 100644 --- a/lib/manager/cargo/artifacts.ts +++ b/lib/manager/cargo/artifacts.ts @@ -20,7 +20,7 @@ async function cargoUpdate( const execOptions: ExecOptions = { docker: { - image: 'renovate/rust', + image: 'rust', }, }; try { diff --git a/lib/manager/cocoapods/artifacts.ts b/lib/manager/cocoapods/artifacts.ts index 08d7015e57fb0f..50592398ae27d9 100644 --- a/lib/manager/cocoapods/artifacts.ts +++ b/lib/manager/cocoapods/artifacts.ts @@ -74,7 +74,7 @@ export async function updateArtifacts({ CP_HOME_DIR: await getCocoaPodsHome(config), }, docker: { - image: 'renovate/cocoapods', + image: 'cocoapods', tagScheme: 'ruby', tagConstraint, }, diff --git a/lib/manager/composer/artifacts.ts b/lib/manager/composer/artifacts.ts index 06bced68a042e5..9515106780c284 100644 --- a/lib/manager/composer/artifacts.ts +++ b/lib/manager/composer/artifacts.ts @@ -133,7 +133,7 @@ export async function updateArtifacts({ COMPOSER_AUTH: getAuthJson(), }, docker: { - image: 'renovate/composer', + image: 'composer', tagConstraint: getConstraint(config), tagScheme: composerVersioningId, }, diff --git a/lib/manager/gomod/artifacts.ts b/lib/manager/gomod/artifacts.ts index e12df351a9b940..df611b0308db8a 100644 --- a/lib/manager/gomod/artifacts.ts +++ b/lib/manager/gomod/artifacts.ts @@ -68,7 +68,7 @@ export async function updateArtifacts({ CGO_ENABLED: config.binarySource === BinarySource.Docker ? '0' : null, }, docker: { - image: 'renovate/go', + image: 'go', tagConstraint: config.constraints?.go, tagScheme: 'npm', volumes: [goPath], diff --git a/lib/manager/gradle-wrapper/artifacts.ts b/lib/manager/gradle-wrapper/artifacts.ts index 48be6e15cec0dd..e6f4ddcf5f20df 100644 --- a/lib/manager/gradle-wrapper/artifacts.ts +++ b/lib/manager/gradle-wrapper/artifacts.ts @@ -86,7 +86,7 @@ export async function updateArtifacts({ logger.debug(`Updating gradle wrapper: "${cmd}"`); const execOptions: ExecOptions = { docker: { - image: 'renovate/gradle', + image: 'gradle', }, extraEnv, }; diff --git a/lib/manager/gradle/index.ts b/lib/manager/gradle/index.ts index 316ccccb1ab71f..04550342bc2ac5 100644 --- a/lib/manager/gradle/index.ts +++ b/lib/manager/gradle/index.ts @@ -65,7 +65,7 @@ export async function executeGradle( timeout, cwd, docker: { - image: 'renovate/gradle', + image: 'gradle', }, extraEnv, }; diff --git a/lib/manager/helmv3/artifacts.ts b/lib/manager/helmv3/artifacts.ts index c11ac88cf6fe80..1903724d8497f5 100644 --- a/lib/manager/helmv3/artifacts.ts +++ b/lib/manager/helmv3/artifacts.ts @@ -15,7 +15,7 @@ async function helmUpdate(manifestPath: string): Promise { const execOptions: ExecOptions = { docker: { - image: 'renovate/helm', + image: 'helm', }, }; await exec(cmd, execOptions); diff --git a/lib/manager/mix/artifacts.ts b/lib/manager/mix/artifacts.ts index 118730bec3c2cf..bfc9d11f57c252 100644 --- a/lib/manager/mix/artifacts.ts +++ b/lib/manager/mix/artifacts.ts @@ -39,7 +39,7 @@ export async function updateArtifacts({ const execOptions: ExecOptions = { cwdFile: packageFileName, - docker: { image: 'renovate/elixir' }, + docker: { image: 'elixir' }, }; const command = ['mix', 'deps.update', ...updatedDeps.map(quote)].join(' '); diff --git a/lib/manager/npm/post-update/lerna.ts b/lib/manager/npm/post-update/lerna.ts index 58d2ea04b2f854..5f83ca89ef03de 100644 --- a/lib/manager/npm/post-update/lerna.ts +++ b/lib/manager/npm/post-update/lerna.ts @@ -89,7 +89,7 @@ export async function generateLockFiles( npm_config_store: env.npm_config_store, }, docker: { - image: 'renovate/node', + image: 'node', tagScheme: 'npm', tagConstraint, preCommands, diff --git a/lib/manager/npm/post-update/npm.ts b/lib/manager/npm/post-update/npm.ts index 3042364e111eae..ea10a35b7337e1 100644 --- a/lib/manager/npm/post-update/npm.ts +++ b/lib/manager/npm/post-update/npm.ts @@ -64,7 +64,7 @@ export async function generateLockFile( npm_config_store: env.npm_config_store, }, docker: { - image: 'renovate/node', + image: 'node', tagScheme: 'npm', tagConstraint, preCommands, diff --git a/lib/manager/npm/post-update/pnpm.ts b/lib/manager/npm/post-update/pnpm.ts index 9a356995e989a7..7816267e786744 100644 --- a/lib/manager/npm/post-update/pnpm.ts +++ b/lib/manager/npm/post-update/pnpm.ts @@ -43,7 +43,7 @@ export async function generateLockFile( npm_config_store: env.npm_config_store, }, docker: { - image: 'renovate/node', + image: 'node', tagScheme: 'npm', tagConstraint, preCommands, diff --git a/lib/manager/npm/post-update/yarn.ts b/lib/manager/npm/post-update/yarn.ts index 637f03b1889d7e..30d75fd4efab82 100644 --- a/lib/manager/npm/post-update/yarn.ts +++ b/lib/manager/npm/post-update/yarn.ts @@ -113,7 +113,7 @@ export async function generateLockFile( cwd, extraEnv, docker: { - image: 'renovate/node', + image: 'node', tagScheme: 'npm', tagConstraint, preCommands, diff --git a/lib/manager/nuget/artifacts.ts b/lib/manager/nuget/artifacts.ts index 9dbe7e6adaeab1..79c724dce648a4 100644 --- a/lib/manager/nuget/artifacts.ts +++ b/lib/manager/nuget/artifacts.ts @@ -58,7 +58,7 @@ async function runDotnetRestore( ): Promise { const execOptions: ExecOptions = { docker: { - image: 'renovate/dotnet', + image: 'dotnet', }, }; diff --git a/lib/manager/pip_requirements/artifacts.ts b/lib/manager/pip_requirements/artifacts.ts index 4ac576f3252e81..34c6a941f3ff4a 100644 --- a/lib/manager/pip_requirements/artifacts.ts +++ b/lib/manager/pip_requirements/artifacts.ts @@ -32,7 +32,7 @@ export async function updateArtifacts({ const execOptions: ExecOptions = { cwdFile: '.', docker: { - image: 'renovate/python', + image: 'python', tagScheme: 'pip_requirements', preCommands: ['pip install hashin'], }, diff --git a/lib/manager/pip_setup/extract.ts b/lib/manager/pip_setup/extract.ts index 1bef01cf81ef40..e6692ade9e8a50 100644 --- a/lib/manager/pip_setup/extract.ts +++ b/lib/manager/pip_setup/extract.ts @@ -57,7 +57,7 @@ export async function extractSetupFile( cwdFile: packageFile, timeout: 30000, docker: { - image: 'renovate/python', + image: 'python', }, }); if (res.stderr) { diff --git a/lib/manager/pipenv/artifacts.ts b/lib/manager/pipenv/artifacts.ts index f9d9840d0f9c00..1281f243667ae1 100644 --- a/lib/manager/pipenv/artifacts.ts +++ b/lib/manager/pipenv/artifacts.ts @@ -103,7 +103,7 @@ export async function updateArtifacts({ PIPENV_CACHE_DIR: cacheDir, }, docker: { - image: 'renovate/python', + image: 'python', tagConstraint, tagScheme: 'pep440', preCommands: [ diff --git a/lib/manager/poetry/artifacts.ts b/lib/manager/poetry/artifacts.ts index bd3902307334f4..00b39d1b4407fa 100644 --- a/lib/manager/poetry/artifacts.ts +++ b/lib/manager/poetry/artifacts.ts @@ -133,7 +133,7 @@ export async function updateArtifacts({ cwdFile: packageFileName, extraEnv, docker: { - image: 'renovate/python', + image: 'python', tagConstraint, tagScheme: 'poetry', preCommands: [poetryInstall], diff --git a/lib/util/exec/__snapshots__/exec.spec.ts.snap b/lib/util/exec/__snapshots__/exec.spec.ts.snap index 0d0c758fed74ec..68d144bc5f8d10 100644 --- a/lib/util/exec/__snapshots__/exec.spec.ts.snap +++ b/lib/util/exec/__snapshots__/exec.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Child process execution wrapper Supports image prefetch 1`] = ` +exports[`util/exec/exec Supports image prefetch 1`] = ` Array [ "echo hello", "echo hello", diff --git a/lib/util/exec/docker/index.ts b/lib/util/exec/docker/index.ts index cd446964f1361f..b8707f7e7208f0 100644 --- a/lib/util/exec/docker/index.ts +++ b/lib/util/exec/docker/index.ts @@ -116,7 +116,7 @@ async function getDockerTag( } function getContainerName(image: string): string { - return image.replace(/\//g, '_'); + return `renovate_${image}`.replace(/\//g, '_'); } export async function removeDockerContainer(image: string): Promise { @@ -210,12 +210,7 @@ export async function generateDockerCommand( result.push(`-w "${cwd}"`); } - if (dockerImagePrefix) { - image = image.replace( - /^renovate\//, - ensureTrailingSlash(dockerImagePrefix) - ); - } + image = `${ensureTrailingSlash(dockerImagePrefix ?? 'renovate')}${image}`; let tag: string; if (options.tag) { diff --git a/lib/util/exec/exec.spec.ts b/lib/util/exec/exec.spec.ts index 679c100824be59..3fb345ca0d1f9a 100644 --- a/lib/util/exec/exec.spec.ts +++ b/lib/util/exec/exec.spec.ts @@ -4,6 +4,7 @@ import { exec as _cpExec, } from 'child_process'; import { envMock } from '../../../test/exec-util'; +import { getName } from '../../../test/util'; import { setAdminConfig } from '../../config/admin'; import type { RepoAdminConfig } from '../../config/types'; import { TEMPORARY_ERROR } from '../../constants/error-messages'; @@ -30,8 +31,8 @@ interface TestInput { adminConfig?: RepoAdminConfig; } -describe(`Child process execution wrapper`, () => { - let processEnvOrig; +describe(getName(__filename), () => { + let processEnvOrig: NodeJS.ProcessEnv; const cacheDir = '/tmp/renovate/cache/'; const cwd = '/tmp/renovate/github/some/repo/'; @@ -58,8 +59,9 @@ describe(`Child process execution wrapper`, () => { setAdminConfig(); }); - const image = 'renovate/image'; - const name = image.replace(/\//g, '_'); + const image = 'image'; + const fullImage = `renovate/${image}`; + const name = `renovate_${image}`; const tag = '1.2.3'; const inCmd = 'echo hello'; const outCmd = ['echo hello']; @@ -75,7 +77,7 @@ describe(`Child process execution wrapper`, () => { const encoding = 'utf-8'; const docker = { image }; const processEnv = envMock.full; - const dockerPullCmd = `docker pull ${image}`; + const dockerPullCmd = `docker pull ${fullImage}`; const dockerRemoveCmd = `docker ps --filter name=${name} -aq`; const dockerPullOpts = { encoding }; const dockerRemoveOpts = dockerPullOpts; @@ -206,7 +208,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -268,7 +270,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -318,7 +320,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -344,7 +346,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ `${dockerPullCmd}:${tag}`, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${image}:${tag} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${fullImage}:${tag} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -370,7 +372,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -v "${volume_1}":"${volume_1}" -v "${volume_2_from}":"${volume_2_to}" -w "${cwd}" ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -v "${volume_1}":"${volume_1}" -v "${volume_2_from}":"${volume_2_to}" -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -399,7 +401,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child --user=foobar ${defaultVolumes} -w "${cwd}" ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child --user=foobar ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -465,7 +467,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${image} bash -l -c "preCommand1 && preCommand2 && ${inCmd} && postCommand1 && postCommand2"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "preCommand1 && preCommand2 && ${inCmd} && postCommand1 && postCommand2"`, ], outOpts: [ dockerPullOpts, @@ -500,7 +502,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -605,7 +607,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -639,7 +641,7 @@ describe(`Child process execution wrapper`, () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts,