Skip to content

Commit 503b8fa

Browse files
committed
fix: add implicit work volume mounted at /work - user definition takes preference
1 parent 8131eac commit 503b8fa

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/api/volume.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,15 @@ impl<'a> VolumeApi<'a> {
105105
mounts: &HashMap<String, String>,
106106
) -> HashMap<TargetPath, DataEntryVolumeSpec> {
107107
let mut result = HashMap::new();
108-
for (target, source_key) in mounts {
108+
109+
let mut mount_entries: HashMap<String, String> = HashMap::new();
110+
mount_entries.extend(mounts.clone());
111+
112+
if !mounts.values().any(|key| key == "work") {
113+
mount_entries.insert("/work".to_string(), "work".to_string());
114+
}
115+
116+
for (target, source_key) in mount_entries {
109117
let source_key = DataEntryKey(source_key.to_string());
110118
let source_exists = volumes.contains_key(&source_key);
111119
if !source_exists {
@@ -133,6 +141,12 @@ impl<'a> VolumeApi<'a> {
133141
let mut data_entries = vec![];
134142
data_entries.extend_from_slice(data.clone().into_entries().as_slice());
135143

144+
if !data.contains_key("work") {
145+
data_entries.push(DataEntry::Dir {
146+
name: "work".to_string(),
147+
});
148+
}
149+
136150
let files_key = "files";
137151
let files_volume_spec = VolumeSpec {
138152
name: Self::volume_name(workspace_key, files_key),

src/model/volume.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl RoozVolume {
8686
RoozVolume {
8787
sharing: RoozVolumeSharing::Exclusive { key },
8888
..
89-
} => format!("rooz_{}_{}", sanitize(&key), &role_segment),
89+
} => format!("rooz-{}-{}", sanitize(&key), &role_segment),
9090
RoozVolume { .. } => format!("rooz_{}", &role_segment),
9191
}
9292
}

0 commit comments

Comments
 (0)