genbot is a binary for generating gapics and creating PRs with the results. It is intended to be used as a bot, though it can be run locally too.
Note that only step one, listed below, is required if you plan to run the code in docker.
git clone https://github.com/googleapis/google-cloud-go.git
$GOPATH/bin
to PATH
go get \ github.com/golang/protobuf/protoc-gen-go \ golang.org/x/lint/golint \ golang.org/x/tools/cmd/goimports \ honnef.co/go/tools/cmd/staticcheck \ github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic
Note: this may change your ~/.gitconfig
, ~/.gitcookies
, and use up non-trivial amounts of space on your computer.
cd /path/to/internal/gapicgen go run cloud.google.com/go/internal/gapicgen/cmd/genbot \ --githubAccessToken=$GITHUB_ACCESS_TOKEN \ --githubUsername=$GITHUB_USERNAME \ --githubName="Jean de Klerk" \ --githubEmail=deklerk@google.com \
Note: this can be quite slow (~10m).
Note: this may leave a lot of docker resources laying around. Use docker system prune
to clean up after runs.
cd /path/to/internal/gapicgen/cmd/genbot docker build . -t genbot docker run -t --rm --privileged \ -v `pwd`/../..:/gapicgen \ -e GITHUB_ACCESS_TOKEN \ -e GITHUB_USERNAME \ -e GITHUB_NAME \ -e GITHUB_EMAIL \ genbot
Sometimes you may want to just generate gapic sources to test out new changes, test the generation of a new library, test new generator tweaks, run generators against googleapis-private, and various other local tasks. The local mode in genbot allows you to do just that.
cd /path/to/internal/gapicgen go run cloud.google.com/go/internal/gapicgen/cmd/genbot \ -local \ -only-gapics \ -gocloud-dir=/path/to/google-cloud-go \ -gapic=cloud.google.com/go/foo/apiv1
cd /path/to/internal/gapicgen docker build -t genbot -f cmd/genbot/Dockerfile . docker run --rm \ -v `pwd`/../..:/gapicgen \ -e GENBOT_LOCAL_MODE=true \ -e ONLY_GAPICS=true \ -e GOCLOUD_DIR=/gapicgen \ -e GAPIC_TO_GENERATE=cloud.google.com/go/foo/apiv1 \ genbot
Note you can optionally mount in your Go module cache if you have Go installed. This will speed up the build a bit:
-v `go env GOMODCACHE`:/root/go/pkg/mod
cd /path/to/internal/gapicgen go get -d github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic
(it's just based on the go.mod entry)