fix: only create shared dir symlink if not exists

This commit is contained in:
Ruben Fiszel
2024-02-07 00:42:23 +01:00
parent 0178d26271
commit 1ed9901aec
3 changed files with 15 additions and 13 deletions
+12 -10
View File
@@ -1522,17 +1522,19 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
let target = &format!("{job_dir}/shared");
if same_worker && job.parent_job.is_some() {
let parent_flow = job.parent_job.unwrap();
let parent_shared_dir = format!("{worker_dir}/{parent_flow}/shared");
DirBuilder::new()
.recursive(true)
.create(&parent_shared_dir)
.await
.expect("could not create parent shared dir");
if tokio::fs::metadata(target).await.is_err() {
let parent_flow = job.parent_job.unwrap();
let parent_shared_dir = format!("{worker_dir}/{parent_flow}/shared");
DirBuilder::new()
.recursive(true)
.create(&parent_shared_dir)
.await
.expect("could not create parent shared dir");
symlink(&parent_shared_dir, target)
.await
.expect("could not symlink target");
symlink(&parent_shared_dir, target)
.await
.expect("could not symlink target");
}
} else {
DirBuilder::new()
.recursive(true)
@@ -440,7 +440,7 @@
x.value.hash = undefined
}
})
return flow.value
return { summary: flow.summary, description: flow.description, value: flow.value }
} else if (kind == 'script') {
const script = await ScriptService.getScriptByPath({
workspace: workspace,
@@ -559,7 +559,7 @@
{@const statusPath = computeStatusPath(kind, path)}
<div class="col-span-1 truncate text-secondary text-sm pt-0.5">{kind}</div><div
class="col-span-5 truncate font-semibold">{path}</div
><div class="col-span-1"><Toggle size="xs" bind:checked={include} /></div><div
><div class="col-span-1 pt-1.5"><Toggle size="xs" bind:checked={include} /></div><div
class="col-span-1"
>
{#if allAlreadyExists[statusPath] == false}
@@ -19,7 +19,7 @@
</script>
<Drawer bind:this={drawer} size="900px">
<DrawerContent title="Deploy {initialPath} to staging or prod" on:close={drawer.closeDrawer}>
<DrawerContent title="Deploy {initialPath}" on:close={drawer.closeDrawer}>
{#if kind != undefined && initialPath != undefined}
<DeployWorkspace
hideButton