This command will build and publish cloud-controller-manager
registry.k8s.io/k8s-image-staging/cloud-controller-manager:latest:
bazel run //cmd/cloud-controller-manager:publishEnvironment variables IMAGE_REGISTRY, IMAGE_REPO and IMAGE_TAG can be
used to override destination GCR repository and tag.
This command will build and publish
example.com/my-repo/cloud-controller-manager:v1:
IMAGE_REGISTRY=example.com IMAGE_REPO=my-repo IMAGE_TAG=v1 bazel run //cmd/cloud-controller-manager:publishAlternatively, you can run push-images tool. The tool is built from ko that does not depend on bazel, for example this command pushes image to Google Artifact Registry under project my-project and existing repository my-repo:
IMAGE_REPO=us-central1-docker.pkg.dev/my-project/my-repo IMAGE_TAG=v0 ./tools/push-imagesSelecting the target platform is done with the --platforms option with bazel.
This command builds release tarballs for Windows:
bazel build --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //release:release-tarsThis command explicitly targets Linux as the target platform:
bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //release:release-tarsDependencies are managed using Go modules (go mod subcommands).
Note that builds are done with Bazel and not the Go tool. Don't follow public Go module docs, instead use instructions in this readme.
If you work within GOPATH, go mod will error out unless you do one of:
- move repo outside of GOPATH (it should "just work")
- set env var
GO111MODULE=on
go get github.com/new/dependency && ./tools/update_vendor.shgo get -u github.com/existing/dependency && ./tools/update_vendor.shgo get -u && ./tools/update_vendor.shNote that this most likely won't work due to cross-dependency issues or repos not implementing modules correctly.
Bazel is required to build and release cloud-provider-gcp.
To install:
go get github.com/bazelbuild/bazelisk
alias bazel=bazeliskTo re-generate BUILD files:
tools/update_bazel.sh