Skip to content

Commit

Permalink
Bazelize bump
Browse files Browse the repository at this point in the history
Previously, running the release version bump run book required Go
pre-installed. It is not the case in our Bazel CI images.

This PR adds Bazel support for the bumper binary.
  • Loading branch information
rail committed Aug 5, 2022
1 parent 0a4afe6 commit f329b4e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
bin/
build/artifacts
bazel-*
4 changes: 4 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@bazel_gazelle//:def.bzl", "gazelle")

# to regenerate BUILD files, run `bazel run //:gazelle -- -go_prefix github.com/cockroachdb/helm-charts build`
gazelle(name = "gazelle")
49 changes: 49 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
workspace(name = "com_github_coachroachdb_helm_charts")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

go_rules_dependencies()
go_register_toolchains(version = "1.18")
gazelle_dependencies()

go_repository(
name = "in_gopkg_yaml_v3",
build_file_proto_mode = "disable_global",
importpath = "gopkg.in/yaml.v3",
sha256 = "5169b5625d3c351f13e8a4ec4802f709072701b441ed92181c6051ece53615a9",
strip_prefix = "gopkg.in/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/yaml.v3/in_gopkg_yaml_v3-v3.0.0-20210107192922-496545a6307b.zip",
],
)
go_repository(
name = "com_github_masterminds_semver_v3",
build_file_proto_mode = "disable_global",
importpath = "github.com/Masterminds/semver/v3",
sha256 = "0a46c7403dfeda09b0821e851f8e1cec8f1ea4276281e42ea399da5bc5bf0704",
strip_prefix = "github.com/Masterminds/semver/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/Masterminds/semver/v3/com_github_masterminds_semver_v3-v3.1.1.zip",
],
)
29 changes: 29 additions & 0 deletions build/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "lib",
srcs = ["bump.go"],
importpath = "",
visibility = ["//visibility:private"],
deps = [
"@com_github_masterminds_semver_v3//:semver",
"@in_gopkg_yaml_v3//:yaml_v3",
],
)

go_binary(
name = "build",
embed = [":build_lib"],
visibility = ["//visibility:public"],
)

go_library(
name = "build_lib",
srcs = ["bump.go"],
importpath = "github.com/cockroachdb/helm-charts/build",
visibility = ["//visibility:private"],
deps = [
"@com_github_masterminds_semver_v3//:semver",
"@in_gopkg_yaml_v3//:yaml_v3",
],
)

0 comments on commit f329b4e

Please sign in to comment.