fixed ssh-port & rsync address + added env to Remote

pull/17/head
ZSchoen 3 years ago
parent 9955b75ae8
commit 22e98e4555

@ -6,6 +6,7 @@ pub struct Remote {
pub host: String,
pub ssh_port: u16,
pub temp_dir: String,
pub env: String,
}
#[derive(Debug, Deserialize)]
@ -14,6 +15,7 @@ struct PartialRemote {
pub host: String,
pub ssh_port: Option<u16>,
pub temp_dir: Option<String>,
pub env: Option<String>,
}
impl Default for Remote {
@ -23,6 +25,7 @@ impl Default for Remote {
host: String::new(),
ssh_port: 22,
temp_dir: "~/remote-builds".to_string(),
env: "/etc/profile".to_string(),
}
}
}
@ -33,11 +36,13 @@ impl From<PartialRemote> for Remote {
let name = minimal_remote.name.unwrap_or(default.name);
let ssh_port = minimal_remote.ssh_port.unwrap_or(default.ssh_port);
let temp_dir = minimal_remote.temp_dir.unwrap_or(default.temp_dir);
let env = minimal_remote.env.unwrap_or(default.env);
Remote {
name,
host: minimal_remote.host,
ssh_port,
temp_dir,
env,
}
}
}
@ -96,6 +101,7 @@ impl Config {
host: opts.host.clone().unwrap_or(blueprint_remote.host),
ssh_port: opts.ssh_port.clone().unwrap_or(blueprint_remote.ssh_port),
temp_dir: opts.temp_dir.clone().unwrap_or(blueprint_remote.temp_dir),
env: opts.env.clone().unwrap_or(blueprint_remote.env),
})
}
}

@ -27,6 +27,13 @@ pub struct RemoteOpts {
/// The directory where cargo builds the project
#[structopt(short, long = "remote-temp-dir")]
temp_dir: Option<String>,
#[structopt(
short = "e",
long = "env",
help = "Environment profile. default_value = /etc/profile"
)]
env: Option<String>,
}
#[derive(StructOpt, Debug)]
@ -53,14 +60,6 @@ enum Opts {
)]
rustup_default: String,
#[structopt(
short = "e",
long = "env",
help = "Environment profile. default_value = /etc/profile",
default_value = "/etc/profile"
)]
env: String,
#[structopt(
short = "c",
long = "copy-back",
@ -107,7 +106,6 @@ fn main() {
remote_opts,
build_env,
rustup_default,
env,
copy_back,
no_copy_lock,
manifest_path,
@ -153,7 +151,8 @@ fn main() {
.arg("-a".to_owned())
.arg("--delete")
.arg("--compress")
.args(&["-e", "ssh", "-p", &remote.ssh_port.to_string()])
.arg("-e")
.arg(format!("ssh -p {}", remote.ssh_port))
.arg("--info=progress2")
.arg("--exclude")
.arg("target");
@ -176,11 +175,11 @@ fn main() {
exit(-4);
});
info!("Build ENV: {:?}", build_env);
info!("Environment profile: {:?}", env);
info!("Environment profile: {:?}", remote.env);
info!("Build path: {:?}", build_path);
let build_command = format!(
"source {}; rustup default {}; cd {}; {} cargo {} {}",
env,
remote.env,
rustup_default,
build_path,
build_env,
@ -210,11 +209,12 @@ fn main() {
.arg("-a")
.arg("--delete")
.arg("--compress")
.args(&["-e", "ssh", "-p", &remote.ssh_port.to_string()])
.arg("-e")
.arg(format!("ssh -p {}", remote.ssh_port))
.arg("--info=progress2")
.arg("--info=progress2")
.arg(format!(
"{}:{}/target/{}",
"{}:{}target/{}",
build_server, build_path, file_name
))
.arg(format!(
@ -241,10 +241,11 @@ fn main() {
.arg("-a")
.arg("--delete")
.arg("--compress")
.args(&["-e", "ssh", "-p", &remote.ssh_port.to_string()])
.arg("-e")
.arg(format!("ssh -p {}", remote.ssh_port))
.arg("--info=progress2")
.arg("--info=progress2")
.arg(format!("{}:{}/Cargo.lock", build_server, build_path))
.arg(format!("{}:{}Cargo.lock", build_server, build_path))
.arg(format!("{}/Cargo.lock", project_dir.to_string_lossy()))
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())

Loading…
Cancel
Save