Skip to content

Commit

Permalink
fix: Do not drop bundler platforms on lock file maintenance
Browse files Browse the repository at this point in the history
The bundler manager drops the Gemfile.lock before doing lock file
maintenance but bundler stores additional platforms for resolving only
in the lock file, such as `x86_64-darwin-20`. These additional platforms
and the resolved gems for these platforms are lost when the lock file
deleted. The newly generated platform will only contain the
`x86_64-linux` (or whatever the current platform is when renovate is
run).

This commit stops the manager from removing the lock file and instead
calls `bundler lock --update` to update the existing lock file
in-place.

Fixes renovatebot#14156
  • Loading branch information
jgraichen committed Feb 10, 2022
1 parent afbfd48 commit b6c1da8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/manager/bundler/__snapshots__/artifacts.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Array [
exports[`manager/bundler/artifacts performs lockFileMaintenance 1`] = `
Array [
Object {
"cmd": "bundler lock",
"cmd": "bundler lock --update",
"options": Object {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -292,7 +292,7 @@ Array [
exports[`manager/bundler/artifacts returns error when failing in lockFileMaintenance true 2`] = `
Array [
Object {
"cmd": "bundler lock",
"cmd": "bundler lock --update",
"options": Object {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down
6 changes: 1 addition & 5 deletions lib/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,13 @@ export async function updateArtifacts(
return null;
}

if (config.isLockFileMaintenance) {
await deleteLocalFile(lockFileName);
}

try {
await writeLocalFile(packageFileName, newPackageFileContent);

let cmd;

if (config.isLockFileMaintenance) {
cmd = 'bundler lock';
cmd = 'bundler lock --update';
} else {
cmd = `bundler lock --update ${updatedDeps
.map((dep) => dep.depName)
Expand Down

0 comments on commit b6c1da8

Please sign in to comment.