Skip to content

Commit

Permalink
feat: use short renovate image names (#9133)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <rhys@arkins.net>
  • Loading branch information
viceice and rarkins authored Mar 15, 2021
1 parent f1a4102 commit 40a59cc
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 41 deletions.
2 changes: 1 addition & 1 deletion lib/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/cargo/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function cargoUpdate(

const execOptions: ExecOptions = {
docker: {
image: 'renovate/rust',
image: 'rust',
},
};
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/cocoapods/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function updateArtifacts({
CP_HOME_DIR: await getCocoaPodsHome(config),
},
docker: {
image: 'renovate/cocoapods',
image: 'cocoapods',
tagScheme: 'ruby',
tagConstraint,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/composer/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export async function updateArtifacts({
COMPOSER_AUTH: getAuthJson(),
},
docker: {
image: 'renovate/composer',
image: 'composer',
tagConstraint: getConstraint(config),
tagScheme: composerVersioningId,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gomod/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gradle-wrapper/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function updateArtifacts({
logger.debug(`Updating gradle wrapper: "${cmd}"`);
const execOptions: ExecOptions = {
docker: {
image: 'renovate/gradle',
image: 'gradle',
},
extraEnv,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gradle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function executeGradle(
timeout,
cwd,
docker: {
image: 'renovate/gradle',
image: 'gradle',
},
extraEnv,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/helmv3/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function helmUpdate(manifestPath: string): Promise<void> {

const execOptions: ExecOptions = {
docker: {
image: 'renovate/helm',
image: 'helm',
},
};
await exec(cmd, execOptions);
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/mix/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ');

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/lerna.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/pnpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export async function generateLockFile(
cwd,
extraEnv,
docker: {
image: 'renovate/node',
image: 'node',
tagScheme: 'npm',
tagConstraint,
preCommands,
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/nuget/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function runDotnetRestore(
): Promise<void> {
const execOptions: ExecOptions = {
docker: {
image: 'renovate/dotnet',
image: 'dotnet',
},
};

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/pip_requirements/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/pip_setup/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function extractSetupFile(
cwdFile: packageFile,
timeout: 30000,
docker: {
image: 'renovate/python',
image: 'python',
},
});
if (res.stderr) {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/pipenv/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export async function updateArtifacts({
PIPENV_CACHE_DIR: cacheDir,
},
docker: {
image: 'renovate/python',
image: 'python',
tagConstraint,
tagScheme: 'pep440',
preCommands: [
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/poetry/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export async function updateArtifacts({
cwdFile: packageFileName,
extraEnv,
docker: {
image: 'renovate/python',
image: 'python',
tagConstraint,
tagScheme: 'poetry',
preCommands: [poetryInstall],
Expand Down
2 changes: 1 addition & 1 deletion lib/util/exec/__snapshots__/exec.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 2 additions & 7 deletions lib/util/exec/docker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down Expand Up @@ -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) {
Expand Down
32 changes: 17 additions & 15 deletions lib/util/exec/exec.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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/';
Expand All @@ -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'];
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 40a59cc

Please sign in to comment.