🥇 export from upstream (b344870)
This commit is contained in:
@@ -256,8 +256,8 @@ pub fn build_run_args(
|
|||||||
// SSH mode-aware mount
|
// SSH mode-aware mount
|
||||||
match config.ssh_mode.as_deref() {
|
match config.ssh_mode.as_deref() {
|
||||||
Some("volume") => {
|
Some("volume") => {
|
||||||
args.push("--mount".to_string());
|
args.push("-v".to_string());
|
||||||
args.push("type=volume,source=sandcage-ssh,target=/home/agent/.ssh,readonly".to_string());
|
args.push("sandcage-ssh:/home/agent/.ssh:ro".to_string());
|
||||||
}
|
}
|
||||||
Some("bind") => {
|
Some("bind") => {
|
||||||
let mount = expand_mount_path("~/.ssh:/home/agent/.ssh:ro");
|
let mount = expand_mount_path("~/.ssh:/home/agent/.ssh:ro");
|
||||||
@@ -1015,12 +1015,14 @@ mod tests {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let args = build_run_args("claude", "/tmp/compose.yml", &config, false, &[]);
|
let args = build_run_args("claude", "/tmp/compose.yml", &config, false, &[]);
|
||||||
assert!(args.contains(&"--mount".to_string()));
|
let v_positions: Vec<_> = args.iter().enumerate()
|
||||||
let mount_idx = args.iter().position(|a| a == "--mount").unwrap();
|
.filter(|(_, a)| *a == "-v")
|
||||||
assert_eq!(
|
.map(|(i, _)| i)
|
||||||
args[mount_idx + 1],
|
.collect();
|
||||||
"type=volume,source=sandcage-ssh,target=/home/agent/.ssh,readonly"
|
let has_volume_mount = v_positions.iter().any(|&i| {
|
||||||
);
|
args.get(i + 1).map(|a| a == "sandcage-ssh:/home/agent/.ssh:ro").unwrap_or(false)
|
||||||
|
});
|
||||||
|
assert!(has_volume_mount, "should have sandcage-ssh volume mount, args: {:?}", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1053,7 +1055,7 @@ mod tests {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let args = build_run_args("claude", "/tmp/compose.yml", &config, false, &[]);
|
let args = build_run_args("claude", "/tmp/compose.yml", &config, false, &[]);
|
||||||
assert!(!args.contains(&"--mount".to_string()));
|
assert!(!args.iter().any(|a| a.contains("sandcage-ssh")));
|
||||||
assert!(!args.iter().any(|a| a.contains(".ssh")));
|
assert!(!args.iter().any(|a| a.contains(".ssh")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user