Skip to content

Commit 3bf7271

Browse files
committed
chore: enable buf lint test, full buildifier lint, and fix topologies link
TAG=agy CONV=ba8411ef-c093-4f45-950a-b3bc1899268c
1 parent 81b9dba commit 3bf7271

6 files changed

Lines changed: 65 additions & 6 deletions

File tree

‎.githooks/pre-commit‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ check_bazel() {
4444
bazel_files=$(find . -type f \( -name "BUILD" -o -name "BUILD.bazel" -o -name "*.bzl" -o -name "WORKSPACE" -o -name "MODULE.bazel" \) -not -path "*/node_modules/*")
4545
if [ -n "$bazel_files" ]; then
4646
if [ "$MODE" = "check" ]; then
47-
if ! $buildifier_bin -lint=warn -warnings=unused-variable -mode=check $bazel_files; then
47+
if ! $buildifier_bin -lint=warn -mode=check $bazel_files; then
4848
echo "❌ Bazel buildifier check failed."
4949
FAILED=1
5050
fi
5151
else
52-
$buildifier_bin -lint=fix -warnings=unused-variable -mode=fix $bazel_files
52+
$buildifier_bin -lint=fix -mode=fix $bazel_files
5353
fi
5454
fi
5555
}

‎.github/workflows/lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
fi
185185
mapfile -t BAZEL_FILES < <(find . -type f \( -name "BUILD" -o -name "BUILD.bazel" -o -name "*.bzl" -o -name "WORKSPACE" -o -name "MODULE.bazel" \) -not -path "*/node_modules/*" | sort)
186186
if [ "${#BAZEL_FILES[@]}" -gt 0 ]; then
187-
buildifier -lint=warn -warnings=unused-variable -mode=check "${BAZEL_FILES[@]}"
187+
buildifier -lint=warn -mode=check "${BAZEL_FILES[@]}"
188188
fi
189189
190190
- name: 'Install & Run addlicense'

‎api/BUILD.bazel‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
load("@rules_buf//buf:defs.bzl", "buf_breaking_test")
15+
load("@rules_buf//buf:defs.bzl", "buf_breaking_test", "buf_lint_test")
1616
load("@rules_proto//proto:defs.bzl", "proto_descriptor_set")
1717

1818
# Every //api proto_library. The `cloud_xmanager_v1_proto` targets duplicate
@@ -55,3 +55,10 @@ buf_breaking_test(
5555
limit_to_input_files = False,
5656
targets = _PROTOS,
5757
)
58+
59+
buf_lint_test(
60+
name = "protos_lint_test",
61+
config = "buf.yaml",
62+
error_format = "msvs",
63+
targets = _PROTOS,
64+
)

‎api/buf.yaml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,47 @@ breaking:
2323
# Off on purpose: components v1alpha1 messages are persisted with proto.Marshal
2424
# (internal/storage/data/component.go), so unstable packages must stay compatible.
2525
ignore_unstable_packages: false
26+
lint:
27+
use: [STANDARD]
28+
# Proto sources are grouped by service directory with distinct go_package/java options
29+
# even where messages share package cloud.xmanager.v1.
30+
except:
31+
- PACKAGE_DIRECTORY_MATCH
32+
- PACKAGE_SAME_DIRECTORY
33+
- PACKAGE_SAME_GO_PACKAGE
34+
- PACKAGE_SAME_JAVA_MULTIPLE_FILES
35+
ignore_only:
36+
ENUM_VALUE_PREFIX:
37+
- api/filter/filter_expression.proto
38+
- api/protos/task_queue/task.proto
39+
- xmanager_cloud/dashboard_service/proto/messages.proto
40+
- xmanager_cloud/experiment_state_server/proto/artifact.proto
41+
- xmanager_cloud/experiment_state_server/proto/experiment.proto
42+
- xmanager_cloud/experiment_state_server/proto/operations.proto
43+
- xmanager_cloud/experiment_state_server/proto/priority.proto
44+
- xmanager_cloud/experiment_state_server/proto/status.proto
45+
- xmanager_cloud/experiment_state_server/proto/structured_message.proto
46+
- xmanager_cloud/experiment_state_server/proto/study.proto
47+
- xmanager_cloud/experiment_state_server/proto/work_unit.proto
48+
- xmanager_cloud/experiment_state_server/proto/work_unit_execution.proto
49+
- xmanager_cloud/xid_service/proto/messages.proto
50+
ENUM_ZERO_VALUE_SUFFIX:
51+
- xmanager_cloud/dashboard_service/proto/messages.proto
52+
# TODO: Remove unused structured_message.proto import from api/protos/experiment/api.proto
53+
# when proto cleanup is scheduled (not modified here to preserve frozen API files).
54+
IMPORT_USED:
55+
- xmanager_cloud/experiment_state_server/proto/api.proto
56+
PACKAGE_VERSION_SUFFIX:
57+
- api/filter/filter_expression.proto
58+
RPC_REQUEST_RESPONSE_UNIQUE:
59+
- xmanager_cloud/dashboard_service/proto/dashboard_service.proto
60+
- xmanager_cloud/experiment_state_server/proto/api.proto
61+
- xmanager_cloud/xid_service/proto/api.proto
62+
RPC_REQUEST_STANDARD_NAME:
63+
- xmanager_cloud/experiment_state_server/proto/api.proto
64+
- xmanager_cloud/xid_service/proto/api.proto
65+
RPC_RESPONSE_STANDARD_NAME:
66+
- api/protos/health/api.proto
67+
- xmanager_cloud/dashboard_service/proto/dashboard_service.proto
68+
- xmanager_cloud/experiment_state_server/proto/api.proto
69+
- xmanager_cloud/xid_service/proto/api.proto

‎docs/design/topologies.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is the legacy/initial topology which uses:
1313
- **State & Messaging**: Uses Cloud Spanner for state storage, Memorystore Redis or Cloud Tasks for background queues, and Pub/Sub for log streams.
1414
- **DNS/IP**: Public IPs and Managed DNS zones.
1515

16-
For more details, see the [deploy/ctk_v1/README.md](../../deploy/ctk_v1/README.md).
16+
*(Cluster Toolkit Blueprint v1 has been deprecated and removed from this repository in favor of Blueprint v2 below.)*
1717

1818
---
1919

‎oci.bzl‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
"""Bazel macros for building and testing XMC service OCI container images."""
16+
1517
load("@rules_python//python:py_test.bzl", "py_test")
1618

1719
# go_binary gotags that compile in authentication bypasses and must never ship in an image.
@@ -60,6 +62,12 @@ def dev_binary_guard_test(name, binary, expect_dev_binary = False):
6062
)
6163

6264
def oci_image_for_service(name, binary):
65+
"""Defines loadable OCI tarball, push script, and dev-binary guard targets for a service.
66+
67+
Args:
68+
name: Base name for generated image tarball, push script, and guard test targets.
69+
binary: Label of the service go_binary target to package.
70+
"""
6371
dev_binary_guard_test(name = name + "_dev_binary_guard_test", binary = binary)
6472

6573
# Split binary name
@@ -77,7 +85,7 @@ def oci_image_for_service(name, binary):
7785
name = tarball_target,
7886
srcs = [binary],
7987
outs = [tarball_file],
80-
cmd = "python3 $(location //tools/common:build_oci.py) $< " + binary_name + " " + name + ":latest $@",
88+
cmd = "python3 $(execpath //tools/common:build_oci.py) $< " + binary_name + " " + name + ":latest $@",
8189
tools = ["//tools/common:build_oci.py"],
8290
visibility = ["//visibility:public"],
8391
)

0 commit comments

Comments
 (0)