fix: Only delete id.rsa in case of it exists
This commit is contained in:
parent
5089c843b6
commit
73fc9755dd
1 changed files with 6 additions and 2 deletions
|
|
@ -122,7 +122,9 @@ buildWorker.on('completed', async (job: Bullmq.Job) => {
|
||||||
} finally {
|
} finally {
|
||||||
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
||||||
await asyncExecShell(`rm -fr ${workdir}`);
|
await asyncExecShell(`rm -fr ${workdir}`);
|
||||||
await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`);
|
await asyncExecShell(
|
||||||
|
`test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
@ -136,7 +138,9 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
|
||||||
} finally {
|
} finally {
|
||||||
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
||||||
await asyncExecShell(`rm -fr ${workdir}`);
|
await asyncExecShell(`rm -fr ${workdir}`);
|
||||||
await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`);
|
await asyncExecShell(
|
||||||
|
`test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id });
|
saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id });
|
||||||
saveBuildLog({
|
saveBuildLog({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue