From 640e54552aebe731d8714f07a695a65d30bc7052 Mon Sep 17 00:00:00 2001 From: D Tripp <38776199+thedtripp@users.noreply.github.com> Date: Sun, 30 Jun 2024 03:47:27 +0000 Subject: [PATCH 1/2] etcd 3.4: Install revive linter on CI if not installed. This is based on commit https://github.com/thedtripp/etcd/commit/4f238837aa1945919b197f300fe7fe244eac4d8c and pull request https://github.com/etcd-io/etcd/pull/14872. Signed-off-by: D Tripp <38776199+thedtripp@users.noreply.github.com> --- Makefile | 1 + test | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 16825e87ebd..686cf01a9c9 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ clean: rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:* rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:* rm -rf ./bin/shellcheck* + rm -rf ./bin/revive* docker-clean: docker images diff --git a/test b/test index a37cbaf4495..ab2345f4c96 100755 --- a/test +++ b/test @@ -39,6 +39,7 @@ source ./build PASSES=${PASSES:-} SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-"v0.10.0"} +REVIVE_VERSION=${REVIVE_VERSION:-"v1.3.7"} # build before setting up test GOPATH if [[ "${PASSES}" == *"functional"* ]]; then @@ -543,8 +544,27 @@ function staticcheck_pass { } function revive_pass { - if command -v revive >/dev/null; then - reviveResult=$(revive -config ./tests/revive.toml -exclude "vendor/..." ./... 2>&1 || true) + REVIVE=revive + + if ! command -v $REVIVE >/dev/null; then + echo "Installing revive $REVIVE_VERSION" + if [ "$GOARCH" == "amd64" ]; then + URL="https://github.com/mgechev/revive/releases/download/${REVIVE_VERSION}/revive_linux_amd64.tar.gz" + elif [[ "$GOARCH" == "arm" || "$GOARCH" == "arm64" ]]; then + URL="https://github.com/mgechev/revive/releases/download/${REVIVE_VERSION}/revive_linux_arm64.tar.gz" + else + echo "Unsupported architecture: $GOARCH" + exit 255 + fi + + wget -qO- "$URL" | tar -xzv -C /tmp/ > /dev/null + mkdir -p ./bin + mv /tmp/revive ./bin/ + REVIVE=./bin/revive + fi + + if command -v $REVIVE >/dev/null; then + reviveResult=$($REVIVE -config ./tests/revive.toml -exclude "vendor/..." ./... 2>&1 || true) if [ -n "${reviveResult}" ]; then echo -e "revive checking failed:\\n${reviveResult}" exit 255 From a72fe1b4c2b8b587538e8a60f85f461d8b4410e9 Mon Sep 17 00:00:00 2001 From: D Tripp <38776199+thedtripp@users.noreply.github.com> Date: Sun, 30 Jun 2024 04:43:46 +0000 Subject: [PATCH 2/2] etcd 3.4: Fix failing revive checks. Signed-off-by: D Tripp <38776199+thedtripp@users.noreply.github.com> --- clientv3/internal/endpoint/doc.go | 17 +++++++++++++++++ clientv3/internal/resolver/doc.go | 16 ++++++++++++++++ clientv3/naming/endpoints/doc.go | 17 +++++++++++++++++ clientv3/naming/endpoints/internal/doc.go | 17 +++++++++++++++++ clientv3/naming/resolver/doc.go | 16 ++++++++++++++++ etcdserver/cluster_util.go | 2 +- etcdserver/etcdserverpb/doc.go | 18 ++++++++++++++++++ etcdserver/verify/doc.go | 5 ++--- functional/rpcpb/doc.go | 17 +++++++++++++++++ pkg/grpc_testing/doc.go | 17 +++++++++++++++++ raft/confchange/doc.go | 16 ++++++++++++++++ raft/quorum/doc.go | 17 +++++++++++++++++ raft/raftpb/doc.go | 16 ++++++++++++++++ raft/tracker/doc.go | 18 ++++++++++++++++++ wal/walpb/doc.go | 17 +++++++++++++++++ 15 files changed, 222 insertions(+), 4 deletions(-) create mode 100644 clientv3/internal/endpoint/doc.go create mode 100644 clientv3/internal/resolver/doc.go create mode 100644 clientv3/naming/endpoints/doc.go create mode 100644 clientv3/naming/endpoints/internal/doc.go create mode 100644 clientv3/naming/resolver/doc.go create mode 100644 etcdserver/etcdserverpb/doc.go create mode 100644 functional/rpcpb/doc.go create mode 100644 pkg/grpc_testing/doc.go create mode 100644 raft/confchange/doc.go create mode 100644 raft/quorum/doc.go create mode 100644 raft/raftpb/doc.go create mode 100644 raft/tracker/doc.go create mode 100644 wal/walpb/doc.go diff --git a/clientv3/internal/endpoint/doc.go b/clientv3/internal/endpoint/doc.go new file mode 100644 index 00000000000..2d5150c47be --- /dev/null +++ b/clientv3/internal/endpoint/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package endpoint provides utilities for interpreting and handling etcd +// server endpoints with credential requirements. +package endpoint diff --git a/clientv3/internal/resolver/doc.go b/clientv3/internal/resolver/doc.go new file mode 100644 index 00000000000..b07c73ebc24 --- /dev/null +++ b/clientv3/internal/resolver/doc.go @@ -0,0 +1,16 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package resolver provides a manual resolver for etcd endpoints using gRPC. +package resolver diff --git a/clientv3/naming/endpoints/doc.go b/clientv3/naming/endpoints/doc.go new file mode 100644 index 00000000000..b03aab2d46f --- /dev/null +++ b/clientv3/naming/endpoints/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package endpoints provides utilities for managing and watching etcd endpoints, +// including functions to add, remove, and list endpoints stored in etcd. +package endpoints diff --git a/clientv3/naming/endpoints/internal/doc.go b/clientv3/naming/endpoints/internal/doc.go new file mode 100644 index 00000000000..3cd6709daa5 --- /dev/null +++ b/clientv3/naming/endpoints/internal/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal defines operations and structures for endpoint updates +// in etcd's storage system. +package internal diff --git a/clientv3/naming/resolver/doc.go b/clientv3/naming/resolver/doc.go new file mode 100644 index 00000000000..1e720b61a46 --- /dev/null +++ b/clientv3/naming/resolver/doc.go @@ -0,0 +1,16 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package resolver provides a gRPC resolver for discovering etcd endpoints. +package resolver diff --git a/etcdserver/cluster_util.go b/etcdserver/cluster_util.go index b67dab2b35a..c4dba5d8b92 100644 --- a/etcdserver/cluster_util.go +++ b/etcdserver/cluster_util.go @@ -242,7 +242,7 @@ func isCompatibleWithCluster(lg *zap.Logger, cl *membership.RaftCluster, local t Minor: maxV.Minor, } if nextClusterVersionCompatible { - maxV.Minor += 1 + maxV.Minor++ } return isCompatibleWithVers(lg, vers, local, minV, maxV) } diff --git a/etcdserver/etcdserverpb/doc.go b/etcdserver/etcdserverpb/doc.go new file mode 100644 index 00000000000..957c04f2170 --- /dev/null +++ b/etcdserver/etcdserverpb/doc.go @@ -0,0 +1,18 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package etcdserverpb provides protocol buffer types and utilities for etcd +// server operations, including custom stringers for redacting sensitive +// information in requests. +package etcdserverpb diff --git a/etcdserver/verify/doc.go b/etcdserver/verify/doc.go index 2c42bf6f198..d5fcc6bd89a 100644 --- a/etcdserver/verify/doc.go +++ b/etcdserver/verify/doc.go @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -package verify - -// verify package is analyzing persistent state of etcd to find potential +// Package verify is analyzing persistent state of etcd to find potential // inconsistencies. // In particular it covers cross-checking between different aspacts of etcd // storage like WAL & Backend. +package verify diff --git a/functional/rpcpb/doc.go b/functional/rpcpb/doc.go new file mode 100644 index 00000000000..632b2a74a48 --- /dev/null +++ b/functional/rpcpb/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package rpcpb provides gRPC-based utilities and functions for interacting +// with etcd members. +package rpcpb diff --git a/pkg/grpc_testing/doc.go b/pkg/grpc_testing/doc.go new file mode 100644 index 00000000000..68bb4ac7369 --- /dev/null +++ b/pkg/grpc_testing/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package grpc_testing provides utilities and helper functions for testing +// gRPC services, including a customizable StubServer for use in test cases. +package grpc_testing diff --git a/raft/confchange/doc.go b/raft/confchange/doc.go new file mode 100644 index 00000000000..3a205319245 --- /dev/null +++ b/raft/confchange/doc.go @@ -0,0 +1,16 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package confchange provides utilities for managing Raft configuration changes. +package confchange diff --git a/raft/quorum/doc.go b/raft/quorum/doc.go new file mode 100644 index 00000000000..5bdae10590e --- /dev/null +++ b/raft/quorum/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package quorum provides types and utilities for managing quorum-based +// voting and indexing in Raft. +package quorum diff --git a/raft/raftpb/doc.go b/raft/raftpb/doc.go new file mode 100644 index 00000000000..b633017747f --- /dev/null +++ b/raft/raftpb/doc.go @@ -0,0 +1,16 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package raftpb provides protocol buffer types for the Raft consensus algorithm. +package raftpb diff --git a/raft/tracker/doc.go b/raft/tracker/doc.go new file mode 100644 index 00000000000..41ad6843469 --- /dev/null +++ b/raft/tracker/doc.go @@ -0,0 +1,18 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package tracker provides utilities and data structures for tracking the +// progress and configuration of nodes within an etcd cluster, including +// vote tracking and configuration changes. +package tracker diff --git a/wal/walpb/doc.go b/wal/walpb/doc.go new file mode 100644 index 00000000000..73a1bc504ee --- /dev/null +++ b/wal/walpb/doc.go @@ -0,0 +1,17 @@ +// Copyright 2024 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package walpb provides protocol buffer definitions and utilities for +// working with etcd's Write-Ahead Log (WAL). +package walpb