mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat(bundler): support conservative mode (#16129)
This commit is contained in:
parent
bb45bc37b0
commit
c3fd5c2edf
4 changed files with 40 additions and 1 deletions
|
@ -1924,6 +1924,7 @@ This way Renovate can use GitHub's [Commit signing support for bots and other Gi
|
||||||
|
|
||||||
## postUpdateOptions
|
## postUpdateOptions
|
||||||
|
|
||||||
|
- `bundlerConservative`: Enable conservative mode for `bundler` (Ruby dependencies). This will only update the immediate dependency in the lockfile instead of all subdependencies
|
||||||
- `gomodMassage`: Enable massaging `replace` directives before calling `go` commands
|
- `gomodMassage`: Enable massaging `replace` directives before calling `go` commands
|
||||||
- `gomodTidy`: Run `go mod tidy` after Go module updates. This is implicitly enabled for major module updates when `gomodUpdateImportPaths` is enabled
|
- `gomodTidy`: Run `go mod tidy` after Go module updates. This is implicitly enabled for major module updates when `gomodUpdateImportPaths` is enabled
|
||||||
- `gomodTidy1.17`: Run `go mod tidy -compat=1.17` after Go module updates.
|
- `gomodTidy1.17`: Run `go mod tidy -compat=1.17` after Go module updates.
|
||||||
|
|
|
@ -1853,6 +1853,7 @@ const options: RenovateOptions[] = [
|
||||||
type: 'array',
|
type: 'array',
|
||||||
default: [],
|
default: [],
|
||||||
allowedValues: [
|
allowedValues: [
|
||||||
|
'bundlerConservative',
|
||||||
'gomodMassage',
|
'gomodMassage',
|
||||||
'gomodUpdateImportPaths',
|
'gomodUpdateImportPaths',
|
||||||
'gomodTidy',
|
'gomodTidy',
|
||||||
|
|
|
@ -128,6 +128,36 @@ describe('modules/manager/bundler/artifacts', () => {
|
||||||
expect(execSnapshots).toMatchSnapshot();
|
expect(execSnapshots).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('supports conservative mode', async () => {
|
||||||
|
fs.readLocalFile.mockResolvedValueOnce('Current Gemfile.lock');
|
||||||
|
fs.writeLocalFile.mockResolvedValueOnce();
|
||||||
|
fs.readLocalFile.mockResolvedValueOnce(null);
|
||||||
|
const execSnapshots = mockExecAll(exec);
|
||||||
|
git.getRepoStatus.mockResolvedValueOnce({
|
||||||
|
modified: ['Gemfile.lock'],
|
||||||
|
} as StatusResult);
|
||||||
|
fs.readLocalFile.mockResolvedValueOnce('Updated Gemfile.lock');
|
||||||
|
expect(
|
||||||
|
await updateArtifacts({
|
||||||
|
packageFileName: 'Gemfile',
|
||||||
|
updatedDeps: [{ depName: 'foo' }, { depName: 'bar' }],
|
||||||
|
newPackageFileContent: 'Updated Gemfile content',
|
||||||
|
config: {
|
||||||
|
...config,
|
||||||
|
postUpdateOptions: [
|
||||||
|
...(config.postUpdateOptions ?? []),
|
||||||
|
'bundlerConservative',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).toEqual([updatedGemfileLock]);
|
||||||
|
expect(execSnapshots).toMatchObject([
|
||||||
|
expect.objectContaining({
|
||||||
|
cmd: 'bundler lock --conservative --update foo bar',
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
describe('Docker', () => {
|
describe('Docker', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
GlobalConfig.set({
|
GlobalConfig.set({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { lt } from '@renovatebot/ruby-semver';
|
import { lt } from '@renovatebot/ruby-semver';
|
||||||
|
import is from '@sindresorhus/is';
|
||||||
import { quote } from 'shlex';
|
import { quote } from 'shlex';
|
||||||
import {
|
import {
|
||||||
BUNDLER_INVALID_CREDENTIALS,
|
BUNDLER_INVALID_CREDENTIALS,
|
||||||
|
@ -61,6 +62,12 @@ export async function updateArtifacts(
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const args = [
|
||||||
|
config.postUpdateOptions?.includes('bundlerConservative') &&
|
||||||
|
'--conservative',
|
||||||
|
'--update',
|
||||||
|
].filter(is.nonEmptyString);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await writeLocalFile(packageFileName, newPackageFileContent);
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
||||||
|
|
||||||
|
@ -69,7 +76,7 @@ export async function updateArtifacts(
|
||||||
if (config.isLockFileMaintenance) {
|
if (config.isLockFileMaintenance) {
|
||||||
cmd = 'bundler lock --update';
|
cmd = 'bundler lock --update';
|
||||||
} else {
|
} else {
|
||||||
cmd = `bundler lock --update ${updatedDeps
|
cmd = `bundler lock ${args.join(' ')} ${updatedDeps
|
||||||
.map((dep) => `${dep.depName}`)
|
.map((dep) => `${dep.depName}`)
|
||||||
.filter((dep) => dep !== 'ruby')
|
.filter((dep) => dep !== 'ruby')
|
||||||
.map(quote)
|
.map(quote)
|
||||||
|
|
Loading…
Reference in a new issue