mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: skip writing symlinks before postUpgradeTasks execution (#24389)
This commit is contained in:
parent
99b393ba29
commit
ab17060aea
2 changed files with 11 additions and 3 deletions
|
@ -26,6 +26,12 @@ describe('workers/repository/update/branch/execute-post-upgrade-commands', () =>
|
||||||
updatedArtifacts: [
|
updatedArtifacts: [
|
||||||
{ type: 'addition', path: 'some-existing-dir', contents: '' },
|
{ type: 'addition', path: 'some-existing-dir', contents: '' },
|
||||||
{ type: 'addition', path: 'artifact', contents: '' },
|
{ type: 'addition', path: 'artifact', contents: '' },
|
||||||
|
{
|
||||||
|
type: 'addition',
|
||||||
|
path: 'symlink',
|
||||||
|
contents: 'dest',
|
||||||
|
isSymlink: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
artifactErrors: [],
|
artifactErrors: [],
|
||||||
upgrades: [],
|
upgrades: [],
|
||||||
|
@ -45,8 +51,10 @@ describe('workers/repository/update/branch/execute-post-upgrade-commands', () =>
|
||||||
});
|
});
|
||||||
fs.localPathIsFile
|
fs.localPathIsFile
|
||||||
.mockResolvedValueOnce(true)
|
.mockResolvedValueOnce(true)
|
||||||
.mockResolvedValueOnce(false);
|
.mockResolvedValueOnce(false)
|
||||||
|
.mockResolvedValueOnce(true);
|
||||||
fs.localPathExists
|
fs.localPathExists
|
||||||
|
.mockResolvedValueOnce(true)
|
||||||
.mockResolvedValueOnce(true)
|
.mockResolvedValueOnce(true)
|
||||||
.mockResolvedValueOnce(true);
|
.mockResolvedValueOnce(true);
|
||||||
|
|
||||||
|
@ -55,7 +63,7 @@ describe('workers/repository/update/branch/execute-post-upgrade-commands', () =>
|
||||||
config
|
config
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(res.updatedArtifacts).toHaveLength(2);
|
expect(res.updatedArtifacts).toHaveLength(3);
|
||||||
expect(fs.writeLocalFile).toHaveBeenCalledTimes(1);
|
expect(fs.writeLocalFile).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,7 +51,7 @@ export async function postUpgradeCommandsExecutor(
|
||||||
// Persist updated files in file system so any executed commands can see them
|
// Persist updated files in file system so any executed commands can see them
|
||||||
for (const file of config.updatedPackageFiles!.concat(updatedArtifacts)) {
|
for (const file of config.updatedPackageFiles!.concat(updatedArtifacts)) {
|
||||||
const canWriteFile = await localPathIsFile(file.path);
|
const canWriteFile = await localPathIsFile(file.path);
|
||||||
if (file.type === 'addition' && canWriteFile) {
|
if (file.type === 'addition' && !file.isSymlink && canWriteFile) {
|
||||||
let contents: Buffer | null;
|
let contents: Buffer | null;
|
||||||
if (typeof file.contents === 'string') {
|
if (typeof file.contents === 'string') {
|
||||||
contents = Buffer.from(file.contents);
|
contents = Buffer.from(file.contents);
|
||||||
|
|
Loading…
Reference in a new issue