-
Notifications
You must be signed in to change notification settings - Fork 396
chore: support allocating testnets to the local DC #10122
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
base: master
Are you sure you want to change the base?
Changes from all commits
e9c2625
843e0c9
9a878ba
a4157cf
47e971b
b71a39f
fb2094a
3a63084
a415d64
4e15a93
a896b76
57abc75
2751444
afe5159
65896d0
700dedd
22dc1c3
f4ce2ab
4fbfba9
4f02028
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag") | ||
| load("@buildifier_prebuilt//:rules.bzl", "buildifier") | ||
| load("//bazel:defs.bzl", "write_info_file_var") | ||
| load("//bazel:defs.bzl", "volatile_status", "write_info_file_var") | ||
|
|
||
| bool_flag( | ||
| name = "enable_malicious_code", | ||
|
|
@@ -72,6 +72,47 @@ write_info_file_var( | |
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| # This is the contents of the ctx.version_file, i.e. all non-STABLE_, | ||
| # volatile key value pairs outputted from ./workspace_status.sh. | ||
| # | ||
| # A note on the cache semantics: | ||
| # Say we have the following target that just saves the output of | ||
| # :volatile-status.txt to its output file: | ||
| # | ||
| # genrule( | ||
| # name = "what-is-volatile-status", | ||
| # outs = ["what-is-volatile-status.txt"], | ||
| # cmd = "cat $(location :volatile-status.txt) > $@", | ||
| # tools = [":volatile-status.txt"], | ||
| # ) | ||
| # | ||
| # Building this in a fresh container yields: | ||
| # ./ci/container/container-run.sh bash -c \ | ||
| # 'NODE_NAME=dm1-dll01 bazel build //bazel:what-is-volatile-status && cat bazel-bin/bazel/what-is-volatile-status.txt' | ||
| # BUILD_TIMESTAMP 1778503046 | ||
| # DC dm1 | ||
| # FORMATTED_DATE 2026 May 11 12 37 26 Mon | ||
| # | ||
| # The //bazel:what-is-volatile-status target should now be cached so changing the volatile keys | ||
| # should not change the output when we build it again (note we changed NODE_NAME to zh1): | ||
| # ./ci/container/container-run.sh bash -c \ | ||
| # 'NODE_NAME=zh1-dll01 bazel build //bazel:what-is-volatile-status && cat bazel-bin/bazel/what-is-volatile-status.txt' | ||
| # BUILD_TIMESTAMP 1778503046 | ||
| # DC dm1 | ||
| # FORMATTED_DATE 2026 May 11 12 37 26 Mon | ||
| # | ||
| # However, let's say we change the what-is-volatile-status target such that it has to run again | ||
| # and use the new volatile keys. Then we would expect the output to change: | ||
| # ./ci/container/container-run.sh bash -c \ | ||
| # 'NODE_NAME=zh1-dll01 bazel build //bazel:what-is-volatile-status && cat bazel-bin/bazel/what-is-volatile-status.txt' | ||
| # BUILD_TIMESTAMP 1778503130 | ||
| # DC zh1 | ||
| # FORMATTED_DATE 2026 May 11 12 38 50 Mon | ||
| volatile_status( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should keep
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean here. WDYM with "both"? Note that we use the volatile status for both the DC and the FARM_METADATA. |
||
| name = "volatile-status.txt", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| exports_files( | ||
| [ | ||
| "prost_generator.sh", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,12 @@ else | |
| fi | ||
|
|
||
| # Used as farm metadata | ||
| STABLE_FARM_METADATA="USER=${USER:-${HOSTUSER:-$(whoami)}}" | ||
| FARM_METADATA="USER=${USER:-${HOSTUSER:-$(whoami)}}" | ||
| if [ -n "${CI_JOB_NAME:-}" ]; then | ||
| STABLE_FARM_METADATA="$STABLE_FARM_METADATA;JOB_NAME=$CI_JOB_NAME" | ||
| FARM_METADATA="$FARM_METADATA;JOB_NAME=$CI_JOB_NAME" | ||
| fi | ||
| echo "STABLE_FARM_METADATA $STABLE_FARM_METADATA" | ||
| echo "FARM_METADATA $FARM_METADATA" | ||
|
|
||
| # Used for allocating a Farm testnet to the local DC in CI (Search for allocate_testnet_to_local_dc) | ||
| NODE_NAME="${NODE_NAME:-unknown}" | ||
| echo "DC ${NODE_NAME%%-*}" | ||
|
Comment on lines
+31
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assumes that the node name is always prefixed with
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, the assumption breaks for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I can add a node that the DC will be everything up to the first |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,7 @@ done | |
|
|
||
| exec \ | ||
| env -C "$TEST_TMPDIR" \ | ||
| VOLATILE_STATUS_FILE="$(realpath "$VOLATILE_STATUS_FILE")" \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At this point could we already read out the farm metadata and only set that, instead of silently passing the whole volatile status? Same with
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I guess we could do the parsing in bash rather than in Rust. |
||
| "$(realpath $RUN_SCRIPT_TEST_EXECUTABLE)" \ | ||
| --working-dir "$TEST_TMPDIR" \ | ||
| "${test_driver_extra_args[@]}" \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,8 +132,6 @@ def system_test( | |
| _runtime_deps |= icos_config.runtime_deps | ||
| icos_images |= icos_config.icos_images | ||
|
|
||
| env_var_files["FARM_METADATA"] = "//rs/tests:farm_metadata.txt" | ||
|
|
||
| extra_args_simple = [] | ||
| extra_args_colocated = [] | ||
|
|
||
|
|
@@ -210,6 +208,14 @@ def system_test( | |
|
|
||
| tags = tags + ["requires-network", "system_test"] | ||
|
|
||
| # VOLATILE_STATUS_FILE is read during group creation time to determine the required host features and Farm metadata. | ||
| # In colocated tests the group is created in the non-colocated wrapper driver, we shouldn't use runtime_deps | ||
| # to depend on the VOLATILE_STATUS_FILE since that will cause the variable to be repointed to a path on the colocated VM | ||
| # which won't exist during group creaton time on the non-colocated wrapper. Instead we pass it as a regular environment variable | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you prefix it with |
||
| # and repoint it to its realpath in ./run_systest.sh. | ||
| env["VOLATILE_STATUS_FILE"] = "$(rootpath //bazel:volatile-status.txt)" | ||
| data.append("//bazel:volatile-status.txt") | ||
|
|
||
| sh_test( | ||
| name = test_name, | ||
| srcs = ["//rs/tests:run_systest.sh"], | ||
|
|
@@ -225,8 +231,6 @@ def system_test( | |
| visibility = visibility, | ||
| ) | ||
|
|
||
| COLOCATED_RUNTIME_DEP_ENV_VARS = RUN_SCRIPT_RUNTIME_DEP_ENV_VARS | ||
|
|
||
| # create a colocated version of the test (marked as manual _unless_ the test is tagged with "colocate") | ||
| sh_test( | ||
| srcs = ["//rs/tests:run_systest.sh"], | ||
|
|
@@ -239,7 +243,6 @@ def system_test( | |
| env = env | { | ||
| "RUN_SCRIPT_TEST_EXECUTABLE": "$(rootpath //rs/tests/idx:colocate_test_bin)", | ||
| "RUN_SCRIPT_DRIVER_EXTRA_ARGS": " ".join(extra_args_colocated), | ||
| "COLOCATED_RUNTIME_DEP_ENV_VARS": COLOCATED_RUNTIME_DEP_ENV_VARS, | ||
| "COLOCATED_UVM_CONFIG_IMAGE_PATH": "$(rootpath //rs/tests:colocate_uvm_config_image)", | ||
| "COLOCATED_TEST_NAME": test_name, | ||
| "COLOCATED_TEST_DRIVER_VM_REQUIRED_HOST_FEATURES": json.encode(colocated_test_driver_vm_required_host_features), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be compacted a bit, it's a lot to read. I think it's enough to point out that
volatile-status.txthas to be a direct dependency, and when it is so then it behaves somewhat magically.