File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Stats CI
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
8+
9+ jobs :
10+ build :
11+ if : startsWith(github.repository, 'spinnaker/')
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v2
15+ - name : Ensure autogenerated protos match checked-in protos
16+ run : make checkproto
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ FROM mirror.gcr.io/library/golang as builder
33ADD . /workspace
44WORKDIR /workspace
55
6- RUN ./proto/regen-protos.sh
7-
86ENV GOPROXY=https://proxy.golang.org
97ENV GO111MODULE=on
108ENV CGO_ENABLED=0
Original file line number Diff line number Diff line change 1+ protobuilder :
2+ docker build -q -t stats-protobuilder:latest build/protoc/
3+
4+ proto_command = docker run --rm -v $(abspath proto/stats) :/output/go stats-protobuilder:latest
5+
6+ proto : protobuilder
7+ $(proto_command ) update
8+
9+ checkproto : protobuilder
10+ $(proto_command ) check
Original file line number Diff line number Diff line change 1+ FROM alpine:3.12.0 as curl
2+ RUN apk add --no-cache curl unzip
3+
4+ FROM curl as protoc
5+ ARG PROTOC_VERSION=3.9.0
6+ RUN curl -vLo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
7+ && unzip protoc.zip
8+
9+ FROM curl as protoc-gen-go
10+ ARG PROTOC_GEN_GO_TAG=v1.23.0
11+ RUN curl -L https://github.com/protocolbuffers/protobuf-go/releases/download/$PROTOC_GEN_GO_TAG/protoc-gen-go.$PROTOC_GEN_GO_TAG.linux.amd64.tar.gz \
12+ | tar -xz
13+
14+ FROM golang:1.14.4-buster as protoc-gen-go-json
15+ ARG PROTOC_GEN_GO_JSON_TAG=069933b8c8344593ed8905d46d59c6647c886f47
16+ RUN go get -d github.com/mitchellh/protoc-gen-go-json \
17+ && git -C "$(go env GOPATH)" /src/github.com/mitchellh/protoc-gen-go-json checkout $PROTOC_GEN_GO_JSON_TAG \
18+ && go install github.com/mitchellh/protoc-gen-go-json
19+
20+ FROM curl as kork
21+ ARG KORK_VERSION=7.45.9
22+ RUN curl -L https://github.com/spinnaker/kork/archive/v$KORK_VERSION.tar.gz | tar -xz \
23+ && mv kork-$KORK_VERSION kork
24+
25+ FROM debian:buster-slim
26+ COPY --from=protoc /bin/protoc /usr/local/bin/protoc
27+ COPY --from=protoc /include/google /usr/local/include/google
28+ COPY --from=protoc-gen-go /protoc-gen-go /usr/local/bin/protoc-gen-go
29+ COPY --from=protoc-gen-go-json /go/bin/protoc-gen-go-json /bin/
30+ COPY --from=kork /kork/kork-proto/src/main/proto/stats/ /proto/
31+ RUN mkdir -p /output /staging/go
32+ COPY genproto.sh .
33+ ENTRYPOINT ["./genproto.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ PROTOC_FLAGS=" "
5+
6+ gen_proto () {
7+ output_dir=$1
8+ find /proto -name * .proto | sort | xargs protoc \
9+ $PROTOC_FLAGS \
10+ --proto_path=/proto \
11+ --go_out=paths=source_relative:$1 /go \
12+ --go-json_out=$1 /go
13+ }
14+
15+ update_proto () {
16+ gen_proto /staging
17+ rm -rf /output/go/*
18+ cp -r /staging/go/* /output/go/
19+ }
20+
21+ check_proto () {
22+ gen_proto /staging
23+ if ! diff -r /staging /output; then
24+ echo " Protocol buffer compilation out of date. Please run 'make proto' and commit the changes."
25+ echo " To help with debugging, the difference between the committed and generated code is printed above."
26+ exit 1
27+ fi
28+ }
29+
30+ command=$1
31+ case $command in
32+ update)
33+ update_proto
34+ ;;
35+ check)
36+ check_proto
37+ ;;
38+ * )
39+ echo " Unrecognized command: $command "
40+ exit 2
41+ ;;
42+ esac
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments