mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +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: [
|
||||
{ type: 'addition', path: 'some-existing-dir', contents: '' },
|
||||
{ type: 'addition', path: 'artifact', contents: '' },
|
||||
{
|
||||
type: 'addition',
|
||||
path: 'symlink',
|
||||
contents: 'dest',
|
||||
isSymlink: true,
|
||||
},
|
||||
],
|
||||
artifactErrors: [],
|
||||
upgrades: [],
|
||||
|
@ -45,8 +51,10 @@ describe('workers/repository/update/branch/execute-post-upgrade-commands', () =>
|
|||
});
|
||||
fs.localPathIsFile
|
||||
.mockResolvedValueOnce(true)
|
||||
.mockResolvedValueOnce(false);
|
||||
.mockResolvedValueOnce(false)
|
||||
.mockResolvedValueOnce(true);
|
||||
fs.localPathExists
|
||||
.mockResolvedValueOnce(true)
|
||||
.mockResolvedValueOnce(true)
|
||||
.mockResolvedValueOnce(true);
|
||||
|
||||
|
@ -55,7 +63,7 @@ describe('workers/repository/update/branch/execute-post-upgrade-commands', () =>
|
|||
config
|
||||
);
|
||||
|
||||
expect(res.updatedArtifacts).toHaveLength(2);
|
||||
expect(res.updatedArtifacts).toHaveLength(3);
|
||||
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
|
||||
for (const file of config.updatedPackageFiles!.concat(updatedArtifacts)) {
|
||||
const canWriteFile = await localPathIsFile(file.path);
|
||||
if (file.type === 'addition' && canWriteFile) {
|
||||
if (file.type === 'addition' && !file.isSymlink && canWriteFile) {
|
||||
let contents: Buffer | null;
|
||||
if (typeof file.contents === 'string') {
|
||||
contents = Buffer.from(file.contents);
|
||||
|
|
Loading…
Reference in a new issue