diff --git a/Cargo.lock b/Cargo.lock index 686270645d..3138f67388 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6826,7 +6826,7 @@ dependencies = [ [[package]] name = "ya-exe-unit" -version = "0.1.4" +version = "0.1.5" dependencies = [ "actix", "actix-files", diff --git a/exe-unit/Cargo.toml b/exe-unit/Cargo.toml index 5782f2319b..a44e518c0c 100644 --- a/exe-unit/Cargo.toml +++ b/exe-unit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ya-exe-unit" -version = "0.1.4" +version = "0.1.5" authors = ["Golem Factory "] edition = "2018" diff --git a/exe-unit/examples/transfer.rs b/exe-unit/examples/transfer.rs index 2c807a0326..ec304cdc79 100644 --- a/exe-unit/examples/transfer.rs +++ b/exe-unit/examples/transfer.rs @@ -214,6 +214,7 @@ async fn main() -> anyhow::Result<()> { agreement, work_dir: work_dir.clone(), cache_dir, + runtime_args: Default::default(), #[cfg(feature = "sgx")] crypto: init_crypto()?, }; diff --git a/exe-unit/examples/transfer_abort.rs b/exe-unit/examples/transfer_abort.rs index 33da835381..feee69d754 100644 --- a/exe-unit/examples/transfer_abort.rs +++ b/exe-unit/examples/transfer_abort.rs @@ -172,6 +172,7 @@ async fn main() -> anyhow::Result<()> { agreement, work_dir, cache_dir, + runtime_args: Default::default(), #[cfg(feature = "sgx")] crypto: init_crypto()?, }; diff --git a/exe-unit/src/bin.rs b/exe-unit/src/bin.rs index 7f2d67042c..bc0ae50ec2 100644 --- a/exe-unit/src/bin.rs +++ b/exe-unit/src/bin.rs @@ -27,20 +27,28 @@ struct Cli { binary: PathBuf, #[structopt(flatten)] supervise: SuperviseCli, + /// Additional runtime arguments + #[structopt( + long, + short, + set = clap::ArgSettings::Global, + number_of_values = 1, + )] + runtime_arg: Vec, /// Enclave secret key used in secure communication #[structopt( - long, - env = "EXE_UNIT_SEC_KEY", - hide_env_values = true, - set = clap::ArgSettings::Global, + long, + env = "EXE_UNIT_SEC_KEY", + hide_env_values = true, + set = clap::ArgSettings::Global, )] sec_key: Option, /// Requestor public key used in secure communication #[structopt( - long, - env = "EXE_UNIT_REQUESTOR_PUB_KEY", - hide_env_values = true, - set = clap::ArgSettings::Global, + long, + env = "EXE_UNIT_REQUESTOR_PUB_KEY", + hide_env_values = true, + set = clap::ArgSettings::Global, )] requestor_pub_key: Option, #[structopt(subcommand)] @@ -51,17 +59,17 @@ struct Cli { struct SuperviseCli { /// Hardware resources are handled by the runtime #[structopt( - long = "runtime-managed-hardware", - alias = "cap-handoff", - parse(from_flag = std::ops::Not::not), - set = clap::ArgSettings::Global, + long = "runtime-managed-hardware", + alias = "cap-handoff", + parse(from_flag = std::ops::Not::not), + set = clap::ArgSettings::Global, )] hardware: bool, /// Images are handled by the runtime #[structopt( - long = "runtime-managed-image", - parse(from_flag = std::ops::Not::not), - set = clap::ArgSettings::Global, + long = "runtime-managed-image", + parse(from_flag = std::ops::Not::not), + set = clap::ArgSettings::Global, )] image: bool, } @@ -261,6 +269,7 @@ fn run() -> anyhow::Result<()> { agreement, work_dir, cache_dir, + runtime_args: cli.runtime_arg.clone(), acl: Default::default(), credentials: None, #[cfg(feature = "sgx")] diff --git a/exe-unit/src/lib.rs b/exe-unit/src/lib.rs index 8f2873bfac..5e08beb344 100644 --- a/exe-unit/src/lib.rs +++ b/exe-unit/src/lib.rs @@ -420,6 +420,7 @@ pub struct ExeUnitContext { pub agreement: Agreement, pub work_dir: PathBuf, pub cache_dir: PathBuf, + pub runtime_args: Vec, pub acl: Acl, pub credentials: Option, #[cfg(feature = "sgx")] diff --git a/exe-unit/src/runtime/process.rs b/exe-unit/src/runtime/process.rs index 4cceac6d29..1c53fea668 100644 --- a/exe-unit/src/runtime/process.rs +++ b/exe-unit/src/runtime/process.rs @@ -138,6 +138,8 @@ impl RuntimeProcess { } } + args.args(self.ctx.runtime_args.iter()); + Ok(args) } }