Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 76a6dd6

Browse files
authored
Merge pull request #4 from ProdriveTechnologies/bazel
Bazelify building the exporter
2 parents a3fc3fc + 123d51a commit 76a6dd6

File tree

5 files changed

+122
-23
lines changed

5 files changed

+122
-23
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/hpraid_exporter
1+
/bazel-*

BUILD.bazel

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
load("@bazel_gazelle//:def.bzl", "gazelle")
3+
4+
# gazelle:prefix github.com/ProdriveTechnologies/hpraid_exporter
5+
gazelle(
6+
name = "gazelle",
7+
)
8+
9+
go_library(
10+
name = "go_default_library",
11+
srcs = ["hpraid_exporter.go"],
12+
importpath = "github.com/ProdriveTechnologies/hpraid_exporter",
13+
visibility = ["//visibility:private"],
14+
deps = [
15+
"@com_github_prometheus_client_golang//prometheus:go_default_library",
16+
"@com_github_prometheus_common//log:go_default_library",
17+
],
18+
)
19+
20+
go_binary(
21+
name = "hpraid_exporter",
22+
embed = [":go_default_library"],
23+
visibility = ["//visibility:public"],
24+
pure = "on",
25+
)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ Though this exporter only provide metrics for errors for the time being
2424
attributes. All of those metrics should already be part of the
2525
`ADUReport.xml` file that is used by this exporter.
2626

27-
## Using this exporter
27+
## Building this exporter
28+
29+
The exporter can be built using Bazel:
2830

29-
The following shell script around Docker can be used to build a
30-
statically linked executable that can be deployed on virtually any
31-
x86-based Linux system:
31+
bazel build //...
3232

33-
./build_static.sh
33+
## Using this exporter
3434

3535
The following command will start the exporter, causing it to listen on
3636
TCP port 9423:

WORKSPACE

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
workspace(name = "hpraid_exporter")
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 = "7be7dc01f1e0afdba6c8eb2b43d2fa01c743be1b9273ab1eaf6c233df078d705",
8+
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.16.5/rules_go-0.16.5.tar.gz"],
9+
)
10+
11+
http_archive(
12+
name = "bazel_gazelle",
13+
sha256 = "bc653d3e058964a5a26dcad02b6c72d7d63e6bb88d94704990b908a1445b8758",
14+
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.13.0/bazel-gazelle-0.13.0.tar.gz"],
15+
)
16+
17+
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
18+
19+
go_rules_dependencies()
20+
21+
go_register_toolchains()
22+
23+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
24+
25+
gazelle_dependencies()
26+
27+
go_repository(
28+
name = "com_github_prometheus_common",
29+
commit = "2998b132700a7d019ff618c06a234b47c1f3f681",
30+
importpath = "github.com/prometheus/common",
31+
)
32+
33+
go_repository(
34+
name = "com_github_prometheus_client_golang",
35+
commit = "d2ead25884778582e740573999f7b07f47e171b4",
36+
importpath = "github.com/prometheus/client_golang",
37+
)
38+
39+
go_repository(
40+
name = "com_github_prometheus_client_model",
41+
commit = "f287a105a20ec685d797f65cd0ce8fbeaef42da1",
42+
importpath = "github.com/prometheus/client_model",
43+
)
44+
45+
go_repository(
46+
name = "com_github_prometheus_procfs",
47+
commit = "b1a0a9a36d7453ba0f62578b99712f3a6c5f82d1",
48+
importpath = "github.com/prometheus/procfs",
49+
)
50+
51+
go_repository(
52+
name = "com_github_sirupsen_logrus",
53+
commit = "78fb3852d92683dc28da6cc3d5f965100677c27d",
54+
importpath = "github.com/sirupsen/logrus",
55+
)
56+
57+
go_repository(
58+
name = "in_gopkg_alecthomas_kingpin_v2",
59+
commit = "947dcec5ba9c011838740e680966fd7087a71d0d",
60+
importpath = "gopkg.in/alecthomas/kingpin.v2",
61+
)
62+
63+
go_repository(
64+
name = "com_github_beorn7_perks",
65+
commit = "3a771d992973f24aa725d07868b467d1ddfceafb",
66+
importpath = "github.com/beorn7/perks",
67+
)
68+
69+
go_repository(
70+
name = "com_github_alecthomas_units",
71+
commit = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a",
72+
importpath = "github.com/alecthomas/units",
73+
)
74+
75+
go_repository(
76+
name = "org_golang_x_crypto",
77+
commit = "ff983b9c42bc9fbf91556e191cc8efb585c16908",
78+
importpath = "golang.org/x/crypto",
79+
)
80+
81+
go_repository(
82+
name = "com_github_alecthomas_template",
83+
commit = "a0175ee3bccc567396460bf5acd36800cb10c49c",
84+
importpath = "github.com/alecthomas/template",
85+
)
86+
87+
go_repository(
88+
name = "com_github_matttproud_golang_protobuf_extensions",
89+
commit = "c182affec369e30f25d3eb8cd8a478dee585ae7d",
90+
importpath = "github.com/matttproud/golang_protobuf_extensions",
91+
)

build_static.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)