Skip to content

Commit f329b4e

Browse files
committed
Bazelize bump
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.
1 parent 0a4afe6 commit f329b4e

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
bin/
33
build/artifacts
4+
bazel-*

Diff for: BUILD.bazel

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
load("@bazel_gazelle//:def.bzl", "gazelle")
2+
3+
# to regenerate BUILD files, run `bazel run //:gazelle -- -go_prefix github.com/cockroachdb/helm-charts build`
4+
gazelle(name = "gazelle")

Diff for: WORKSPACE

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
workspace(name = "com_github_coachroachdb_helm_charts")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "io_bazel_rules_go",
7+
sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
8+
urls = [
9+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
10+
"https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
11+
],
12+
)
13+
14+
http_archive(
15+
name = "bazel_gazelle",
16+
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
17+
urls = [
18+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
19+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
20+
],
21+
)
22+
23+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
24+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
25+
26+
go_rules_dependencies()
27+
go_register_toolchains(version = "1.18")
28+
gazelle_dependencies()
29+
30+
go_repository(
31+
name = "in_gopkg_yaml_v3",
32+
build_file_proto_mode = "disable_global",
33+
importpath = "gopkg.in/yaml.v3",
34+
sha256 = "5169b5625d3c351f13e8a4ec4802f709072701b441ed92181c6051ece53615a9",
35+
strip_prefix = "gopkg.in/[email protected]",
36+
urls = [
37+
"https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/yaml.v3/in_gopkg_yaml_v3-v3.0.0-20210107192922-496545a6307b.zip",
38+
],
39+
)
40+
go_repository(
41+
name = "com_github_masterminds_semver_v3",
42+
build_file_proto_mode = "disable_global",
43+
importpath = "github.com/Masterminds/semver/v3",
44+
sha256 = "0a46c7403dfeda09b0821e851f8e1cec8f1ea4276281e42ea399da5bc5bf0704",
45+
strip_prefix = "github.com/Masterminds/semver/[email protected]",
46+
urls = [
47+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/Masterminds/semver/v3/com_github_masterminds_semver_v3-v3.1.1.zip",
48+
],
49+
)

Diff for: build/BUILD.bazel

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
3+
go_library(
4+
name = "lib",
5+
srcs = ["bump.go"],
6+
importpath = "",
7+
visibility = ["//visibility:private"],
8+
deps = [
9+
"@com_github_masterminds_semver_v3//:semver",
10+
"@in_gopkg_yaml_v3//:yaml_v3",
11+
],
12+
)
13+
14+
go_binary(
15+
name = "build",
16+
embed = [":build_lib"],
17+
visibility = ["//visibility:public"],
18+
)
19+
20+
go_library(
21+
name = "build_lib",
22+
srcs = ["bump.go"],
23+
importpath = "github.com/cockroachdb/helm-charts/build",
24+
visibility = ["//visibility:private"],
25+
deps = [
26+
"@com_github_masterminds_semver_v3//:semver",
27+
"@in_gopkg_yaml_v3//:yaml_v3",
28+
],
29+
)

0 commit comments

Comments
 (0)