-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-api.sh
executable file
·77 lines (60 loc) · 3.02 KB
/
update-api.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${__dir}/API_SHAS"
protodir="${__dir}/src/main/protobuf"
tmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'tmpdir'`
# Check if the temp dir was created.
if [[ ! "${tmpdir}" || ! -d "${tmpdir}" ]]; then
echo "Could not create temp dir"
exit 1
fi
# Clean up the temp directory that we created.
function cleanup {
rm -rf "${tmpdir}"
}
# Register the cleanup function to be called on the EXIT signal.
trap cleanup EXIT
pushd "${tmpdir}" >/dev/null
rm -rf "${protodir}"
echo "Fetching Envoy protos"
curl -sL https://github.com/envoyproxy/envoy/archive/${ENVOY_SHA}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/envoy"
cp -r envoy-*/api/envoy/* "${protodir}/envoy"
echo "Fetching GoogleApis protos"
curl -sL https://github.com/googleapis/googleapis/archive/${GOOGLEAPIS_SHA}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/google/api"
mkdir -p "${protodir}/google/api/expr/v1alpha1"
mkdir -p "${protodir}/google/rpc"
cp "${__dir}/google-patches/package-api.proto" "${protodir}/google/api/package.proto"
cp "${__dir}/google-patches/package-expr.proto" "${protodir}/google/api/expr/v1alpha1/package.proto"
cp "${__dir}/google-patches/package-rpc.proto" "${protodir}/google/rpc/package.proto"
cp googleapis-*/google/api/annotations.proto googleapis-*/google/api/http.proto "${protodir}/google/api"
cp googleapis-*/google/api/expr/v1alpha1/syntax.proto "${protodir}/google/api/expr/v1alpha1"
cp googleapis-*/google/api/expr/v1alpha1/checked.proto "${protodir}/google/api/expr/v1alpha1"
cp googleapis-*/google/rpc/status.proto "${protodir}/google/rpc"
echo "Fetching protoc-gen-validate protos"
curl -sL https://github.com/envoyproxy/protoc-gen-validate/archive/v${PGV_VERSION}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/validate"
cp -r protoc-gen-validate-*/validate/* "${protodir}/validate"
echo "Fetching OpenCensus protos"
curl -sL https://github.com/census-instrumentation/opencensus-proto/archive/v${OPENCENSUS_VERSION}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/opencensus/proto"
cp -r opencensus-proto-*/src/opencensus/proto/* "${protodir}/opencensus/proto"
echo "Fetching OpenTelemetry protos"
curl -sL https://github.com/open-telemetry/opentelemetry-proto/archive/v${OPENTELEMETRY_VERSION}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/opentelemetry/proto"
cp -r opentelemetry-proto-*/opentelemetry/proto/* "${protodir}/opentelemetry/proto"
echo "Fetching Prometheus protos"
curl -sL https://github.com/prometheus/client_model/archive/${PROMETHEUS_SHA}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/io/prometheus/client"
cp client_model-*/io/prometheus/client/metrics.proto "${protodir}/io/prometheus/client"
echo "Fetching XDS protos"
curl -sL https://github.com/cncf/xds/archive/${XDS_SHA}.tar.gz | tar xz --include="*.proto"
mkdir -p "${protodir}/udpa"
mkdir -p "${protodir}/xds"
cp -r xds-*/udpa/* "${protodir}/udpa"
cp -r xds-*/xds/* "${protodir}/xds"
popd >/dev/null