From 9587b2ebc0760362cf10207d7605cc16cc36457b Mon Sep 17 00:00:00 2001 From: SuperQ Date: Thu, 26 Mar 2026 11:07:15 +0100 Subject: [PATCH] chore: Use make target for protoc Migrate the CI scripting of installing protoc to a Makefile target. Signed-off-by: SuperQ --- .github/workflows/ci.yml | 11 ++--------- Makefile | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e2bbeb2a8..c5b96ac47b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,15 +43,8 @@ jobs: - run: go test --tags=slicelabels -race ./cmd/prometheus ./model/textparse ./prompb/... - run: go test --tags=forcedirectio -race ./tsdb/ - run: GOARCH=386 go test ./... - - run: | - VERSION="3.15.8" - env - set -x - curl -s -L https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip > /tmp/protoc.zip - unzip -d /tmp /tmp/protoc.zip - chmod +x /tmp/bin/protoc - export PATH=/tmp/bin:$PATH - make proto + - run: make protoc + - run: make proto - run: git diff --exit-code test_go_oldest: diff --git a/Makefile b/Makefile index 8f2b75cc08..62a3ad6e1e 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,15 @@ GOYACC_VERSION ?= v0.6.0 include Makefile.common +ifeq (arm, $(GOHOSTARCH)) + PROTOC_ARCH ?= aarch_64 +else + PROTOC_ARCH ?= x86_64 +endif + +PROTOC_VERSION ?= 3.15.8 +PROTOC_URL ?= https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-linux-$(PROTOC_ARCH).zip + DOCKER_IMAGE_NAME ?= prometheus # Only build UI if PREBUILT_ASSETS_STATIC_DIR is not set @@ -129,6 +138,15 @@ assets-tarball: assets @echo '>> packaging assets' scripts/package_assets.sh +.PHONY: protoc +protoc: + @echo ">> Installing protoc" + $(eval PROTOC_TMP := $(shell mktemp)) + curl -s -o $(PROTOC_TMP) -L $(PROTOC_URL) + unzip -u $(PROTOC_TMP) bin/protoc -d $(FIRST_GOPATH) + chmod +x $(FIRST_GOPATH)/bin/protoc + rm -v $(PROTOC_TMP) + .PHONY: parser parser: @echo ">> running goyacc to generate the .go file."