2019-10-27 16:24:54 +03:00
# Copyright 2019 The Vitess Authors.
2019-04-25 21:03:33 +03:00
#
2017-05-06 02:21:12 +03:00
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
2019-04-25 21:03:33 +03:00
#
2017-05-06 02:21:12 +03:00
# http://www.apache.org/licenses/LICENSE-2.0
2019-04-25 21:03:33 +03:00
#
2017-05-06 02:21:12 +03:00
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2012-11-01 02:29:41 +04:00
MAKEFLAGS = -s
2021-05-04 12:57:01 +03:00
GIT_STATUS := $( shell git status --porcelain)
2012-11-01 02:29:41 +04:00
2019-12-07 22:11:06 +03:00
export GOBIN = $( PWD) /bin
2019-11-28 23:40:33 +03:00
export GO111MODULE = on
2020-01-15 22:16:46 +03:00
export REWRITER = go/vt/sqlparser/rewriter.go
2019-11-28 23:40:33 +03:00
2015-05-07 00:43:41 +03:00
# Disabled parallel processing of target prerequisites to avoid that integration tests are racing each other (e.g. for ports) and may fail.
# Since we are not using this Makefile for compilation, limiting parallelism will not increase build time.
.NOTPARALLEL :
2021-01-07 00:46:42 +03:00
.PHONY : all build install test clean unit_test unit_test_cover unit_test_race integration_test proto proto_banner site_test site_integration_test docker_bootstrap docker_test docker_unit_test java_test reshard_tests e 2e_test e 2e_test_race minimaltools tools web_bootstrap web_build web_start generate_ci_workflows
2014-05-17 01:45:16 +04:00
2017-09-19 06:39:42 +03:00
all : build
2012-11-01 02:29:41 +04:00
2015-07-23 10:13:29 +03:00
# Set a custom value for -p, the number of packages to be built/tested in parallel.
# This is currently only used by our Travis CI test configuration.
# (Also keep in mind that this value is independent of GOMAXPROCS.)
2016-08-06 05:27:48 +03:00
i f d e f V T _ G O _ P A R A L L E L _ V A L U E
export VT_GO_PARALLEL := -p $( VT_GO_PARALLEL_VALUE)
2015-07-23 10:13:29 +03:00
e n d i f
2016-08-06 05:27:48 +03:00
2019-07-26 00:45:21 +03:00
i f d e f V T _ E X T R A _ B U I L D _ F L A G S
export EXTRA_BUILD_FLAGS := $( VT_EXTRA_BUILD_FLAGS)
e n d i f
2020-10-08 05:27:05 +03:00
i f n d e f V T R O O T
export VTROOT = ${ PWD }
e n d i f
2020-08-26 23:34:12 +03:00
# We now have CGO code in the build which throws warnings with newer gcc builds.
# See: https://github.com/mattn/go-sqlite3/issues/803
# Work around by dropping optimization level from default -O2.
# Safe, since this code isn't performance critical.
export CGO_CFLAGS := -O1
2020-09-25 02:04:44 +03:00
# regenerate rice-box.go when any of the .cnf files change
2020-01-04 00:18:46 +03:00
embed_config :
cd go/vt/mysqlctl
go run github.com/GeertJohan/go.rice/rice embed-go
go build .
2021-04-06 19:43:24 +03:00
# build the vitess binaries with dynamic dependency on libc
2021-04-07 12:47:58 +03:00
build-dyn :
2021-04-06 14:43:33 +03:00
i f n d e f N O B A N N E R
echo $$ ( date) : Building source tree
e n d i f
bash ./build.env
go install $( EXTRA_BUILD_FLAGS) $( VT_GO_PARALLEL) -ldflags " $( shell tools/build_version_flags.sh) " ./go/...
( cd go/cmd/vttablet && go run github.com/GeertJohan/go.rice/rice append --exec= ../../../bin/vttablet)
# build the vitess binaries statically
2020-01-15 05:08:37 +03:00
build :
2015-10-18 04:01:32 +03:00
i f n d e f N O B A N N E R
2015-08-21 19:51:08 +03:00
echo $$ ( date) : Building source tree
2015-10-18 04:01:32 +03:00
e n d i f
2019-12-07 22:11:06 +03:00
bash ./build.env
2021-04-06 14:21:55 +03:00
# build all the binaries by default with CGO disabled
CGO_ENABLED = 0 go install $( EXTRA_BUILD_FLAGS) $( VT_GO_PARALLEL) -ldflags " $( shell tools/build_version_flags.sh) " ./go/...
# embed local resources in the vttablet executable
( cd go/cmd/vttablet && go run github.com/GeertJohan/go.rice/rice append --exec= ../../../bin/vttablet)
# build vtorc with CGO, because it depends on sqlite
CGO_ENABLED = 1 go install $( EXTRA_BUILD_FLAGS) $( VT_GO_PARALLEL) -ldflags " $( shell tools/build_version_flags.sh) " ./go/cmd/vtorc/...
2020-08-09 14:58:23 +03:00
2021-04-08 04:33:39 +03:00
# xbuild can be used to cross-compile Vitess client binaries
# Outside of select client binaries (namely vtctlclient & vtexplain), cross-compiled Vitess Binaries are not recommended for production deployments
# Usage: GOOS=darwin GOARCH=amd64 make xbuild
2021-04-12 19:42:19 +03:00
cross-build :
2021-04-08 04:33:39 +03:00
i f n d e f N O B A N N E R
echo $$ ( date) : Building source tree
e n d i f
bash ./build.env
# In order to cross-compile, go install requires GOBIN to be unset
export GOBIN = ""
# For the specified GOOS + GOARCH, build all the binaries by default with CGO disabled
CGO_ENABLED = 0 GOOS = ${ GOOS } GOARCH = ${ GOARCH } go install $( EXTRA_BUILD_FLAGS) $( VT_GO_PARALLEL) -ldflags " $( shell tools/build_version_flags.sh) " ./go/...
# unset GOOS and embed local resources in the vttablet executable
( cd go/cmd/vttablet && unset GOOS && go run github.com/GeertJohan/go.rice/rice --verbose append --exec= $$ { HOME} /go/bin/${ GOOS } _${ GOARCH } /vttablet)
# Cross-compiling w/ cgo isn't trivial and we don't need vtorc, so we can skip building it
2019-12-20 00:26:58 +03:00
debug :
i f n d e f N O B A N N E R
echo $$ ( date) : Building source tree
e n d i f
bash ./build.env
go install $( EXTRA_BUILD_FLAGS) $( VT_GO_PARALLEL) -ldflags " $( shell tools/build_version_flags.sh) " -gcflags -'N -l' ./go/...
2019-12-19 20:41:52 +03:00
# install copies the files needed to run Vitess into the given directory tree.
2020-10-14 00:53:41 +03:00
# This target is optimized for docker images. It only installs the files needed for running vitess in docker
2019-12-19 20:41:52 +03:00
# Usage: make install PREFIX=/path/to/install/root
install : build
2020-10-14 00:53:41 +03:00
# binaries
mkdir -p " $$ {PREFIX}/bin "
2021-01-20 16:32:53 +03:00
cp " $$ {VTROOT}/bin/ " { mysqlctl,mysqlctld,vtorc,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtworker,vtbackup} " $$ {PREFIX}/bin/ "
2020-10-14 00:53:41 +03:00
# Install local install the binaries needed to run vitess locally
# Usage: make install-local PREFIX=/path/to/install/root
install-local : build
2019-12-19 20:41:52 +03:00
# binaries
mkdir -p " $$ {PREFIX}/bin "
2020-12-08 22:09:50 +03:00
cp " $$ {VTROOT}/bin/ " { mysqlctl,mysqlctld,vtorc,vtctl,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtworker,vtbackup} " $$ {PREFIX}/bin/ "
2019-12-19 20:41:52 +03:00
2020-10-14 00:53:41 +03:00
2020-01-08 13:28:48 +03:00
# install copies the files needed to run test Vitess using vtcombo into the given directory tree.
2020-10-14 00:53:41 +03:00
# Usage: make install-testing PREFIX=/path/to/install/root
2020-01-08 13:28:48 +03:00
install-testing : build
# binaries
mkdir -p " $$ {PREFIX}/bin "
cp " $$ {VTROOT}/bin/ " { mysqlctld,mysqlctl,vtcombo,vttestserver} " $$ {PREFIX}/bin/ "
# config files
cp -R config " $$ {PREFIX}/ "
# vtctld web UI files
mkdir -p " $$ {PREFIX}/web/vtctld2 "
cp -R web/vtctld2/app " $$ {PREFIX}/web/vtctld2 "
2021-01-03 19:13:51 +03:00
grpcvtctldclient : go /vt /proto /vtctlservice /vtctlservice .pb .go
make -C go/vt/vtctl/grpcvtctldclient
2017-03-31 20:53:29 +03:00
parser :
2017-03-31 21:11:25 +03:00
make -C go/vt/sqlparser
2017-03-31 20:53:29 +03:00
2021-05-13 11:41:47 +03:00
codegen : asthelpergen sizegen parser astfmtgen
2021-03-20 13:43:34 +03:00
2021-03-23 10:56:20 +03:00
visitor : asthelpergen
echo "make visitor has been replaced by make asthelpergen"
asthelpergen :
2021-03-12 13:11:19 +03:00
go run ./go/tools/asthelpergen/main -in ./go/vt/sqlparser -iface vitess.io/vitess/go/vt/sqlparser.SQLNode -except "*ColName"
2020-01-11 03:43:32 +03:00
2021-01-28 17:54:07 +03:00
sizegen :
2021-03-18 15:05:04 +03:00
go run ./go/tools/sizegen/sizegen.go \
2021-03-26 20:17:54 +03:00
-in ./go/... \
2021-01-28 17:54:07 +03:00
-gen vitess.io/vitess/go/vt/vtgate/engine.Plan \
2021-03-26 20:17:54 +03:00
-gen vitess.io/vitess/go/vt/vttablet/tabletserver.TabletPlan \
-gen vitess.io/vitess/go/sqltypes.Result
2021-01-28 17:54:07 +03:00
2021-03-18 15:05:04 +03:00
astfmtgen :
go run ./go/tools/astfmtgen/main.go vitess.io/vitess/go/vt/sqlparser/...
2015-08-24 23:44:52 +03:00
# To pass extra flags, run test.go manually.
# For example: go run test.go -docker=false -- --extra-flag
# For more info see: go run test.go -help
2020-02-04 06:47:54 +03:00
test :
go run test.go -docker= false
2015-08-24 05:51:42 +03:00
2014-09-11 01:56:25 +04:00
site_test : unit_test site_integration_test
2014-05-17 01:45:16 +04:00
2013-12-25 02:28:19 +04:00
clean :
go clean -i ./go/...
2015-07-29 00:10:59 +03:00
rm -rf third_party/acolyte
2016-06-28 22:17:36 +03:00
rm -rf go/vt/.proto.tmp
2012-11-01 02:29:41 +04:00
2017-11-24 10:02:04 +03:00
# Remove everything including stuff pulled down by bootstrap.sh
2020-01-11 03:43:32 +03:00
cleanall : clean
2017-11-24 10:02:04 +03:00
# directories created by bootstrap.sh
# - exclude vtdataroot and vthook as they may have data we want
2019-12-10 01:42:49 +03:00
rm -rf bin dist lib pkg
2017-11-24 10:02:04 +03:00
# Remind people to run bootstrap.sh again
2019-12-07 22:11:06 +03:00
echo "Please run 'make tools' again to setup your environment"
2012-11-01 02:29:41 +04:00
2020-02-04 06:47:54 +03:00
unit_test : build dependency_check
echo $$ ( date) : Running unit tests
tools/unit_test_runner.sh
2019-10-15 08:06:04 +03:00
e2e_test : build
echo $$ ( date) : Running endtoend tests
go test $( VT_GO_PARALLEL) ./go/.../endtoend/...
2014-05-01 00:43:22 +04:00
# Run the code coverage tools, compute aggregate.
# If you want to improve in a directory, run:
# go test -coverprofile=coverage.out && go tool cover -html=coverage.out
2015-09-22 19:40:39 +03:00
unit_test_cover : build
2016-04-07 00:52:31 +03:00
go test $( VT_GO_PARALLEL) -cover ./go/... | misc/parse_cover.py
2014-05-01 00:13:59 +04:00
2019-12-07 22:11:06 +03:00
unit_test_race : build dependency_check
2015-11-23 04:35:22 +03:00
tools/unit_test_race.sh
2013-10-29 15:40:01 +04:00
2019-10-15 08:06:04 +03:00
e2e_test_race : build
tools/e2e_test_race.sh
2019-10-25 19:50:57 +03:00
e2e_test_cluster : build
tools/e2e_test_cluster.sh
2014-04-14 05:38:00 +04:00
.ONESHELL :
SHELL = /bin/bash
2014-10-01 05:59:51 +04:00
2015-08-24 05:51:42 +03:00
# Run the following tests after making worker changes.
worker_test :
2016-04-07 00:52:31 +03:00
go test ./go/vt/worker/
2015-10-29 23:27:23 +03:00
go run test.go -docker= false -tag= worker_test
2015-01-13 07:08:44 +03:00
2015-08-24 05:51:42 +03:00
site_integration_test :
2015-10-29 23:27:23 +03:00
go run test.go -docker= false -tag= site_test
2014-09-11 01:56:25 +04:00
2015-08-23 05:21:26 +03:00
java_test :
2016-05-27 06:36:52 +03:00
go install ./go/cmd/vtgateclienttest ./go/cmd/vtcombo
2019-12-07 22:11:06 +03:00
VTROOT = ${ PWD } mvn -f java/pom.xml -B clean verify
2014-10-01 05:59:51 +04:00
2019-09-24 03:33:28 +03:00
install_protoc-gen-go :
2021-05-07 18:48:40 +03:00
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
2021-05-24 17:57:16 +03:00
go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto
2019-09-24 03:33:28 +03:00
2016-06-28 22:17:36 +03:00
PROTO_SRCS = $( wildcard proto/*.proto)
PROTO_SRC_NAMES = $( basename $( notdir $( PROTO_SRCS) ) )
PROTO_GO_OUTS = $( foreach name, $( PROTO_SRC_NAMES) , go/vt/proto/$( name) /$( name) .pb.go)
2020-04-13 02:49:45 +03:00
# This rule rebuilds all the go files from the proto definitions for gRPC.
proto : $( PROTO_GO_OUTS )
2017-11-13 21:11:14 +03:00
2016-06-28 22:17:36 +03:00
i f n d e f N O B A N N E R
echo $$ ( date) : Compiling proto definitions
e n d i f
2021-01-06 03:46:03 +03:00
$(PROTO_GO_OUTS) : minimaltools install_protoc -gen -go proto /*.proto
2016-06-28 22:17:36 +03:00
for name in $( PROTO_SRC_NAMES) ; do \
2021-05-07 18:48:40 +03:00
$( VTROOT) /bin/protoc \
--go_out= . --plugin protoc-gen-go= " ${ GOBIN } /protoc-gen-go " \
--go-grpc_out= . --plugin protoc-gen-go-grpc= " ${ GOBIN } /protoc-gen-go-grpc " \
2021-05-24 17:57:16 +03:00
--go-vtproto_out= . --plugin protoc-gen-go-vtproto= " ${ GOBIN } /protoc-gen-go-vtproto " \
--go-vtproto_opt= features = marshal+unmarshal+size \
2021-05-07 18:48:40 +03:00
-I${ PWD } /dist/vt-protoc-3.6.1/include:proto proto/$$ { name} .proto; \
2016-06-28 22:17:36 +03:00
done
2020-08-17 14:39:30 +03:00
cp -Rf vitess.io/vitess/go/vt/proto/* go/vt/proto
rm -rf vitess.io/vitess/go/vt/proto/
2016-06-28 22:17:36 +03:00
2017-04-13 03:49:34 +03:00
# Helper targets for building Docker images.
# Please read docker/README.md to understand the different available images.
2015-06-27 03:12:04 +03:00
# This rule builds the bootstrap images for all flavors.
2019-03-05 21:29:23 +03:00
DOCKER_IMAGES_FOR_TEST = mariadb mariadb103 mysql56 mysql57 mysql80 percona percona57 percona80
2016-05-26 09:01:51 +03:00
DOCKER_IMAGES = common $( DOCKER_IMAGES_FOR_TEST)
2020-12-19 01:05:36 +03:00
BOOTSTRAP_VERSION = 1
2020-12-17 22:02:09 +03:00
ensure_bootstrap_version :
find docker/ -type f -exec sed -i " s/^\(ARG bootstrap_version\)=.*/\1= ${ BOOTSTRAP_VERSION } / " { } \;
sed -i 's/\(^.*flag.String(\"bootstrap-version\",\) *\"[^\"]\+\"/\1 \"${BOOTSTRAP_VERSION}\"/' test.go
2015-04-21 01:09:26 +03:00
docker_bootstrap :
2020-12-15 21:49:39 +03:00
for i in $( DOCKER_IMAGES) ; do echo " building bootstrap image: $$ i " ; docker/bootstrap/build.sh $$ i ${ BOOTSTRAP_VERSION } || exit 1; done
2016-05-26 09:01:51 +03:00
docker_bootstrap_test :
2020-12-15 21:49:39 +03:00
flavors = '$(DOCKER_IMAGES_FOR_TEST)' && ./test.go -pull= false -parallel= 2 -bootstrap-version= ${ BOOTSTRAP_VERSION } -flavor= $$ { flavors// /,}
2016-05-26 09:01:51 +03:00
docker_bootstrap_push :
2020-12-15 21:49:39 +03:00
for i in $( DOCKER_IMAGES) ; do echo " pushing bootstrap image: ${ BOOTSTRAP_VERSION } - $$ i " ; docker push vitess/bootstrap:${ BOOTSTRAP_VERSION } -$$ i || exit 1; done
2016-11-02 03:45:50 +03:00
# Use this target to update the local copy of your images with the one on Dockerhub.
docker_bootstrap_pull :
2020-12-15 21:49:39 +03:00
for i in $( DOCKER_IMAGES) ; do echo " pulling bootstrap image: $$ i " ; docker pull vitess/bootstrap:${ BOOTSTRAP_VERSION } -$$ i || exit 1; done
2015-04-21 02:03:01 +03:00
2016-05-19 22:50:28 +03:00
2020-12-15 21:49:39 +03:00
d e f i n e b u i l d _ d o c k e r _ i m a g e
# Fix permissions before copying files, to avoid AUFS bug.
${ info Building ${ 2 } }
chmod -R o = g *;
docker build -f ${ 1 } -t ${ 2 } --build-arg bootstrap_version = ${ BOOTSTRAP_VERSION } .;
e n d e f
2019-03-05 21:29:23 +03:00
2020-12-15 21:49:39 +03:00
docker_base :
${ call build_docker_image,docker/base/Dockerfile,vitess/base }
2016-03-05 02:48:34 +03:00
2020-12-15 21:49:39 +03:00
DOCKER_BASE_SUFFIX = mysql56 mysql80 mariadb mariadb103 percona percona57 percona80
DOCKER_BASE_TARGETS = $( addprefix docker_base_, $( DOCKER_BASE_SUFFIX) )
$(DOCKER_BASE_TARGETS) : docker_base_ %:
${ call build_docker_image,docker/base/Dockerfile. $* ,vitess/base : $* }
2016-08-12 18:39:33 +03:00
2020-12-15 21:49:39 +03:00
docker_base_all : docker_base $( DOCKER_BASE_TARGETS )
2019-03-05 21:29:23 +03:00
2017-04-13 02:54:13 +03:00
docker_lite :
2020-12-15 21:49:39 +03:00
${ call build_docker_image,docker/lite/Dockerfile,vitess/lite }
2020-04-22 01:49:53 +03:00
2020-12-15 21:49:39 +03:00
DOCKER_LITE_SUFFIX = mysql56 mysql57 ubi7.mysql57 mysql80 ubi7.mysql80 mariadb mariadb103 percona percona57 ubi7.percona57 percona80 ubi7.percona80 alpine testing
DOCKER_LITE_TARGETS = $( addprefix docker_lite_,$( DOCKER_LITE_SUFFIX) )
$(DOCKER_LITE_TARGETS) : docker_lite_ %:
${ call build_docker_image,docker/lite/Dockerfile. $* ,vitess/lite : $* }
2016-03-05 02:48:34 +03:00
2020-12-15 21:49:39 +03:00
docker_lite_all : docker_lite $( DOCKER_LITE_TARGETS )
2020-01-08 13:28:48 +03:00
2020-06-29 15:50:00 +03:00
docker_local :
2020-12-15 21:49:39 +03:00
${ call build_docker_image,docker/local/Dockerfile,vitess/local }
2020-06-24 16:40:45 +03:00
docker_mini :
2020-12-15 21:49:39 +03:00
${ call build_docker_image,docker/mini/Dockerfile,vitess/mini }
2020-06-24 16:40:45 +03:00
2021-03-22 16:39:31 +03:00
DOCKER_VTTESTSERVER_SUFFIX = mysql57 mysql80
DOCKER_VTTESTSERVER_TARGETS = $( addprefix docker_vttestserver_,$( DOCKER_VTTESTSERVER_SUFFIX) )
$(DOCKER_VTTESTSERVER_TARGETS) : docker_vttestserver_ %:
${ call build_docker_image,docker/vttestserver/Dockerfile. $* ,vitess/vttestserver : $* }
docker_vttestserver : $( DOCKER_VTTESTSERVER_TARGETS )
2015-04-21 02:03:01 +03:00
# This rule loads the working copy of the code into a bootstrap image,
# and then runs the tests inside Docker.
# Example: $ make docker_test flavor=mariadb
docker_test :
2015-06-27 03:12:04 +03:00
go run test.go -flavor $( flavor)
2015-04-22 06:12:20 +03:00
docker_unit_test :
2015-06-27 03:12:04 +03:00
go run test.go -flavor $( flavor) unit
2015-08-24 05:51:42 +03:00
2018-03-13 22:19:58 +03:00
# Release a version.
# This will generate a tar.gz file into the releases folder with the current source
release : docker_base
@if [ -z " $VERSION " ] ; then \
2021-03-25 15:10:16 +03:00
echo "Set the env var VERSION with the release version" ; exit 1; \
2018-03-13 22:19:58 +03:00
fi
2018-03-09 21:56:01 +03:00
mkdir -p releases
docker build -f docker/Dockerfile.release -t vitess/release .
docker run -v ${ PWD } /releases:/vt/releases --env VERSION = $( VERSION) vitess/release
git tag -m Version\ $( VERSION) v$( VERSION)
echo "A git tag was created, you can push it with:"
echo " git push origin v $( VERSION) "
echo " Also, don't forget the upload releases/v $( VERSION) .tar.gz file to GitHub releases "
2019-06-27 01:57:02 +03:00
2021-05-04 12:57:01 +03:00
do_release :
i f n d e f R E L E A S E _ V E R S I O N
echo "Set the env var RELEASE_VERSION with the release version"
exit 1
e n d i f
i f n d e f D E V _ V E R S I O N
echo "Set the env var DEV_VERSION with the version the dev branch should have after release"
exit 1
e n d i f
i f e q ( $( strip $ ( GIT_STATUS ) ) , )
echo so much clean
e l s e
echo cannot do release with dirty git state
exit 1
echo so much win
e n d i f
# Pre checks passed. Let's change the current version
cd java && mvn versions:set -DnewVersion= $( RELEASE_VERSION)
echo package servenv > go/vt/servenv/version.go
echo >> go/vt/servenv/version.go
echo const versionName = \" $( RELEASE_VERSION) \" >> go/vt/servenv/version.go
echo -n Pausing so relase notes can be added. Press enter to continue
read line
git add --all
git commit -n -s -m " Release commit for $( RELEASE_VERSION) "
git tag -m Version\ $( RELEASE_VERSION) v$( RELEASE_VERSION)
cd java && mvn versions:set -DnewVersion= $( DEV_VERSION)
echo package servenv > go/vt/servenv/version.go
echo >> go/vt/servenv/version.go
echo const versionName = \" $( DEV_VERSION) \" >> go/vt/servenv/version.go
git add --all
git commit -n -s -m "Back to dev mode"
echo "Release preparations successful"
echo "A git tag was created, you can push it with:"
echo " git push upstream v $( RELEASE_VERSION) "
echo "The git branch has also been updated. You need to push it and get it merged"
2019-12-07 22:11:06 +03:00
tools :
echo $$ ( date) : Installing dependencies
2020-03-06 10:32:54 +03:00
./bootstrap.sh
2019-12-07 22:11:06 +03:00
minimaltools :
echo $$ ( date) : Installing minimal dependencies
2020-04-01 00:22:01 +03:00
BUILD_CHROME = 0 BUILD_JAVA = 0 BUILD_CONSUL = 0 ./bootstrap.sh
2019-12-07 22:11:06 +03:00
dependency_check :
./tools/dependency_check.sh
2018-12-28 07:24:53 +03:00
2021-03-25 15:10:16 +03:00
install_k8s-code-generator : tools .go go .mod
go install k8s.io/code-generator/cmd/deepcopy-gen
go install k8s.io/code-generator/cmd/client-gen
go install k8s.io/code-generator/cmd/lister-gen
go install k8s.io/code-generator/cmd/informer-gen
DEEPCOPY_GEN = $( GOBIN) /deepcopy-gen
CLIENT_GEN = $( GOBIN) /client-gen
LISTER_GEN = $( GOBIN) /lister-gen
INFORMER_GEN = $( GOBIN) /informer-gen
GEN_BASE_DIR ?= vitess.io/vitess/go/vt/topo/k8stopo
2018-12-28 07:24:53 +03:00
2021-03-25 15:10:16 +03:00
client_go_gen : install_k 8s -code -generator
2018-12-28 07:24:53 +03:00
echo $$ ( date) : Regenerating client-go code
# Delete and re-generate the deepcopy types
2021-03-25 15:10:16 +03:00
find $( VTROOT) /go/vt/topo/k8stopo/apis/topo/v1beta1 -name "zz_generated.deepcopy.go" -delete
2018-12-28 07:24:53 +03:00
2021-03-25 15:10:16 +03:00
# We output to ./ and then copy over the generated files to the appropriate path
# This is done so we don't have rely on the repository being cloned to `$GOPATH/src/vitess.io/vitess`
$( DEEPCOPY_GEN) -o ./ \
--input-dirs $( GEN_BASE_DIR) /apis/topo/v1beta1 \
-O zz_generated.deepcopy \
--bounding-dirs $( GEN_BASE_DIR) /apis \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt
2018-12-28 07:24:53 +03:00
2021-03-25 15:10:16 +03:00
# Delete existing code
rm -rf go/vt/topo/k8stopo/client
2018-12-28 07:24:53 +03:00
2021-03-25 15:10:16 +03:00
# Generate clientset
$( CLIENT_GEN) -o ./ \
--clientset-name versioned \
--input-base $( GEN_BASE_DIR) /apis \
--input 'topo/v1beta1' \
--output-package $( GEN_BASE_DIR) /client/clientset \
--fake-clientset= true \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt
# Generate listers
$( LISTER_GEN) -o ./ \
--input-dirs $( GEN_BASE_DIR) /apis/topo/v1beta1 \
--output-package $( GEN_BASE_DIR) /client/listers \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt
# Generate informers
$( INFORMER_GEN) -o ./ \
--input-dirs $( GEN_BASE_DIR) /apis/topo/v1beta1 \
--output-package $( GEN_BASE_DIR) /client/informers \
--versioned-clientset-package $( GEN_BASE_DIR) /client/clientset/versioned \
--listers-package $( GEN_BASE_DIR) /client/listers \
--go-header-file ./go/vt/topo/k8stopo/boilerplate.go.txt
2018-12-28 07:24:53 +03:00
# Move and cleanup
mv vitess.io/vitess/go/vt/topo/k8stopo/client go/vt/topo/k8stopo/
2021-03-25 15:10:16 +03:00
mv vitess.io/vitess/go/vt/topo/k8stopo/apis/topo/v1beta1/zz_generated.deepcopy.go go/vt/topo/k8stopo/apis/topo/v1beta1/zz_generated.deepcopy.go
rm -rf vitess.io/vitess/go/vt/topo/k8stopo/
2020-07-25 22:11:21 +03:00
# Check prerequisites and install dependencies
web_bootstrap :
./tools/web_bootstrap.sh
# Do a production build of the vtctld UI.
2021-01-28 17:54:07 +03:00
# This target needs to be manually run every time any file within web/vtctld2/app
2020-07-25 22:11:21 +03:00
# is modified to regenerate rice-box.go
web_build : web_bootstrap
./tools/web_build.sh
# Start a front-end dev server with hot reloading on http://localhost:4200.
# This expects that you have a vtctld API server running on http://localhost:15000.
# Following the local Docker install guide is recommended: https://vitess.io/docs/get-started/local-docker/
web_start : web_bootstrap
cd web/vtctld2 && npm run start
2020-12-22 18:36:28 +03:00
2021-01-28 17:54:07 +03:00
vtadmin_web_install :
2020-12-22 18:36:28 +03:00
cd web/vtadmin && npm install
# Generate JavaScript/TypeScript bindings for vtadmin-web from the Vitess .proto files.
# Eventually, we'll want to call this target as part of the standard `make proto` target.
# While vtadmin-web is new and unstable, however, we can keep it out of the critical build path.
vtadmin_web_proto_types : vtadmin_web_install
./web/vtadmin/bin/generate-proto-types.sh
2021-01-07 00:46:42 +03:00
# Generate github CI actions workflow files for unit tests and cluster endtoend tests based on templates in the test/templates directory
# Needs to be called if the templates change or if a new test "shard" is created. We do not need to rebuild tests if only the test/config.json
# is changed by adding a new test to an existing shard. Any new or modified files need to be committed into git
generate_ci_workflows :
cd test && go run ci_workflow_gen.go && cd ..
2021-04-23 17:04:38 +03:00
release-notes :
go run ./go/tools/release-notes -from $( FROM) -to $( TO)