Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define example manifest files and add --watch flag #1105

Merged
merged 4 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
394 changes: 394 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ allow = [
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"BSD-2-Clause",
"CC0-1.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @conradgrobler I added this to the list of allowed licenses, as per go/thirdpartylicenses#unencumbered .

"MPL-2.0",
"ISC",
"MIT",
Expand Down
12 changes: 12 additions & 0 deletions examples/abitest/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name = "abitest"

[modules]
module_0 = { Cargo = { cargo_manifest = "examples/abitest/module_0/rust/Cargo.toml" } }
module_1 = { Cargo = { cargo_manifest = "examples/abitest/module_1/rust/Cargo.toml" } }

[clients]
cpp = { Bazel = { bazel_target = "//examples/abitest/client:client" }, additional_args = [
"--test_exclude=(Storage|GrpcServerServerStreamingMethod)",
"--cert_chain=../../../../../../../../examples/certs/local/local.pem",
"--private_key=../../../../../../../../examples/certs/local/local.key",
Comment on lines +10 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a minor thing, but the ../../../../../../../../ paths honestly confuse me so much. But I guess with us moving away from bazel that's a seperate thing. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's orthogonal to this change, please ignore for now :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this since it's not actionable, but purely to satisfy my curiosity,:

This basically navigates us out of the bazel runner directory and back into the working directory to load the certs, right? Had we considered instead copying the certs in into the bazel runner dir with a build rule?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, bazel artifacts are nested deep inside the guts of bazel cache.

I don't think it's possible to just copy additional stuff in the cache folder, but I haven't looked into it closely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen some examples do it, but yeah don't know what's best practice. Relying on the cache path seems a bit like using internals, not APIs, but thankfully I'm told we're moving away from bazel anyway. :)

] }
10 changes: 10 additions & 0 deletions examples/aggregator/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = "aggregator"

[modules]
module = { Cargo = { cargo_manifest = "examples/aggregator/module/rust/Cargo.toml" } }

[clients]
cpp = { Bazel = { bazel_target = "//examples/aggregator/client:client" }, additional_args = [
"--bucket=test",
"--data=1:10,2:20,3:30"
] }
9 changes: 9 additions & 0 deletions examples/chat/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "chat"

[modules]
module = { Cargo = { cargo_manifest = "examples/chat/module/rust/Cargo.toml" } }

[clients]
cpp = { Bazel = { bazel_target = "//examples/chat/client:client" }, additional_args = [
"--test"
] }
8 changes: 8 additions & 0 deletions examples/hello_world/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "hello_world"

[modules]
module = { Cargo = { cargo_manifest = "examples/hello_world/module/rust/Cargo.toml" } }
translator = { Cargo = { cargo_manifest = "examples/translator/module/rust/Cargo.toml" } }

[clients]
cpp = { Bazel = { bazel_target = "//examples/hello_world/client:client" } }
7 changes: 7 additions & 0 deletions examples/machine_learning/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name = "machine_learning"

[modules]
module = { Cargo = { cargo_manifest = "examples/machine_learning/module/rust/Cargo.toml" } }

[clients]
cpp = { Bazel = { bazel_target = "//examples/machine_learning/client:client" } }
8 changes: 6 additions & 2 deletions runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ license = "Apache-2.0"

[dependencies]
colored = "*"
walkdir = "*"
structopt = "*"
nix = "*"
notify = "5.0.0-pre.2"
serde = { version = "*", features = ["derive"] }
spinners = "*"
structopt = "*"
toml = "*"
walkdir = "*"
8 changes: 6 additions & 2 deletions runner/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use structopt::StructOpt;
pub struct Opt {
#[structopt(long, help = "do not execute commands")]
dry_run: bool,
#[structopt(long, help = "re-run commands on file changes")]
pub watch: bool,
#[structopt(long, help = "print commands")]
commands: bool,
#[structopt(long, help = "show logs of commands")]
Expand Down Expand Up @@ -89,7 +91,7 @@ impl Context {
fn child(&self, prefix: &str) -> Self {
Context {
opt: self.opt.clone(),
prefix: format!("{} {}", self.prefix, prefix),
prefix: format!("{} {}", self.prefix, prefix),
}
}
}
Expand Down Expand Up @@ -234,7 +236,9 @@ pub fn run_step(context: &Context, step: &Step) -> HashSet<StatusResultValue> {
"{} ⊢ {} (finished) {}",
context.prefix, background_command, background_status.value
);
if (background_status.value == StatusResultValue::Error || context.opt.logs)
if (background_status.value == StatusResultValue::Error
|| values.contains(&StatusResultValue::Error)
|| context.opt.logs)
&& !background_status.logs.is_empty()
{
eprintln!("{} {}", context.prefix, "╔════════════════════════".blue());
Expand Down
Loading