Skip to content

Commit 4f27789

Browse files
authored
chore: update protoc to 3.17.3 and make install portable (argoproj#7932)
Signed-off-by: Jesse Suen <[email protected]>
1 parent 427cde0 commit 4f27789

16 files changed

+75
-47
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ gogen: ensure-gopath
179179
go generate ./util/argo/...
180180

181181
.PHONY: protogen
182-
protogen: ensure-gopath
182+
protogen: ensure-gopath mod-vendor-local
183183
export GO111MODULE=off
184184
./hack/generate-proto.sh
185185

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ require (
7474
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
7575
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2
7676
google.golang.org/grpc v1.40.0
77+
google.golang.org/protobuf v1.27.1
7778
gopkg.in/go-playground/webhooks.v5 v5.11.0
7879
gopkg.in/yaml.v2 v2.4.0
7980
k8s.io/api v0.23.1
@@ -197,7 +198,6 @@ require (
197198
gomodules.xyz/envconfig v1.3.1-0.20190308184047-426f31af0d45 // indirect
198199
gomodules.xyz/notify v0.1.0 // indirect
199200
google.golang.org/appengine v1.6.7 // indirect
200-
google.golang.org/protobuf v1.27.1 // indirect
201201
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
202202
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
203203
gopkg.in/inf.v0 v0.9.1 // indirect
@@ -208,7 +208,7 @@ require (
208208
k8s.io/cli-runtime v0.23.1 // indirect
209209
k8s.io/component-base v0.23.1 // indirect
210210
k8s.io/component-helpers v0.23.1 // indirect
211-
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c // indirect
211+
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 // indirect
212212
k8s.io/kube-aggregator v0.23.1 // indirect
213213
k8s.io/kubernetes v1.23.1 // indirect
214214
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect

go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -1589,8 +1589,9 @@ k8s.io/controller-manager v0.23.1/go.mod h1:AFE4qIllvTh+nRwGr3SRSUt7F+xVSzXCeb0h
15891589
k8s.io/cri-api v0.23.1/go.mod h1:REJE3PSU0h/LOV1APBrupxrEJqnoxZC8KWzkBUHwrK4=
15901590
k8s.io/csi-translation-lib v0.23.1/go.mod h1:0ZyB0cZBV4ZkqibwilEhKnxOne28rq5FDSjO+0MUVio=
15911591
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
1592-
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c h1:GohjlNKauSai7gN4wsJkeZ3WAJx4Sh+oT/b5IYn5suA=
15931592
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
1593+
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 h1:TT1WdmqqXareKxZ/oNXEUSwKlLiHzPMyB0t8BaFeBYI=
1594+
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
15941595
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
15951596
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
15961597
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=

hack/generate-proto.sh

+12-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,21 @@ APIMACHINERY_PKGS=(
3838
export GO111MODULE=on
3939
[ -e ./v2 ] || ln -s . v2
4040

41+
# protoc_include is the include directory containing the .proto files distributed with protoc binary
42+
if [ -d /dist/protoc-include ]; then
43+
# containerized codegen build
44+
protoc_include=/dist/protoc-include
45+
else
46+
# local codegen build
47+
protoc_include=${PROJECT_ROOT}/dist/protoc-include
48+
fi
49+
4150
go-to-protobuf \
4251
--go-header-file=${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
4352
--packages=$(IFS=, ; echo "${PACKAGES[*]}") \
4453
--apimachinery-packages=$(IFS=, ; echo "${APIMACHINERY_PKGS[*]}") \
45-
--proto-import=./vendor
54+
--proto-import=./vendor \
55+
--proto-import=${protoc_include}
4656

4757
# Either protoc-gen-go, protoc-gen-gofast, or protoc-gen-gogofast can be used to build
4858
# server/*/<service>.pb.go from .proto files. golang/protobuf and gogo/protobuf can be used
@@ -64,7 +74,7 @@ PROTO_FILES=$(find $PROJECT_ROOT \( -name "*.proto" -and -path '*/server/*' -or
6474
for i in ${PROTO_FILES}; do
6575
protoc \
6676
-I${PROJECT_ROOT} \
67-
-I/usr/local/include \
77+
-I${protoc_include} \
6878
-I./vendor \
6979
-I$GOPATH/src \
7080
-I${GOOGLE_PROTO_API_PATH} \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
68901eb7ef5b55d7f2df3241ab0b8d97ee5192d3902c59e7adf461adc058e9f1 protoc_3.17.3_darwin_amd64.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
68901eb7ef5b55d7f2df3241ab0b8d97ee5192d3902c59e7adf461adc058e9f1 protoc_3.17.3_darwin_arm64.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d4246a5136cf9cd1abc851c521a1ad6b8884df4feded8b9cbd5e2a2226d4b357 protoc_3.17.3_linux_amd64.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ceb29d4890a31ba871829d22c2b7fa28f237d2b91ce4ea2a53e893d60a1cd502 protoc_3.17.3_linux_arm64.zip

hack/installers/checksums/protoc_3.7.1_linux_amd64.zip.sha256

-1
This file was deleted.

hack/installers/checksums/protoc_3.7.1_linux_arm64.zip.sha256

-1
This file was deleted.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22
set -eux -o pipefail
33

4-
KUSTOMIZE_VERSION=4.2.0 "$(dirname $0)/../install.sh" helm2-linux kustomize-linux protoc-linux
4+
KUSTOMIZE_VERSION=4.2.0 "$(dirname $0)/../install.sh" helm2-linux kustomize-linux protoc

hack/installers/install-protoc-linux.sh

-27
This file was deleted.

hack/installers/install-protoc.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
set -eux -o pipefail
3+
4+
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/../..; pwd)
5+
DIST_PATH="${PROJECT_ROOT}/dist"
6+
PATH="${DIST_PATH}:${PATH}"
7+
8+
. $(dirname $0)/../tool-versions.sh
9+
10+
OS=$(go env GOOS)
11+
case $OS in
12+
darwin)
13+
# For macOS, the x86_64 binary is used even on Apple Silicon (it is run through rosetta), so
14+
# we download and install the x86_64 version. See: https://github.com/protocolbuffers/protobuf/pull/8557
15+
protoc_os=osx
16+
protoc_arch=x86_64
17+
;;
18+
*)
19+
protoc_os=linux
20+
case $ARCHITECTURE in
21+
arm64|arm)
22+
protoc_arch=aarch_64
23+
;;
24+
*)
25+
protoc_arch=x86_64
26+
;;
27+
esac
28+
;;
29+
esac
30+
31+
export TARGET_FILE=protoc_${protoc_version}_${OS}_${ARCHITECTURE}.zip
32+
url=https://github.com/protocolbuffers/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-${protoc_os}-${protoc_arch}.zip
33+
[ -e $DOWNLOADS/${TARGET_FILE} ] || curl -sLf --retry 3 -o $DOWNLOADS/${TARGET_FILE} ${url}
34+
$(dirname $0)/compare-chksum.sh
35+
mkdir -p /tmp/protoc-${protoc_version}
36+
unzip -o $DOWNLOADS/${TARGET_FILE} -d /tmp/protoc-${protoc_version}
37+
mkdir -p ${DIST_PATH}/protoc-include
38+
cp /tmp/protoc-${protoc_version}/bin/protoc ${DIST_PATH}/protoc
39+
chmod +x ${DIST_PATH}/protoc
40+
cp -a /tmp/protoc-${protoc_version}/include/* ${DIST_PATH}/protoc-include
41+
chmod -R +rx ${DIST_PATH}/protoc-include
42+
protoc --version

hack/tool-versions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ ksonnet_version=0.13.1
1515
kubectl_version=1.17.8
1616
kubectx_version=0.6.3
1717
kustomize4_version=4.4.1
18-
protoc_version=3.7.1
18+
protoc_version=3.17.3

pkg/apiclient/version/version.pb.go

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apiclient/version/version.pb.gw.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)