Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "gazelle")

go_prefix("github.com/weaveworks/cortex")
gazelle(
name = "gazelle",
args = [
"-build_file_name",
"BUILD.bazel",
],
external = "vendored",
prefix = "github.com/weaveworks/cortex",
)
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all test clean images
.PHONY: all test clean images protos
.DEFAULT_GOAL := all

# Boiler plate for bulding Docker containers.
Expand Down Expand Up @@ -45,6 +45,7 @@ pkg/ingester/client/cortex.pb.go: pkg/ingester/client/cortex.proto
pkg/ring/ring.pb.go: pkg/ring/ring.proto
all: $(UPTODATE_FILES)
test: $(PROTO_GOS)
protos: $(PROTO_GOS)

# And now what goes into each image
build-image/$(UPTODATE): build-image/*
Expand Down Expand Up @@ -118,16 +119,15 @@ clean:
# gazelle - https://github.com/bazelbuild/rules_go/issues/422
# and https://github.com/bazelbuild/rules_go/issues/423. If you ever regenerate
# the BUILD files, watch out for the rules in vendor/golang.org/x/crypto/curve25519
update-gazelle:
gazelle -go_prefix github.com/weaveworks/cortex -external vendored \
-build_file_name BUILD.bazel
update-gazelle: $(PROTOS_GO)
bazel run //:gazelle

update-vendor:
dep ensure && dep prune
git status | grep BUILD.bazel | cut -d' ' -f 5 | xargs git checkout HEAD

bazel:
bazel: $(PROTOS_GO)
bazel build //cmd/...

bazel-test:
bazel-test: $(PROTOS_GO)
bazel test //pkg/...
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ bazel](https://bazel.build/versions/master/docs/install.html), try these command
make bazel-test
make bazel

This will require Bazel 0.5.4 or later.

Bazel can be useful for running fast, local, incremental builds and tests.
Currently [bazel does not support cross-compiling](https://github.com/bazelbuild/rules_go/issues/70)
so it is not used to produce the final binaries and docker container images.
Expand Down
15 changes: 10 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
git_repository(
http_archive(
name = "io_bazel_rules_go",
remote = "https://github.com/bazelbuild/rules_go.git",
commit = "9bd1d8969862baac16540d44d2cf87f6a44e7734",
url = "https://codeload.github.com/bazelbuild/rules_go/zip/bd13f2d59c804acae7ca8c18fdeb4bf0ecfa1e93",
strip_prefix = "rules_go-bd13f2d59c804acae7ca8c18fdeb4bf0ecfa1e93",
sha256 = "c69276b005648bfd6f9961f943b14742b221958cc88ff71ffda30e2605e3b599",
type = "zip",
)
load("@io_bazel_rules_go//go:def.bzl", "go_repositories")

go_repositories()
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
load("@io_bazel_rules_go//proto:def.bzl", "proto_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
proto_register_toolchains()
2 changes: 2 additions & 0 deletions cmd/alertmanager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/alertmanager",
visibility = ["//visibility:private"],
deps = [
"//pkg/alertmanager:go_default_library",
Expand All @@ -15,6 +16,7 @@ go_library(

go_binary(
name = "alertmanager",
importpath = "github.com/weaveworks/cortex/cmd/alertmanager",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/configs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/configs",
visibility = ["//visibility:private"],
deps = [
"//pkg/configs/api:go_default_library",
Expand All @@ -17,6 +18,7 @@ go_library(

go_binary(
name = "configs",
importpath = "github.com/weaveworks/cortex/cmd/configs",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/distributor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/distributor",
visibility = ["//visibility:private"],
deps = [
"//pkg/distributor:go_default_library",
Expand All @@ -18,6 +19,7 @@ go_library(

go_binary(
name = "distributor",
importpath = "github.com/weaveworks/cortex/cmd/distributor",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/ingester/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/ingester",
visibility = ["//visibility:private"],
deps = [
"//pkg/chunk:go_default_library",
Expand All @@ -20,6 +21,7 @@ go_library(

go_binary(
name = "ingester",
importpath = "github.com/weaveworks/cortex/cmd/ingester",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/lite/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/lite",
visibility = ["//visibility:private"],
deps = [
"//pkg/chunk:go_default_library",
Expand All @@ -29,6 +30,7 @@ go_library(

go_binary(
name = "lite",
importpath = "github.com/weaveworks/cortex/cmd/lite",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/querier/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/querier",
visibility = ["//visibility:private"],
deps = [
"//pkg/chunk:go_default_library",
Expand All @@ -25,6 +26,7 @@ go_library(

go_binary(
name = "querier",
importpath = "github.com/weaveworks/cortex/cmd/querier",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/ruler/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/ruler",
visibility = ["//visibility:private"],
deps = [
"//pkg/chunk:go_default_library",
Expand All @@ -21,6 +22,7 @@ go_library(

go_binary(
name = "ruler",
importpath = "github.com/weaveworks/cortex/cmd/ruler",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions cmd/table-manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/weaveworks/cortex/cmd/table-manager",
visibility = ["//visibility:private"],
deps = [
"//pkg/chunk:go_default_library",
Expand All @@ -17,6 +18,7 @@ go_library(

go_binary(
name = "table-manager",
importpath = "github.com/weaveworks/cortex/cmd/table-manager",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions pkg/alertmanager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ go_library(
"multitenant.go",
"peers.go",
],
importpath = "github.com/weaveworks/cortex/pkg/alertmanager",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs:go_default_library",
Expand Down
5 changes: 5 additions & 0 deletions pkg/chunk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ go_library(
"table_client.go",
"table_manager.go",
],
importpath = "github.com/weaveworks/cortex/pkg/chunk",
visibility = ["//visibility:public"],
deps = [
"//pkg/util:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/client:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/credentials:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library",
Expand Down Expand Up @@ -66,12 +68,15 @@ go_test(
"schema_util_test.go",
"table_manager_test.go",
],
importpath = "github.com/weaveworks/cortex/pkg/chunk",
library = ":go_default_library",
deps = [
"//pkg/util:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/applicationautoscalingiface:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/dynamodb:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/s3:go_default_library",
Expand Down
4 changes: 4 additions & 0 deletions pkg/chunk/gcp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ go_library(
"storage_client.go",
"table_client.go",
],
importpath = "github.com/weaveworks/cortex/pkg/chunk/gcp",
visibility = ["//visibility:public"],
deps = [
"//pkg/chunk:go_default_library",
"//pkg/util:go_default_library",
"//vendor/cloud.google.com/go/bigtable:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/dynamodb:go_default_library",
"//vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc:go_default_library",
"//vendor/github.com/mwitkow/go-grpc-middleware:go_default_library",
"//vendor/github.com/opentracing/opentracing-go:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
"//vendor/github.com/weaveworks/common/instrument:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/api/option:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/google.golang.org/grpc/metadata:go_default_library",
"//vendor/google.golang.org/grpc/status:go_default_library",
],
)
1 change: 1 addition & 0 deletions pkg/chunk/storage/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["factory.go"],
importpath = "github.com/weaveworks/cortex/pkg/chunk/storage",
visibility = ["//visibility:public"],
deps = [
"//pkg/chunk:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions pkg/configs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["configs.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs",
visibility = ["//visibility:public"],
)
2 changes: 2 additions & 0 deletions pkg/configs/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["api.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/api",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs:go_default_library",
Expand All @@ -20,6 +21,7 @@ go_test(
"api_test.go",
"helpers_test.go",
],
importpath = "github.com/weaveworks/cortex/pkg/configs/api_test",
deps = [
":go_default_library",
"//pkg/configs:go_default_library",
Expand Down
2 changes: 2 additions & 0 deletions pkg/configs/client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["configs.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/client",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs:go_default_library",
Expand All @@ -16,6 +17,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["configs_test.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/client",
library = ":go_default_library",
deps = [
"//pkg/configs:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions pkg/configs/db/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go_library(
"timed.go",
"traced.go",
],
importpath = "github.com/weaveworks/cortex/pkg/configs/db",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions pkg/configs/db/dbtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["unit.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/db/dbtest",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs/db:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions pkg/configs/db/memory/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["memory.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/db/memory",
visibility = ["//visibility:public"],
deps = ["//pkg/configs:go_default_library"],
)
1 change: 1 addition & 0 deletions pkg/configs/db/postgres/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["postgres.go"],
importpath = "github.com/weaveworks/cortex/pkg/configs/db/postgres",
visibility = ["//visibility:public"],
deps = [
"//pkg/configs:go_default_library",
Expand Down
2 changes: 2 additions & 0 deletions pkg/distributor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go_library(
"distributor.go",
"http_server.go",
],
importpath = "github.com/weaveworks/cortex/pkg/distributor",
visibility = ["//visibility:public"],
deps = [
"//pkg/ingester/client:go_default_library",
Expand All @@ -30,6 +31,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["distributor_test.go"],
importpath = "github.com/weaveworks/cortex/pkg/distributor",
library = ":go_default_library",
deps = [
"//pkg/ingester/client:go_default_library",
Expand Down
2 changes: 2 additions & 0 deletions pkg/ingester/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go_library(
"user_state.go",
"util.go",
],
importpath = "github.com/weaveworks/cortex/pkg/ingester",
visibility = ["//visibility:public"],
deps = [
"//pkg/chunk:go_default_library",
Expand Down Expand Up @@ -43,6 +44,7 @@ go_test(
"mapper_test.go",
"rate_test.go",
],
importpath = "github.com/weaveworks/cortex/pkg/ingester",
library = ":go_default_library",
deps = [
"//pkg/chunk:go_default_library",
Expand Down
Loading