Commit Graph

683 Commits (40f71ef3c60217f2a394c43ecb1b9d388a3b66d2)

Author SHA1 Message Date
Wei Fu b4f49a55a5 chore: deprecate github.com/hexfusion/schwag
The schwag was introduced to generate swagger with authorization support
[1][1] in 2017. And in 2018, the grpc-gateway supports to render
security fields by protoc-gen-swagger [2][2]. After several years, I
think it's good to use upstream protoc supports.

NOTE:

The json's key in `rpc.swagger.json` has been reordered so that it seems
that there's a lot of changes. How to verify it:

```bash
$ # use jq -S to sort the key
$ latest_commit="https://raw.githubusercontent.com/etcd-io/etcd/228f493c7697ce3e9d3a1d831bcffad175846c75/Documentation/dev-guide/apispec/swagger/rpc.swagger.json"
$ curl -s "${latest_commit}"  | jq -S . > /tmp/old.json
$ cat Documentation/dev-guide/apispec/swagger/rpc.swagger.json | jq -S . > /tmp/new.json
$ diff --color -u /tmp/old.json /tmp/new.json
```

```diff
--- /tmp/old.json       2023-04-26 10:58:07.142311861 +0800
+++ /tmp/new.json       2023-04-26 10:58:12.170299194 +0800
@@ -1523,11 +1523,14 @@
       "type": "object"
     },
     "protobufAny": {
+      "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n    Foo foo = ...;\n    Any any;\n    any.PackFrom(foo);\n    ...\n    if (any.UnpackTo(&foo)) {\n      ...\n    }\n\nExample 2: Pack and unpack a message in Java.\n\n    Foo foo = ...;\n    Any any = Any.pack(foo);\n    ...\n    if (any.is(Foo.class)) {\n      foo = any.unpack(Foo.class);\n    }\n\n Example 3: Pack and unpack a message in Python.\n\n    foo = Foo(...)\n    any = Any()\n    any.Pack(foo)\n    ...\n    if any.Is(Foo.DESCRIPTOR):\n      any.Unpack(foo)\n      ...\n\n Example 4: Pack and unpack a message in Go\n\n     foo := &pb.Foo{...}\n     any, err := ptypes.MarshalAny(foo)\n     ...\n     foo := &pb.Foo{}\n     if err := ptypes.UnmarshalAny(any, foo); err != nil {\n       ...\n     }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n    package google.profile;\n    message Person {\n      string first_name = 1;\n      string last_name = 2;\n    }\n\n    {\n      \"@type\": \"type.googleapis.com/google.profile.Person\",\n      \"firstName\": <string>,\n      \"lastName\": <string>\n    }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n    {\n      \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n      \"value\": \"1.212s\"\n    }",
       "properties": {
         "type_url": {
+          "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n  value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n  URL, or have them precompiled into a binary to avoid any\n  lookup. Therefore, binary compatibility needs to be preserved\n  on changes to types. (Use versioned type names to manage\n  breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics.",
           "type": "string"
         },
         "value": {
+          "description": "Must be a valid serialized protocol buffer of the above specified type.",
           "format": "byte",
           "type": "string"
         }
```

REF:

1: <https://github.com/etcd-io/etcd/pull/7999#issuecomment-307512043>
2: <https://github.com/grpc-ecosystem/grpc-gateway/pull/547>

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-04-26 11:14:50 +08:00
Wei Fu aa787d9f51 dependency: bump github.com/alexkohler/nakedret from 1.0.1 to 1.0.2
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-04-25 14:44:34 +08:00
James Blair aad63a1efe
dependency: bump github.com/mikefarah/yq/v4 from 4.33.1 to 4.33.3
Signed-off-by: James Blair <mail@jamesblair.net>
2023-04-21 05:40:03 +12:00
James Blair 04f3e9cb9a
dependency: bump golang.org/x/crypto from 0.7.0 to 0.8.0
Signed-off-by: James Blair <mail@jamesblair.net>
2023-04-21 05:34:21 +12:00
Wei Fu 9f034fbaa8 chore: use tools/mod to lock the cfssl cmd version
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-04-13 12:06:31 +08:00
Benjamin Wang ff08625126 dedpendency: bump gotest.tools/gotestsum from 1.9.0 to 1.10.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-11 08:56:09 +08:00
Benjamin Wang dddd4780c2 dependency: bump github.com/spf13/cobra from 1.6.1 to 1.7.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-11 08:51:26 +08:00
Benjamin Wang eb9b15bf49 dependency: bump golang.org/x/net from 0.8.0 to 0.9.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-11 08:44:26 +08:00
Benjamin Wang 072c5cb5da dependency: bump google.golang.org/protobuf from 1.28.1 to 1.30.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-04 15:28:09 +08:00
Benjamin Wang 56284d5dfe dependency: bump github.com/golang/protobuf from 1.5.2 to 1.5.3
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-04-04 15:21:22 +08:00
dependabot[bot] 2ca482a761
build(deps): bump github.com/mikefarah/yq/v4 in /tools/mod
Bumps [github.com/mikefarah/yq/v4](https://github.com/mikefarah/yq) from 4.31.2 to 4.33.1.
- [Release notes](https://github.com/mikefarah/yq/releases)
- [Changelog](https://github.com/mikefarah/yq/blob/master/release_notes.txt)
- [Commits](https://github.com/mikefarah/yq/compare/v4.31.2...v4.33.1)

---
updated-dependencies:
- dependency-name: github.com/mikefarah/yq/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 17:58:43 +00:00
Benjamin Wang 08471cddfd
Merge pull request #15519 from fuweid/remove-tee-in-ci
chore: introduce strict bash mode for scripts,.github
2023-03-23 06:28:02 +08:00
Wei Fu 1fcb782780 chore: introduce strict bash mode for scripts,.github
REF: #15514

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-22 18:00:41 +08:00
Benjamin Wang 1b2b89e378 dependency: bump github.com/mgechev/revive to 1.3.1 and honnef.co/go/tools to 0.4.3
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-21 08:36:39 +08:00
dependabot[bot] 263dc15a38
build(deps): bump github.com/mikefarah/yq/v4 in /tools/mod
Bumps [github.com/mikefarah/yq/v4](https://github.com/mikefarah/yq) from 4.31.1 to 4.31.2.
- [Release notes](https://github.com/mikefarah/yq/releases)
- [Changelog](https://github.com/mikefarah/yq/blob/master/release_notes.txt)
- [Commits](https://github.com/mikefarah/yq/compare/v4.31.1...v4.31.2)

---
updated-dependencies:
- dependency-name: github.com/mikefarah/yq/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-14 00:40:03 +00:00
Marek Siarkowicz 372042c374 refactor: Use proper variable names for urls
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-03-13 14:48:01 +01:00
Benjamin Wang 7ed1219861 dependency: bump golang.org/x/net to v0.8.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-03-07 06:52:07 +08:00
dependabot[bot] 7dfd29b0cc build(deps): bump github.com/mikefarah/yq/v4 in /tools/mod
Bumps [github.com/mikefarah/yq/v4](https://github.com/mikefarah/yq) from 4.30.8 to 4.31.1.
- [Release notes](https://github.com/mikefarah/yq/releases)
- [Changelog](https://github.com/mikefarah/yq/blob/master/release_notes.txt)
- [Commits](https://github.com/mikefarah/yq/compare/v4.30.8...v4.31.1)

---
updated-dependencies:
- dependency-name: github.com/mikefarah/yq/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 07:50:45 +08:00
dependabot[bot] 66efadb8fb build(deps): bump honnef.co/go/tools from 0.4.0 to 0.4.2 in /tools/mod
Bumps [honnef.co/go/tools](https://github.com/dominikh/go-tools) from 0.4.0 to 0.4.2.
- [Release notes](https://github.com/dominikh/go-tools/releases)
- [Commits](https://github.com/dominikh/go-tools/compare/v0.4.0...v0.4.2)

---
updated-dependencies:
- dependency-name: honnef.co/go/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 05:23:04 +08:00
Benjamin Wang a7e94c4843 security: bump golang.org/x/net to v0.7.0 to address CVE GO-2023-1571
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-02-17 11:29:47 +08:00
dependabot[bot] 8f54d38b6c build(deps): bump honnef.co/go/tools from 0.3.3 to 0.4.0 in /tools/mod
Bumps [honnef.co/go/tools](https://github.com/dominikh/go-tools) from 0.3.3 to 0.4.0.
- [Release notes](https://github.com/dominikh/go-tools/releases)
- [Commits](https://github.com/dominikh/go-tools/compare/v0.3.3...v0.4.0)

---
updated-dependencies:
- dependency-name: honnef.co/go/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-07 06:29:36 +08:00
dependabot[bot] aba0f91167 build(deps): bump github.com/mgechev/revive in /tools/mod
Bumps [github.com/mgechev/revive](https://github.com/mgechev/revive) from 1.2.4 to 1.2.5.
- [Release notes](https://github.com/mgechev/revive/releases)
- [Changelog](https://github.com/mgechev/revive/blob/master/.goreleaser.yml)
- [Commits](https://github.com/mgechev/revive/compare/v1.2.4...v1.2.5)

---
updated-dependencies:
- dependency-name: github.com/mgechev/revive
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 05:43:34 +08:00
Benjamin Wang b9b7c9328e tools: fix the CSV format error and add build target 'tools' in Makefile
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-30 16:35:41 +08:00
Benjamin Wang 0d7b624fae dependency: bump github.com/google/addlicense from 1.1.0 to 1.1.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-24 16:59:37 +08:00
Benjamin Wang b2d482e6da dependency: bump gotest.tools/gotestsum from v1.8.2 to v1.9.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-17 06:39:26 +08:00
Benjamin Wang 575ceed1c7 dependency: bump github.com/mikefarah/yq/v4 from v4.30.6 to v4.30.8
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-17 06:33:05 +08:00
Benjamin Wang 5ef713c728 remove the dependency on the deprecated io/ioutil
Reference: https://go.dev/doc/go1.16#ioutil

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-08 04:55:40 +08:00
Benjamin Wang bd9f1584d4 process the scenaro of the last WAL record being partially synced to disk
We need to return io.ErrUnexpectedEOF in the error chain, so that
etcdserver can repair it automatically.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-08 04:46:51 +08:00
Piotr Tabor 007858dc97 etcd-dump-logs: Migrate from zap to log for raw
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:39 +01:00
Piotr Tabor 8ec3cbc551 fixup! Add --raw mode to ./etcd-dump-log
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:39 +01:00
Piotr Tabor e571fb7baa Add --raw mode to ./etcd-dump-log
This mode allows to look at RAW protos for all entries in WAL logs in the given directory.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:34 +01:00
Piotr Tabor 14a1bf1d26 etcd-dump-logs: Make the tests work again.
The tests are subtle as they skip if the binary is not generated in the local directory.

$ go build . && go test
PASS
ok      go.etcd.io/etcd/v3/tools/etcd-dump-logs 0.769s

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 13:08:24 +01:00
Wei Fu 4d0b91947e chore: delete // +build buildtag by `go fix`
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:17:05 +08:00
dependabot[bot] 6f522f657d
build(deps): bump github.com/mikefarah/yq/v4 in /tools/mod
Bumps [github.com/mikefarah/yq/v4](https://github.com/mikefarah/yq) from 4.30.5 to 4.30.6.
- [Release notes](https://github.com/mikefarah/yq/releases)
- [Changelog](https://github.com/mikefarah/yq/blob/master/release_notes.txt)
- [Commits](https://github.com/mikefarah/yq/compare/v4.30.5...v4.30.6)

---
updated-dependencies:
- dependency-name: github.com/mikefarah/yq/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 17:03:52 +00:00
Benjamin Wang 3b9086009d
Merge pull request #14982 from etcd-io/dependabot/go_modules/tools/mod/github.com/alexkohler/nakedret-1.0.1
build(deps): bump github.com/alexkohler/nakedret from 1.0.0 to 1.0.1 in /tools/mod
2022-12-14 08:56:47 +08:00
dependabot[bot] 17d1761fbd
build(deps): bump github.com/alexkohler/nakedret in /tools/mod
Bumps [github.com/alexkohler/nakedret](https://github.com/alexkohler/nakedret) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/alexkohler/nakedret/releases)
- [Commits](https://github.com/alexkohler/nakedret/compare/v1.0...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/alexkohler/nakedret
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 00:19:18 +00:00
dependabot[bot] 042022390d
build(deps): bump honnef.co/go/tools from 0.3.0 to 0.3.3 in /tools/mod
Bumps [honnef.co/go/tools](https://github.com/dominikh/go-tools) from 0.3.0 to 0.3.3.
- [Release notes](https://github.com/dominikh/go-tools/releases)
- [Commits](https://github.com/dominikh/go-tools/compare/v0.3.0...v0.3.3)

---
updated-dependencies:
- dependency-name: honnef.co/go/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 00:18:23 +00:00
Benjamin Wang 8b34906b1d deps: bump github.com/mikefarah/yq/v4 from 4.24.2 to 4.30.5 in /tools/mod
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:17:21 +08:00
Benjamin Wang 6845168182 deps: bump github.com/google/addlicense from 1.0.0 to 1.1.0 in /tools/mod
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:15:44 +08:00
Benjamin Wang feeb703b06 deps: bump gotest.tools/v3 from 3.1.0 to 3.4.0 in /tools/mod
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:13:08 +08:00
Benjamin Wang 40e85f6bee deps: bump github.com/mgechev/revive from 1.2.1 to 1.2.4 in /tools/mod
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:09:35 +08:00
Benjamin Wang c51540bdd2 deps: bump google.golang.org/protobuf from 1.28.0 to 1.28.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:07:52 +08:00
Benjamin Wang 642a451165 deps: bump gotest.tools/gotestsum from 1.7.0 to 1.8.2 in /tools/mod
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:53:44 +08:00
Benjamin Wang 259a73d67a deps: bump github.com/spf13/cobra from 1.4.0 to 1.6.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:33:24 +08:00
Marek Siarkowicz 1bb4c9558d tests: Update gofail to v0.1.0
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-12-10 14:49:20 +01:00
Benjamin Wang 1ba246e1d8 bump golang.org/x/ to v0.4.0
Found 1 known vulnerability.

Vulnerability #1: GO-2022-1144
  An attacker can cause excessive memory growth in a Go server
  accepting HTTP/2 requests. HTTP/2 server connections contain a
  cache of HTTP header keys sent by the client. While the total
  number of entries in this cache is capped, an attacker sending
  very large keys can cause the server to allocate approximately
  64 MiB per open connection.

  Call stacks in your code:
Error:       tools/etcd-dump-metrics/main.go:158:5: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls golang.org/x/net/http2.Server.ServeConn

  Found in: golang.org/x/net/http2@v0.2.0
  Fixed in: golang.org/x/net/http2@v0.4.0
  More info: https://pkg.go.dev/vuln/GO-2022-1144
Error: Process completed with exit code 3.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-09 08:54:48 +08:00
Benjamin Wang 971e42d631 Resolve build and test errors
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 15:43:48 +08:00
Benjamin Wang cc58edecf2 raft: add raft into the tools/mod
Previously etcdservers depends on raft/raftpb/raft.proto directly.
After moving raft to a separate repo, we need to add raft to the
tools/mod, and get raft included in the -I protc flags.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 15:36:41 +08:00
Benjamin Wang ff337cc993 tools/etcd-dump-logs: generate go.mod and go.sum for the tool
Add go.mod and go.sum to fix issue below,
```
$ go build
../../server/etcdserver/api/snap/snapshotter.go:33:2: missing go.sum entry for module providing package go.etcd.io/raft/v3 (imported by go.etcd.io/etcd/server/v3/etcdserver/api/snap); to add:
	go get go.etcd.io/etcd/server/v3/etcdserver/api/snap@v3.6.0-alpha.0
../../server/storage/wal/walpb/record.pb.go:14:2: missing go.sum entry for module providing package go.etcd.io/raft/v3/raftpb (imported by go.etcd.io/etcd/v3/tools/etcd-dump-logs); to add:
	go get go.etcd.io/etcd/v3/tools/etcd-dump-logs
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:27:38 +08:00
Benjamin Wang bb6e892763 tools/etcd-dump-logs: update tool to use the new raft module go.etcd.io/raft/v3
Just replaced all go.etcd.io/etcd/raft/v3 with go.etcd.io/raft/v3
under tools/etcd-dump-logs.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:12:19 +08:00