Skip to content

Commit

Permalink
Split etcdctl into etcdctl (public API access) & etcdutl (direct surg…
Browse files Browse the repository at this point in the history
…ery on files)

Motivation is as follows:

  - etcdctl we only depend on clientv3 APIs, no dependencies of bolt, backend, mvcc, file-layout
  - etcdctl can be officially supported across wide range of versions, while etcdutl is pretty specific to file format at particular version.
it's step towards desired modules layout, documented in: https://etcd.io/docs/next/dev-internal/modules/
  • Loading branch information
ptabor committed May 17, 2021
1 parent 1675101 commit c09aca1
Show file tree
Hide file tree
Showing 44 changed files with 1,788 additions and 963 deletions.
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -25,6 +25,7 @@ build:
GO_BUILD_FLAGS="-v" ./build.sh
./bin/etcd --version
./bin/etcdctl version
./bin/etcdutl version

clean:
rm -f ./codecov
Expand Down Expand Up @@ -210,7 +211,7 @@ build-docker-release-main:
docker run \
--rm \
gcr.io/etcd-development/etcd:$(ETCD_VERSION) \
/bin/sh -c "/usr/local/bin/etcd --version && /usr/local/bin/etcdctl version"
/bin/sh -c "/usr/local/bin/etcd --version && /usr/local/bin/etcdctl version && /usr/local/bin/etcdutl version"

push-docker-release-main:
$(info ETCD_VERSION: $(ETCD_VERSION))
Expand Down Expand Up @@ -529,6 +530,7 @@ build-docker-functional:
/bin/bash -c "./bin/etcd --version && \
./bin/etcd-failpoints --version && \
./bin/etcdctl version && \
./bin/etcdutl version && \
./bin/etcd-agent -help || true && \
./bin/etcd-proxy -help || true && \
./bin/etcd-runner --help || true && \
Expand Down
9 changes: 9 additions & 0 deletions bill-of-materials.json
Expand Up @@ -485,6 +485,15 @@
}
]
},
{
"project": "go.etcd.io/etcd/etcdutl/v3",
"licenses": [
{
"type": "Apache License 2.0",
"confidence": 1
}
]
},
{
"project": "go.etcd.io/etcd/pkg/v3",
"licenses": [
Expand Down
10 changes: 10 additions & 0 deletions build.sh
Expand Up @@ -47,6 +47,16 @@ etcd_build() {
-o="../${out}/etcd" . || return 2
) || return 2

run rm -f "${out}/etcdutl"
# shellcheck disable=SC2086
(
cd ./etcdutl
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" "${GO_BUILD_ENV[@]}" go build $GO_BUILD_FLAGS \
-installsuffix=cgo \
"-ldflags=${GO_LDFLAGS[*]}" \
-o="../${out}/etcdutl" . || return 2
) || return 2

run rm -f "${out}/etcdctl"
# shellcheck disable=SC2086
(
Expand Down
6 changes: 4 additions & 2 deletions dummy.go
Expand Up @@ -18,6 +18,8 @@ package main_test
// module (e.g. for sake of 'bom' generation).
// Thanks to this 'go mod tidy' is not removing that dependencies from go.mod.
import (
_ "go.etcd.io/etcd/client/v2" // keep
_ "go.etcd.io/etcd/tests/v3/integration" // keep
_ "go.etcd.io/etcd/client/v2" // keep
_ "go.etcd.io/etcd/etcdctl/v3/ctlv3/command" // keep
_ "go.etcd.io/etcd/etcdutl/v3/etcdutl" // keep
_ "go.etcd.io/etcd/tests/v3/integration" // keep
)

0 comments on commit c09aca1

Please sign in to comment.