Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buildkite] Fix "Codegen" test in buildkite pipeline #4312

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,26 @@ env:
# Buildkite pipeline is currently broken, and we are working on fixing it. In the meantime, we are temporarily
# disabling steps until it is fixed. ISSUE: https://github.com/m3db/m3/issues/4274
steps:
# - name: "Codegen"
# env:
# CGO_ENABLED: 0
# GIMME_GO_VERSION: 1.22.x
# plugins:
# gopath-checkout#v1.0.1:
# import: github.com/m3db/m3
# docker#v3.0.1:
# image: us-west1-docker.pkg.dev/ci-compute/buildkite-images/buildkite-dind:v1
# volumes:
# - .:/go/src/github.com/m3db/m3
# - /var/run/docker.sock:/var/run/docker.sock
# kubernetes:
# <<: *kubernetes
# podSpec:
# <<: *podSpec
# containers:
# - <<: *commandContainer
# command:
# - |-
# make clean install-vendor-m3 test-all-gen
# <<: *common
- name: "Codegen"
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.22.x
plugins:
docker-compose#v2.5.1:
run: app
workdir: /go/src/github.com/m3db/m3
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
kubernetes:
<<: *kubernetes
podSpec:
<<: *podSpec
containers:
- <<: *commandContainer
command:
- |-
make clean install-vendor-m3 test-all-gen
<<: *common
- name: "Unit %n"
parallelism: 4
plugins:
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
FROM golang:1.22-bullseye

RUN apt-get update && apt-get install -y lsof netcat-openbsd docker.io jq
RUN apt-get update && apt-get install -y lsof netcat-openbsd docker.io jq protobuf-compiler thrift-compiler

RUN go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest

ENV GOBIN=/go/bin
ENV PATH=$PATH:/go/bin
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
# Support running docker within docker. That is, buildkite jobs themselves run in a container; that container
# needs to be able to spin up functioning docker containers.
- /var/run/docker.sock:/var/run/docker.sock
working_dir: /go/src/github.com/m3db/m3
extra_hosts:
# Allow routing from the buildkite container to the host machine, as host.docker.internal. This allows us to do
# the following:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ require (
)

require (
github.com/apache/thrift v0.13.0
github.com/twmb/murmur3 v1.1.6
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090
)
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VT
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
Expand Down
22 changes: 4 additions & 18 deletions scripts/proto-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@
source $(dirname $0)/realpath.sh

# paranoia, ftw
set -e

PROTOC_IMAGE_VERSION=${PROTOC_IMAGE_VERSION:-"znly/protoc:0.2.0"}

# ensure docker is running
docker run --platform linux/amd64 --rm hello-world >/dev/null

UID_FLAGS="-u $(id -u)"
if [[ -n "$BUILDKITE" ]]; then
UID_FLAGS="-u root"
fi
set -ex

PROTO_SRC=$1
for i in "${GOPATH}/src/${PROTO_SRC}"/*; do
Expand All @@ -23,15 +13,11 @@ for i in "${GOPATH}/src/${PROTO_SRC}"/*; do
fi

if ls $i/*.proto > /dev/null 2>&1; then
proto_files=$(ls $i/*.proto | sed -e "s@${GOPATH}@@g")
proto_files=$(ls $i/*.proto | sed -e "s@${GOPATH}@${GOPATH}@g")
echo "generating from ${proto_files}"
# need the additional m3db_path mount in docker because it's a symlink on the CI.
m3db_path=$(realpath $GOPATH/src/github.com/m3db/m3)
resolve_protos="Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types"

docker run --platform linux/amd64 --rm -w /src -v $GOPATH/src:/src -v ${m3db_path}:/src/github.com/m3db/m3 \
$UID_FLAGS $PROTOC_IMAGE_VERSION \
--gogofaster_out=${resolve_protos},plugins=grpc:/src \
-I/src -I/src/github.com/m3db/m3/vendor ${proto_files}
protoc --gogofaster_out=${resolve_protos},plugins=grpc:${GOPATH}/src \
-I${GOPATH}/src -I${GOPATH}/src/github.com/m3db/m3/vendor ${proto_files}
fi
done
8 changes: 4 additions & 4 deletions src/aggregator/aggregator/counter_elem_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/aggregator/aggregator/gauge_elem_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/aggregator/aggregator/timer_elem_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading