-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBUILD.bazel
119 lines (107 loc) · 2.73 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
buildifier(
name = "buildifier",
)
# gazelle:prefix github.com/dolthub/doltclusterctl
# gazelle:exclude proto
# gazelle:proto disable_global
# gazelle:go_naming_convention import
gazelle(name = "gazelle")
gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=deps.bzl%go_dependencies",
"-prune",
"-build_file_proto_mode",
"disable_global",
],
command = "update-repos",
)
go_library(
name = "doltclusterctl_lib",
srcs = [
"cluster.go",
"commands.go",
"config.go",
"db.go",
"kubernetes.go",
"main.go",
"version.go",
],
importpath = "github.com/dolthub/doltclusterctl",
visibility = ["//visibility:private"],
deps = [
"@com_github_cenkalti_backoff_v4//:backoff",
"@com_github_go_sql_driver_mysql//:mysql",
"@io_k8s_api//apps/v1:apps",
"@io_k8s_api//core/v1:core",
"@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
"@io_k8s_apimachinery//pkg/fields",
"@io_k8s_apimachinery//pkg/watch",
"@io_k8s_client_go//kubernetes",
"@io_k8s_client_go//rest",
],
)
go_binary(
name = "doltclusterctl",
embed = [":doltclusterctl_lib"],
visibility = ["//visibility:public"],
)
go_binary(
name = "doltclusterctl_linux_amd64",
embed = [":doltclusterctl_lib"],
goarch = "amd64",
goos = "linux",
visibility = ["//visibility:public"],
)
pkg_tar(
name = "app_layer",
srcs = [":doltclusterctl_linux_amd64"],
include_runfiles = True,
package_dir = "app",
)
pkg_tar(
name = "image_layer",
symlinks = {
"/usr/local/bin/doltclusterctl": "/app/doltclusterctl_linux_amd64",
},
deps = [":app_layer"],
)
oci_image(
name = "image",
base = "@ubuntu2004",
tars = [
":image_layer",
],
visibility = ["//visibility:public"],
)
oci_tarball(
name = "image.tar",
image = ":image",
repo_tags = ["doltclusterctl:latest"],
visibility = ["//visibility:public"],
)
go_test(
name = "doltclusterctl_test",
size = "small",
srcs = [
"commands_test.go",
"config_test.go",
"main_test.go",
"version_test.go",
],
data = glob(["testdata/**"]),
embed = [":doltclusterctl_lib"],
deps = ["@com_github_stretchr_testify//assert"],
)
test_suite(
name = "coverage_tests",
tests = [
":doltclusterctl_test",
],
)