From d5a0e2fb6f6d94bb838dbaaf2e2b1914f7e521f3 Mon Sep 17 00:00:00 2001 From: Sepehrdad Sh <26747519+sepehrdaddev@users.noreply.github.com> Date: Fri, 8 Dec 2023 09:16:53 +0100 Subject: [PATCH] Makefile: update etcd to latest version, add checksums. Signed-off-by: Sepehrdad Sh <26747519+sepehrdaddev@users.noreply.github.com> --- Makefile | 17 +++++++++-------- etcd/install.sh | 12 ++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8fc5ef9785..dae6514b5f 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ -SOURCES = $(shell find . -name '*.go' -and -not -path "./_test_plugins" -and -not -path "./_test_plugins_fail" ) -PACKAGES = $(shell go list ./...) -CURRENT_VERSION = $(shell git describe --tags --always --dirty) -VERSION ?= $(CURRENT_VERSION) -COMMIT_HASH = $(shell git rev-parse --short HEAD) -LIMIT_FDS = $(shell ulimit -n) -TEST_ETCD_VERSION ?= v2.3.8 +SOURCES = $(shell find . -name '*.go' -and -not -path "./_test_plugins" -and -not -path "./_test_plugins_fail" ) +PACKAGES = $(shell go list ./...) +CURRENT_VERSION = $(shell git describe --tags --always --dirty) +VERSION ?= $(CURRENT_VERSION) +COMMIT_HASH = $(shell git rev-parse --short HEAD) +LIMIT_FDS = $(shell ulimit -n) +TEST_ETCD_VERSION ?= v2.3.8 +TEST_ETCD_CHECKSUM ?= 4fb304f384dd4d6e491e405fed8375a09ea1c6c2596b93f97cb31844202e620df160f87f18611e84f17675e7b7245e40d1aa23571ecdb507cb094ba04d378171 TEST_PLUGINS = _test_plugins/filter_noop.so \ _test_plugins/predicate_match_none.so \ _test_plugins/dataclient_noop.so \ @@ -114,7 +115,7 @@ clean: ## clean temporary files and directories .PHONY: deps deps: ## install dependencies to run everything go env - ./etcd/install.sh $(TEST_ETCD_VERSION) + ./etcd/install.sh $(TEST_ETCD_VERSION) $(TEST_ETCD_CHECKSUM) @go install honnef.co/go/tools/cmd/staticcheck@latest @go install github.com/securego/gosec/v2/cmd/gosec@latest @go install golang.org/x/vuln/cmd/govulncheck@latest diff --git a/etcd/install.sh b/etcd/install.sh index 76e653e705..7861802254 100755 --- a/etcd/install.sh +++ b/etcd/install.sh @@ -1,11 +1,16 @@ #! /bin/bash set -eo pipefail -ETCD_VERSION=master -if [ $# -gt 0 ]; then +ETCD_VERSION=v3.5.11 +if [ $# -gt 0 ]; then ETCD_VERSION="$1" fi +ETCD_CHECKSUM=4fb304f384dd4d6e491e405fed8375a09ea1c6c2596b93f97cb31844202e620df160f87f18611e84f17675e7b7245e40d1aa23571ecdb507cb094ba04d378171 +if [ $# -gt 1 ]; then + ETCD_CHECKSUM="$2" +fi + LOCAL_GOBIN= if [ -n "${GOBIN}" ]; then LOCAL_GOBIN="$GOBIN" @@ -17,6 +22,9 @@ mkdir -p .bin wget \ "https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz" \ -O ./.bin/etcd.tar.gz + +echo "${ETCD_CHECKSUM} ./.bin/etcd.tar.gz" | sha512sum -c + tar -xzf .bin/etcd.tar.gz --strip-components=1 \ -C ./.bin "etcd-${ETCD_VERSION}-linux-amd64/etcd"