From 74fb3830822b64c20321e78bf1b3bca9fbaccf59 Mon Sep 17 00:00:00 2001 From: Jason LeBrun Date: Mon, 22 Jul 2024 22:41:04 +0000 Subject: [PATCH] Some fixes to cargo-related commands * Fix out-of-sync Cargo.lock file after 0c13105b * Fix the execution of the grep for workspace so it actually lists results. * Add git-diff-checks to Kokoro scripts to catch missing file updates. Change-Id: I451bc64c37973b4c016c2caf23d370485fc4bfa5 --- enclave_apps/Cargo.lock | 2 -- justfile | 15 ++++++++----- kokoro/build_binaries_oak_containers.sh | 1 + kokoro/build_binaries_rust.sh | 1 + kokoro/check_format.sh | 1 + kokoro/run_bazel_tests.sh | 1 + kokoro/run_cargo_deny.sh | 1 + kokoro/run_cargo_udeps.sh | 1 + kokoro/run_clippy.sh | 1 + kokoro/run_tests.sh | 1 + micro_rpc_workspace_test/Cargo.lock | 2 -- oak_restricted_kernel_bin/Cargo.lock | 19 ---------------- stage0_bin/Cargo.lock | 30 ------------------------- 13 files changed, 17 insertions(+), 59 deletions(-) diff --git a/enclave_apps/Cargo.lock b/enclave_apps/Cargo.lock index bca4bdf8ddc..c79e15bda02 100644 --- a/enclave_apps/Cargo.lock +++ b/enclave_apps/Cargo.lock @@ -860,8 +860,6 @@ dependencies = [ name = "oak_proto_rust" version = "0.0.1" dependencies = [ - "micro_rpc", - "micro_rpc_build", "prost", "prost-build", "prost-types", diff --git a/justfile b/justfile index 7239f2d4557..58415096d8e 100644 --- a/justfile +++ b/justfile @@ -9,7 +9,7 @@ export BAZEL_CONFIG_FLAG := if env_var_or_default('CI', '') == "" { "" } else { # Quick-and-dirty Cargo.toml workspace finder for cargo commands. # We plan to remove Cargo.toml files soon, and then this can go as well. -export CARGO_WORKSPACE_LIST_CMD := 'grep "\[workspace" **/Cargo.toml --exclude="third_party/*"' +export CARGO_WORKSPACE_LIST_CMD := 'grep -l "\[workspace" **/Cargo.toml --exclude="third_party/*"' key_xor_test_app: (build_enclave_app "key_xor_test_app") oak_echo_enclave_app: (build_enclave_app "oak_echo_enclave_app") @@ -293,22 +293,22 @@ clippy-ci: bazel-clippy cargo-clippy cargo-clippy: #!/bin/sh - for workspace in "$($CARGO_WORKSPACE_LIST_CMD)" + for workspace in $({{CARGO_WORKSPACE_LIST_CMD}}) do - env chdir=$workspace cargo-clippy --all-features --all-targets --no-deps -- --deny=warnings + env chdir=$workspace cargo clippy --all-features --all-targets --no-deps -- --deny=warnings done cargo-deny: #!/bin/sh - for workspace in "$($CARGO_WORKSPACE_LIST_CMD)" + for workspace in $({{CARGO_WORKSPACE_LIST_CMD}}) do - env chdir=$workspace cargo-deny check + env chdir=$workspace cargo deny check done cargo-udeps: #!/bin/sh - for workspace in "$($CARGO_WORKSPACE_LIST_CMD)" + for workspace in $({{CARGO_WORKSPACE_LIST_CMD}}) do env chdir=$workspace cargo udeps --all-targets --backend=depinfo --workspace done @@ -317,6 +317,9 @@ cargo-udeps: check-format-ci: bazel build --config=unsafe-fast-presubmit linter && bazel-bin/linter/linter --verbose +git-check-diff: + ./scripts/git_check_diff + # Temporary target to help debugging Bazel remote cache with more detailed logs. # It should be deleted when debugging is completed. # TODO: b/337266665 - Remove bazel-cache-test logic once we are satisfied with remote cache hits. diff --git a/kokoro/build_binaries_oak_containers.sh b/kokoro/build_binaries_oak_containers.sh index 70acfa29273..25c35d12ce4 100755 --- a/kokoro/build_binaries_oak_containers.sh +++ b/kokoro/build_binaries_oak_containers.sh @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#containers --command just kokoro_oak_containers +./scripts/git_check_diff mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/" cp --preserve=timestamps \ diff --git a/kokoro/build_binaries_rust.sh b/kokoro/build_binaries_rust.sh index abfc9b5b22e..505764aa727 100755 --- a/kokoro/build_binaries_rust.sh +++ b/kokoro/build_binaries_rust.sh @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#ci --command just kokoro_build_binaries_rust +./scripts/git_check_diff mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/" cp --preserve=timestamps \ diff --git a/kokoro/check_format.sh b/kokoro/check_format.sh index e077473f9f6..26c0df819ca 100755 --- a/kokoro/check_format.sh +++ b/kokoro/check_format.sh @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#ci --command just check-format-ci +./scripts/git_check_diff diff --git a/kokoro/run_bazel_tests.sh b/kokoro/run_bazel_tests.sh index b8c93f48364..7f84cb936e3 100755 --- a/kokoro/run_bazel_tests.sh +++ b/kokoro/run_bazel_tests.sh @@ -6,6 +6,7 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull # TODO: b/337266665 - Remove bazel-cache-test logic once we are satisfied with remote cache hits. ./scripts/docker_run nix develop .#ci --command just bazel-ci bazel-cache-test +./scripts/git_check_diff # Upload the bazel execution logs as Kokoro artifacts so we can debug remote cache. This should # be removed once the debugging is completed. We use the binaries folder only because it is diff --git a/kokoro/run_cargo_deny.sh b/kokoro/run_cargo_deny.sh index 9a12d6791f5..4d49f0b52a1 100755 --- a/kokoro/run_cargo_deny.sh +++ b/kokoro/run_cargo_deny.sh @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#ci --command just cargo-deny +./scripts/git_check_diff diff --git a/kokoro/run_cargo_udeps.sh b/kokoro/run_cargo_udeps.sh index db9f6c319b9..485e004a26a 100755 --- a/kokoro/run_cargo_udeps.sh +++ b/kokoro/run_cargo_udeps.sh @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#ci --command just cargo-udeps +./scripts/git_check_diff diff --git a/kokoro/run_clippy.sh b/kokoro/run_clippy.sh index fdb1a1b6b86..b565a3600f9 100755 --- a/kokoro/run_clippy.sh +++ b/kokoro/run_clippy.sh @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#ci --command just clippy-ci +./scripts/git_check_diff diff --git a/kokoro/run_tests.sh b/kokoro/run_tests.sh index 6911f7208dc..f72bfe09c35 100755 --- a/kokoro/run_tests.sh +++ b/kokoro/run_tests.sh @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh" ./scripts/docker_pull ./scripts/docker_run nix develop .#default --command just kokoro_run_tests +./scripts/git_check_diff mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/" cp --preserve=timestamps \ diff --git a/micro_rpc_workspace_test/Cargo.lock b/micro_rpc_workspace_test/Cargo.lock index 3d0e1d5a0ae..b6bd4086cfe 100644 --- a/micro_rpc_workspace_test/Cargo.lock +++ b/micro_rpc_workspace_test/Cargo.lock @@ -520,8 +520,6 @@ dependencies = [ name = "oak_proto_rust" version = "0.0.1" dependencies = [ - "micro_rpc", - "micro_rpc_build", "prost", "prost-build", "prost-types", diff --git a/oak_restricted_kernel_bin/Cargo.lock b/oak_restricted_kernel_bin/Cargo.lock index f86d62fec5a..c1643740f3d 100644 --- a/oak_restricted_kernel_bin/Cargo.lock +++ b/oak_restricted_kernel_bin/Cargo.lock @@ -634,23 +634,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "micro_rpc" -version = "0.1.0" -dependencies = [ - "async-trait", - "micro_rpc_build", - "prost", -] - -[[package]] -name = "micro_rpc_build" -version = "0.1.0" -dependencies = [ - "anyhow", - "prost-build", -] - [[package]] name = "multimap" version = "0.8.3" @@ -734,8 +717,6 @@ dependencies = [ name = "oak_proto_rust" version = "0.0.1" dependencies = [ - "micro_rpc", - "micro_rpc_build", "prost", "prost-build", "prost-types", diff --git a/stage0_bin/Cargo.lock b/stage0_bin/Cargo.lock index 7760099f07a..c84f048389b 100644 --- a/stage0_bin/Cargo.lock +++ b/stage0_bin/Cargo.lock @@ -52,17 +52,6 @@ version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" -[[package]] -name = "async-trait" -version = "0.1.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -510,23 +499,6 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" -[[package]] -name = "micro_rpc" -version = "0.1.0" -dependencies = [ - "async-trait", - "micro_rpc_build", - "prost", -] - -[[package]] -name = "micro_rpc_build" -version = "0.1.0" -dependencies = [ - "anyhow", - "prost-build", -] - [[package]] name = "multimap" version = "0.10.0" @@ -573,8 +545,6 @@ dependencies = [ name = "oak_proto_rust" version = "0.0.1" dependencies = [ - "micro_rpc", - "micro_rpc_build", "prost", "prost-build", "prost-types",