Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(manager/bundler): Update Gemfile.lock when only Ruby upgraded #27451

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/modules/manager/bundler/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,27 @@ describe('modules/manager/bundler/artifacts', () => {
{ cmd: 'bundler lock --minor --conservative --update foo' },
]);
});

it('updates the Gemfile.lock when ruby upgraded', async () => {
// See https://github.com/renovatebot/renovate/issues/15114
fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
const execSnapshots = mockExecSequence([{ stdout: '', stderr: '' }]);
git.getRepoStatus.mockResolvedValueOnce(
partial<StatusResult>({
modified: ['Gemfile.lock'],
}),
);

const res = await updateArtifacts({
packageFileName: 'Gemfile',
updatedDeps: [{ depName: 'ruby', updateType: 'patch' }],
newPackageFileContent: '{}',
config,
});

expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]);
expect(execSnapshots).toMatchObject([{ cmd: 'bundler lock' }]);
});
});
});
});
7 changes: 7 additions & 0 deletions lib/modules/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ export async function updateArtifacts(
commands.push(cmd);
}
}

const rubyUpgraded = updatedDeps
.map((dep) => dep.depName)
.includes('ruby');
if (rubyUpgraded) {
commands.push('bundler lock');
}
}

const bundlerHostRules = findAllAuthenticatable({
Expand Down