Skip to content

Commit

Permalink
feat: drop dockerMapDotFiles (#9417)
Browse files Browse the repository at this point in the history
Drops support for dockerMapDotfiles

BREAKING CHANGE: dockerMapDotfiles is no longer supported
  • Loading branch information
rarkins committed Apr 22, 2021
1 parent cbf8ea4 commit ac7a5c4
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 123 deletions.
11 changes: 0 additions & 11 deletions docs/usage/self-hosted-configuration.md
Expand Up @@ -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`.

## 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

Override default user and group used by Docker-based binaries.
Expand Down
8 changes: 0 additions & 8 deletions lib/config/definitions.ts
Expand Up @@ -254,14 +254,6 @@ const options: RenovateOptions[] = [
type: 'object',
default: false,
},
{
name: 'dockerMapDotfiles',
description:
'Map relevant home directory dotfiles into containers when binarySource=docker.',
admin: true,
type: 'boolean',
default: false,
},
{
name: 'dockerChildPrefix',
description:
Expand Down
59 changes: 0 additions & 59 deletions lib/manager/npm/post-update/__snapshots__/lerna.spec.ts.snap
Expand Up @@ -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`] = `
Array [
Object {
Expand Down
16 changes: 1 addition & 15 deletions lib/manager/npm/post-update/lerna.spec.ts
Expand Up @@ -93,27 +93,13 @@ describe(getName(__filename), () => {
expect(res.error).toBe(false);
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 () => {
const execSnapshots = mockExecAll(exec);
setAdminConfig({ allowScripts: true });
const res = await lernaHelper.generateLockFiles(
lernaPkgFile('npm'),
'some-dir',
{},
{ constraints: { npm: '^6.0.0' } },
{}
);
expect(res.error).toBe(false);
Expand Down
7 changes: 0 additions & 7 deletions lib/manager/npm/post-update/lerna.ts
@@ -1,6 +1,5 @@
import semver, { validRange } from 'semver';
import { quote } from 'shlex';
import { join } from 'upath';
import { getAdminConfig } from '../../../config/admin';
import { TEMPORARY_ERROR } from '../../../constants/error-messages';
import { logger } from '../../../logger';
Expand Down Expand Up @@ -97,12 +96,6 @@ export async function generateLockFiles(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
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);
logger.debug('Using lerna version ' + lernaVersion);
preCommands.push(`npm i -g lerna@${quote(lernaVersion)}`);
Expand Down
3 changes: 1 addition & 2 deletions lib/manager/npm/post-update/npm.spec.ts
Expand Up @@ -27,7 +27,6 @@ describe('generateLockFile', () => {
const execSnapshots = mockExecAll(exec);
fs.readFile = jest.fn(() => 'package-lock-contents') as never;
const artifactUpdateApproach = 'deep';
const dockerMapDotfiles = true;
const postUpdateOptions = ['npmDedupe'];
const updates = [
{ depName: 'some-dep', newVersion: '1.0.1', isLockfileUpdate: false },
Expand All @@ -36,7 +35,7 @@ describe('generateLockFile', () => {
'some-dir',
{},
'package-lock.json',
{ dockerMapDotfiles, artifactUpdateApproach, postUpdateOptions },
{ artifactUpdateApproach, postUpdateOptions },
updates
);
expect(fs.readFile).toHaveBeenCalledTimes(1);
Expand Down
6 changes: 0 additions & 6 deletions lib/manager/npm/post-update/npm.ts
Expand Up @@ -75,12 +75,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
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)) {
// This command updates the lock file based on package.json
Expand Down
1 change: 0 additions & 1 deletion lib/manager/npm/post-update/pnpm.spec.ts
Expand Up @@ -24,7 +24,6 @@ describe('generateLockFile', () => {
env.getChildProcessEnv.mockReturnValue(envMock.basic);
});
it('generates lock files', async () => {
config.dockerMapDotfiles = true;
const execSnapshots = mockExecAll(exec);
fs.readFile = jest.fn(() => 'package-lock-contents') as never;
const res = await pnpmHelper.generateLockFile('some-dir', {}, config);
Expand Down
6 changes: 0 additions & 6 deletions lib/manager/npm/post-update/pnpm.ts
Expand Up @@ -54,12 +54,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
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';
let args = 'install --recursive --lockfile-only';
if (!getAdminConfig().allowScripts || config.ignoreScripts) {
Expand Down
2 changes: 0 additions & 2 deletions lib/manager/npm/post-update/yarn.spec.ts
Expand Up @@ -54,7 +54,6 @@ describe(getName(__filename), () => {
);
});
const config = {
dockerMapDotfiles: true,
constraints: {
yarn: yarnCompatibility,
},
Expand Down Expand Up @@ -140,7 +139,6 @@ describe(getName(__filename), () => {
);
});
const config = {
dockerMapDotfiles: true,
constraints: {
yarn: yarnCompatibility,
},
Expand Down
6 changes: 0 additions & 6 deletions lib/manager/npm/post-update/yarn.ts
Expand Up @@ -125,12 +125,6 @@ export async function generateLockFile(
execOptions.extraEnv.NPM_AUTH = env.NPM_AUTH;
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
commands.push(`yarn install ${cmdOptions}`.trim());
Expand Down

0 comments on commit ac7a5c4

Please sign in to comment.