Skip to content

Commit 75bc9df

Browse files
authored
Makefile: update etcd to latest version, add checksums. (zalando#2783)
* Makefile: update etcd to latest version, add checksums. Signed-off-by: Sepehrdad Sh <[email protected]>
1 parent 7bf5777 commit 75bc9df

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

Makefile

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
SOURCES = $(shell find . -name '*.go' -and -not -path "./_test_plugins" -and -not -path "./_test_plugins_fail" )
2-
PACKAGES = $(shell go list ./...)
3-
CURRENT_VERSION = $(shell git describe --tags --always --dirty)
4-
VERSION ?= $(CURRENT_VERSION)
5-
COMMIT_HASH = $(shell git rev-parse --short HEAD)
6-
LIMIT_FDS = $(shell ulimit -n)
7-
TEST_ETCD_VERSION ?= v2.3.8
1+
SOURCES = $(shell find . -name '*.go' -and -not -path "./_test_plugins" -and -not -path "./_test_plugins_fail" )
2+
PACKAGES = $(shell go list ./...)
3+
CURRENT_VERSION = $(shell git describe --tags --always --dirty)
4+
VERSION ?= $(CURRENT_VERSION)
5+
COMMIT_HASH = $(shell git rev-parse --short HEAD)
6+
LIMIT_FDS = $(shell ulimit -n)
7+
TEST_ETCD_VERSION ?= v3.5.11
8+
TEST_ETCD_CHECKSUM ?= 4fb304f384dd4d6e491e405fed8375a09ea1c6c2596b93f97cb31844202e620df160f87f18611e84f17675e7b7245e40d1aa23571ecdb507cb094ba04d378171
89
TEST_PLUGINS = _test_plugins/filter_noop.so \
910
_test_plugins/predicate_match_none.so \
1011
_test_plugins/dataclient_noop.so \
@@ -114,7 +115,7 @@ clean: ## clean temporary files and directories
114115
.PHONY: deps
115116
deps: ## install dependencies to run everything
116117
go env
117-
./etcd/install.sh $(TEST_ETCD_VERSION)
118+
./etcd/install.sh $(TEST_ETCD_VERSION) $(TEST_ETCD_CHECKSUM)
118119
@go install honnef.co/go/tools/cmd/staticcheck@latest
119120
@go install github.com/securego/gosec/v2/cmd/gosec@latest
120121
@go install golang.org/x/vuln/cmd/govulncheck@latest

etcd/install.sh

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
#! /bin/bash
22
set -eo pipefail
33

4-
ETCD_VERSION=master
5-
if [ $# -gt 0 ]; then
6-
ETCD_VERSION="$1"
4+
if [ $# -lt 2 ]; then
5+
echo "usage: $0 <version> <sha512sum>"
6+
exit 1
77
fi
88

9+
ETCD_VERSION="$1"
10+
ETCD_CHECKSUM="$2"
11+
ETCD_URL="https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz"
12+
913
LOCAL_GOBIN=
14+
1015
if [ -n "${GOBIN}" ]; then
1116
LOCAL_GOBIN="$GOBIN"
1217
elif [ -n "${GOPATH}" ]; then
1318
LOCAL_GOBIN="$GOPATH/bin"
1419
fi
1520

1621
mkdir -p .bin
17-
wget \
18-
"https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" \
19-
-O ./.bin/etcd.tar.gz
22+
23+
curl -LsSfo ./.bin/etcd.tar.gz "${ETCD_URL}"
24+
25+
echo "${ETCD_CHECKSUM} ./.bin/etcd.tar.gz" | sha512sum -c
26+
2027
tar -xzf .bin/etcd.tar.gz --strip-components=1 \
2128
-C ./.bin "etcd-${ETCD_VERSION}-linux-amd64/etcd"
2229

0 commit comments

Comments
 (0)