feat: drop dockerMapDotFiles (#9417)

Drops support for dockerMapDotfiles

BREAKING CHANGE: dockerMapDotfiles is no longer supported
This commit is contained in:
Rhys Arkins 2021-04-10 06:23:11 +02:00
parent cbf8ea4e55
commit ac7a5c4d93
11 changed files with 2 additions and 123 deletions

View file

@ -164,17 +164,6 @@ You would use put this in your configuration file:
If you pulled a new `node` image, the final image would be `ghcr.io/renovatebot/node` instead of `docker.io/renovate/node`. If you pulled a new `node` image, the final image would be `ghcr.io/renovatebot/node` instead of `docker.io/renovate/node`.
## dockerMapDotfiles
This is used if you want to map "dotfiles" from your host computer home directory to containers that Renovate creates, e.g. for updating lock files.
Currently applicable to `.npmrc` only.
```json
{
"dockerMapDotfiles": true
}
```
## dockerUser ## dockerUser
Override default user and group used by Docker-based binaries. Override default user and group used by Docker-based binaries.

View file

@ -254,14 +254,6 @@ const options: RenovateOptions[] = [
type: 'object', type: 'object',
default: false, default: false,
}, },
{
name: 'dockerMapDotfiles',
description:
'Map relevant home directory dotfiles into containers when binarySource=docker.',
admin: true,
type: 'boolean',
default: false,
},
{ {
name: 'dockerChildPrefix', name: 'dockerChildPrefix',
description: description:

View file

@ -236,65 +236,6 @@ Array [
] ]
`; `;
exports[`manager/npm/post-update/lerna generateLockFiles() maps dot files 1`] = `
Array [
Object {
"cmd": "lerna info || echo \\"Ignoring lerna info failure\\"",
"options": Object {
"cwd": "some-dir",
"encoding": "utf-8",
"env": Object {
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
Object {
"cmd": "npm install --ignore-scripts --no-audit --package-lock-only",
"options": Object {
"cwd": "some-dir",
"encoding": "utf-8",
"env": Object {
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
Object {
"cmd": "lerna bootstrap --no-ci --ignore-scripts -- --ignore-scripts --no-audit --package-lock-only",
"options": Object {
"cwd": "some-dir",
"encoding": "utf-8",
"env": Object {
"HOME": "/home/user",
"HTTPS_PROXY": "https://example.com",
"HTTP_PROXY": "http://example.com",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US",
"NO_PROXY": "localhost",
"PATH": "/tmp/path",
},
"maxBuffer": 10485760,
"timeout": 900000,
},
},
]
`;
exports[`manager/npm/post-update/lerna generateLockFiles() performs full npm install 1`] = ` exports[`manager/npm/post-update/lerna generateLockFiles() performs full npm install 1`] = `
Array [ Array [
Object { Object {

View file

@ -93,27 +93,13 @@ describe(getName(__filename), () => {
expect(res.error).toBe(false); expect(res.error).toBe(false);
expect(execSnapshots).toMatchSnapshot(); expect(execSnapshots).toMatchSnapshot();
}); });
it('maps dot files', async () => {
const execSnapshots = mockExecAll(exec);
const res = await lernaHelper.generateLockFiles(
lernaPkgFile('npm'),
'some-dir',
{
dockerMapDotfiles: true,
constraints: { npm: '^6.0.0' },
},
{}
);
expect(res.error).toBe(false);
expect(execSnapshots).toMatchSnapshot();
});
it('allows scripts for trust level high', async () => { it('allows scripts for trust level high', async () => {
const execSnapshots = mockExecAll(exec); const execSnapshots = mockExecAll(exec);
setAdminConfig({ allowScripts: true }); setAdminConfig({ allowScripts: true });
const res = await lernaHelper.generateLockFiles( const res = await lernaHelper.generateLockFiles(
lernaPkgFile('npm'), lernaPkgFile('npm'),
'some-dir', 'some-dir',
{}, { constraints: { npm: '^6.0.0' } },
{} {}
); );
expect(res.error).toBe(false); expect(res.error).toBe(false);

View file

@ -1,6 +1,5 @@
import semver, { validRange } from 'semver'; import semver, { validRange } from 'semver';
import { quote } from 'shlex'; import { quote } from 'shlex';
import { join } from 'upath';
import { getAdminConfig } from '../../../config/admin'; import { getAdminConfig } from '../../../config/admin';
import { TEMPORARY_ERROR } from '../../../constants/error-messages'; import { TEMPORARY_ERROR } from '../../../constants/error-messages';
import { logger } from '../../../logger'; import { logger } from '../../../logger';
@ -97,12 +96,6 @@ export async function generateLockFiles(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH; execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL; execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL;
} }
if (config.dockerMapDotfiles) {
const homeDir =
process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
const homeNpmrc = join(homeDir, '.npmrc');
execOptions.docker.volumes = [[homeNpmrc, '/home/ubuntu/.npmrc']];
}
const lernaVersion = getLernaVersion(lernaPackageFile); const lernaVersion = getLernaVersion(lernaPackageFile);
logger.debug('Using lerna version ' + lernaVersion); logger.debug('Using lerna version ' + lernaVersion);
preCommands.push(`npm i -g lerna@${quote(lernaVersion)}`); preCommands.push(`npm i -g lerna@${quote(lernaVersion)}`);

View file

@ -27,7 +27,6 @@ describe('generateLockFile', () => {
const execSnapshots = mockExecAll(exec); const execSnapshots = mockExecAll(exec);
fs.readFile = jest.fn(() => 'package-lock-contents') as never; fs.readFile = jest.fn(() => 'package-lock-contents') as never;
const artifactUpdateApproach = 'deep'; const artifactUpdateApproach = 'deep';
const dockerMapDotfiles = true;
const postUpdateOptions = ['npmDedupe']; const postUpdateOptions = ['npmDedupe'];
const updates = [ const updates = [
{ depName: 'some-dep', newVersion: '1.0.1', isLockfileUpdate: false }, { depName: 'some-dep', newVersion: '1.0.1', isLockfileUpdate: false },
@ -36,7 +35,7 @@ describe('generateLockFile', () => {
'some-dir', 'some-dir',
{}, {},
'package-lock.json', 'package-lock.json',
{ dockerMapDotfiles, artifactUpdateApproach, postUpdateOptions }, { artifactUpdateApproach, postUpdateOptions },
updates updates
); );
expect(fs.readFile).toHaveBeenCalledTimes(1); expect(fs.readFile).toHaveBeenCalledTimes(1);

View file

@ -75,12 +75,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH; execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL; execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL;
} }
if (config.dockerMapDotfiles) {
const homeDir =
process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
const homeNpmrc = join(homeDir, '.npmrc');
execOptions.docker.volumes = [[homeNpmrc, '/home/ubuntu/.npmrc']];
}
if (!upgrades.every((upgrade) => upgrade.isLockfileUpdate)) { if (!upgrades.every((upgrade) => upgrade.isLockfileUpdate)) {
// This command updates the lock file based on package.json // This command updates the lock file based on package.json

View file

@ -24,7 +24,6 @@ describe('generateLockFile', () => {
env.getChildProcessEnv.mockReturnValue(envMock.basic); env.getChildProcessEnv.mockReturnValue(envMock.basic);
}); });
it('generates lock files', async () => { it('generates lock files', async () => {
config.dockerMapDotfiles = true;
const execSnapshots = mockExecAll(exec); const execSnapshots = mockExecAll(exec);
fs.readFile = jest.fn(() => 'package-lock-contents') as never; fs.readFile = jest.fn(() => 'package-lock-contents') as never;
const res = await pnpmHelper.generateLockFile('some-dir', {}, config); const res = await pnpmHelper.generateLockFile('some-dir', {}, config);

View file

@ -54,12 +54,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH; execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL; execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL;
} }
if (config.dockerMapDotfiles) {
const homeDir =
process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
const homeNpmrc = join(homeDir, '.npmrc');
execOptions.docker.volumes = [[homeNpmrc, '/home/ubuntu/.npmrc']];
}
cmd = 'pnpm'; cmd = 'pnpm';
let args = 'install --recursive --lockfile-only'; let args = 'install --recursive --lockfile-only';
if (!getAdminConfig().allowScripts || config.ignoreScripts) { if (!getAdminConfig().allowScripts || config.ignoreScripts) {

View file

@ -54,7 +54,6 @@ describe(getName(__filename), () => {
); );
}); });
const config = { const config = {
dockerMapDotfiles: true,
constraints: { constraints: {
yarn: yarnCompatibility, yarn: yarnCompatibility,
}, },
@ -140,7 +139,6 @@ describe(getName(__filename), () => {
); );
}); });
const config = { const config = {
dockerMapDotfiles: true,
constraints: { constraints: {
yarn: yarnCompatibility, yarn: yarnCompatibility,
}, },

View file

@ -125,12 +125,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH; execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL; execOptions.extraEnv.NPM_EMAIL = env.NPM_EMAIL;
} }
if (config.dockerMapDotfiles) {
const homeDir =
process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
const homeNpmrc = join(homeDir, '.npmrc');
execOptions.docker.volumes = [[homeNpmrc, '/home/ubuntu/.npmrc']];
}
// This command updates the lock file based on package.json // This command updates the lock file based on package.json
commands.push(`yarn install ${cmdOptions}`.trim()); commands.push(`yarn install ${cmdOptions}`.trim());