From a5e7812ecd58395e3971f5b48c1108fb339e3d43 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Fri, 17 Jun 2016 07:22:03 -0400 Subject: [PATCH] Experimental bazel support --- BUILD | 5 + WORKSPACE | 65 ++++ cmd/aws-controller/BUILD | 18 + images/aws-controller/BUILD | 8 + images/jessie/BUILD | 25 ++ pkg/BUILD | 61 ++++ vendor/github.com/aws/aws-sdk-go/BUILD | 348 +++++++++++++++++++ vendor/github.com/go-ini/ini/BUILD | 13 + vendor/github.com/golang/glog/BUILD | 13 + vendor/github.com/jmespath/go-jmespath/BUILD | 13 + vendor/github.com/spf13/pflag/BUILD | 13 + vendor/k8s.io/kubernetes/BUILD | 28 ++ 12 files changed, 610 insertions(+) create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 cmd/aws-controller/BUILD create mode 100644 images/aws-controller/BUILD create mode 100644 images/jessie/BUILD create mode 100644 pkg/BUILD create mode 100644 vendor/github.com/aws/aws-sdk-go/BUILD create mode 100644 vendor/github.com/go-ini/ini/BUILD create mode 100644 vendor/github.com/golang/glog/BUILD create mode 100644 vendor/github.com/jmespath/go-jmespath/BUILD create mode 100644 vendor/github.com/spf13/pflag/BUILD create mode 100644 vendor/k8s.io/kubernetes/BUILD diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..46d799c --- /dev/null +++ b/BUILD @@ -0,0 +1,5 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_prefix") + +go_prefix("github.com/kopeio/aws-controller") + + diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..8f7865e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,65 @@ +git_repository( + name = "io_bazel_rules_go", + remote = "https://github.com/bazelbuild/rules_go.git", + commit = "53d012d785e2d5c693627c27b95c4185bbeb7d36", +) +load("@io_bazel_rules_go//go:def.bzl", "go_repositories") + +go_repositories() + + + +http_file( + name = "pkg_coreutils", + url = "http://ftp.us.debian.org/debian/pool/main/c/coreutils/coreutils_8.23-4_amd64.deb" +) + +http_file( + name = "pkg_libacl1", + url = "http://ftp.us.debian.org/debian/pool/main/a/acl/libacl1_2.2.52-2_amd64.deb" +) + +http_file( + name = "pkg_libattr1", + url = "http://ftp.us.debian.org/debian/pool/main/a/attr/libattr1_2.4.47-2_amd64.deb" +) + +http_file( + name = "pkg_libc6", + url = "http://ftp.us.debian.org/debian/pool/main/g/glibc/libc6_2.19-18+deb8u4_amd64.deb" +) + +http_file( + name = "pkg_libselinux1", + url = "http://ftp.us.debian.org/debian/pool/main/libs/libselinux/libselinux1_2.3-2_amd64.deb" +) + +http_file( + name = "pkg_libpcre3", + url = "http://ftp.us.debian.org/debian/pool/main/p/pcre3/libpcre3_8.35-3.3+deb8u4_amd64.deb" +) + +http_file( + name = "pkg_libgcc1", + url = "http://ftp.us.debian.org/debian/pool/main/g/gcc-4.9/libgcc1_4.9.2-10_amd64.deb" +) + +http_file( + name = "pkg_gcc_4_9_base", + url = "http://ftp.us.debian.org/debian/pool/main/g/gcc-4.9/gcc-4.9-base_4.9.2-10_amd64.deb" +) + +http_file( + name = "pkg_dash", + url = "http://ftp.us.debian.org/debian/pool/main/d/dash/dash_0.5.7-4+b1_amd64.deb" +) + +http_file( + name = "pkg_debianutils", + url = "http://ftp.us.debian.org/debian/pool/main/d/debianutils/debianutils_4.4+b1_amd64.deb" +) + +http_file( + name = "pkg_sensible_utils", + url = "http://ftp.us.debian.org/debian/pool/main/s/sensible-utils/sensible-utils_0.0.9_all.deb" +) diff --git a/cmd/aws-controller/BUILD b/cmd/aws-controller/BUILD new file mode 100644 index 0000000..ca96c5c --- /dev/null +++ b/cmd/aws-controller/BUILD @@ -0,0 +1,18 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_binary") + +go_binary( + name = "aws-controller", + srcs = glob( + include = ["*.go"], + exclude = ["*_test.go"], + ), + deps = [ + "//vendor/github.com/golang/glog:go_default_library", + "//vendor/github.com/spf13/pflag:go_default_library", + "//pkg:awscontroller/instances", + "//pkg:kope", + "//pkg:kope/kopeaws", + ], +) diff --git a/images/aws-controller/BUILD b/images/aws-controller/BUILD new file mode 100644 index 0000000..92c0249 --- /dev/null +++ b/images/aws-controller/BUILD @@ -0,0 +1,8 @@ +load("@bazel_tools//tools/build_defs/docker:docker.bzl", "docker_build") + +docker_build( + name = "aws-controller", + base = "//images/jessie:dash", + files = [ "//cmd/aws-controller", ], + cmd = [ "/aws-controller" ], +) diff --git a/images/jessie/BUILD b/images/jessie/BUILD new file mode 100644 index 0000000..11c685f --- /dev/null +++ b/images/jessie/BUILD @@ -0,0 +1,25 @@ +package(default_visibility = ["//visibility:public"]) + +load("@bazel_tools//tools/build_defs/docker:docker.bzl", "docker_build") + +docker_build( + name = "minimal", + debs = [ "@pkg_coreutils//file", + "@pkg_libacl1//file", + "@pkg_libattr1//file", + "@pkg_libc6//file", + "@pkg_libselinux1//file", + "@pkg_libpcre3//file", + "@pkg_libgcc1//file", + "@pkg_gcc_4_9_base//file" + ], + cmd = [ "/bin/ls", "/" ], +) + +docker_build( + name = "dash", + base = "minimal", + debs = [ "@pkg_dash//file", + ], + cmd = [ "/bin/ls", "/" ], +) diff --git a/pkg/BUILD b/pkg/BUILD new file mode 100644 index 0000000..03d9699 --- /dev/null +++ b/pkg/BUILD @@ -0,0 +1,61 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "awscontroller/instances", + srcs = glob( + include = ["awscontroller/instances/*.go"], + exclude = ["awscontroller/instances/*_test.go"], + ), + deps = [ + ":kope", + ":kope/kopeaws", + "//vendor/github.com/golang/glog:go_default_library", + "//vendor/github.com/spf13/pflag:go_default_library", + "//vendor/github.com/aws/aws-sdk-go:aws", + "//vendor/github.com/aws/aws-sdk-go:service/ec2", + "//vendor/k8s.io/kubernetes:pkg/util/runtime", + "//vendor/k8s.io/kubernetes:pkg/util/wait", + ], +) + +go_library( + name = "kope", + srcs = glob( + include = ["kope/*.go"], + exclude = ["kope/*_test.go"], + ), + deps = [ + "//vendor/github.com/golang/glog:go_default_library", + ], +) + +go_library( + name = "kope/kopeaws", + srcs = glob( + include = ["kope/kopeaws/*.go"], + exclude = ["kope/kopeaws/*_test.go"], + ), + deps = [ + ":kope", + ":kope/utils", + "//vendor/github.com/golang/glog:go_default_library", + "//vendor/github.com/aws/aws-sdk-go:aws", + "//vendor/github.com/aws/aws-sdk-go:aws/ec2metadata", + "//vendor/github.com/aws/aws-sdk-go:aws/request", + "//vendor/github.com/aws/aws-sdk-go:aws/session", + "//vendor/github.com/aws/aws-sdk-go:service/ec2", + "//vendor/github.com/aws/aws-sdk-go:service/route53", + ], +) + +go_library( + name = "kope/utils", + srcs = glob( + include = ["kope/utils/*.go"], + exclude = ["kope/utils/*_test.go"], + ), + deps = [ + ], +) diff --git a/vendor/github.com/aws/aws-sdk-go/BUILD b/vendor/github.com/aws/aws-sdk-go/BUILD new file mode 100644 index 0000000..07615af --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/BUILD @@ -0,0 +1,348 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("github.com/aws/aws-sdk-go") + +go_library( + name = "go_default_library", + srcs = glob( + include = ["*.go"], + exclude = ["*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/awsutil", + ], +) + +go_library( + name = "aws", + srcs = glob( + include = ["aws/*.go"], + exclude = ["aws/*_test.go"], + ), + deps = [ + ":aws/credentials", + ":aws/awserr", + ], +) + + +go_library( + name = "aws/awsutil", + srcs = glob( + include = ["aws/awsutil/*.go"], + exclude = ["aws/awsutil/*_test.go"], + ), + deps = [ + "//vendor/github.com/jmespath/go-jmespath:go_default_library", + ], +) + + +go_library( + name = "aws/awserr", + srcs = glob( + include = ["aws/awserr/*.go"], + exclude = ["aws/awserr/*_test.go"], + ), +) + + +go_library( + name = "aws/client", + srcs = glob( + include = ["aws/client/*.go"], + exclude = ["aws/client/*_test.go"], + ), + deps = [ + ":aws", + ":aws/client/metadata", + ":aws/request", + ], +) + +go_library( + name = "aws/client/metadata", + srcs = glob( + include = ["aws/client/metadata/*.go"], + exclude = ["aws/client/metadata/*_test.go"], + ), + deps = [ + ":aws/awserr", + ], +) + +go_library( + name = "aws/corehandlers", + srcs = glob( + include = ["aws/corehandlers/*.go"], + exclude = ["aws/corehandlers/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/request", + ], +) + + +go_library( + name = "aws/credentials", + srcs = glob( + include = ["aws/credentials/*.go"], + exclude = ["aws/credentials/*_test.go"], + ), + deps = [ + ":aws/awserr", + "//vendor/github.com/go-ini/ini:go_default_library", + ], +) + + +go_library( + name = "aws/credentials/ec2rolecreds", + srcs = glob( + include = ["aws/credentials/ec2rolecreds/*.go"], + exclude = ["aws/credentials/ec2rolecreds/*_test.go"], + ), + deps = [ + ":aws/awserr", + ":aws/client", + ":aws/credentials", + ":aws/ec2metadata", + ], +) + + +go_library( + name = "aws/defaults", + srcs = glob( + include = ["aws/defaults/*.go"], + exclude = ["aws/defaults/*_test.go"], + ), + deps = [ + ":aws", + ":aws/corehandlers", + ":aws/credentials", + ":aws/credentials/ec2rolecreds", + ":aws/ec2metadata", + ":aws/request", + ":private/endpoints", + ], +) + + +go_library( + name = "aws/ec2metadata", + srcs = glob( + include = ["aws/ec2metadata/*.go"], + exclude = ["aws/ec2metadata/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/client", + ":aws/client/metadata", + ":aws/request", + ], +) + + +go_library( + name = "aws/request", + srcs = glob( + include = ["aws/request/*.go"], + exclude = ["aws/request/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/awsutil", + ":aws/client/metadata", + ], +) + + +go_library( + name = "aws/session", + srcs = glob( + include = ["aws/session/*.go"], + exclude = ["aws/session/*_test.go"], + ), + deps = [ + ":aws", + ":aws/client", + ":aws/corehandlers", + ":aws/defaults", + ":aws/request", + ":private/endpoints", + ], +) + +go_library( + name = "private/endpoints", + srcs = glob( + include = ["private/endpoints/*.go"], + exclude = ["private/endpoints/*_test.go"], + ), + deps = [ + ":aws", + ], +) + + +go_library( + name = "private/protocol/ec2query", + srcs = glob( + include = ["private/protocol/ec2query/*.go"], + exclude = ["private/protocol/ec2query/*_test.go"], + ), + deps = [ + ":aws/awserr", + ":aws/request", + ":private/protocol/query/queryutil", + ":private/protocol/xml/xmlutil", + ], +) + + +go_library( + name = "private/protocol/query", + srcs = glob( + include = ["private/protocol/query/*.go"], + exclude = ["private/protocol/query/*_test.go"], + ), + deps = [ + ":aws/awserr", + ":aws/request", + ":private/protocol/query/queryutil", + ":private/protocol/xml/xmlutil", + ], +) + +go_library( + name = "private/protocol/query/queryutil", + srcs = glob( + include = ["private/protocol/query/queryutil/*.go"], + exclude = ["private/protocol/query/queryutil/*_test.go"], + ), + deps = [ + ":aws/awserr", + ], +) + +go_library( + name = "private/protocol/rest", + srcs = glob( + include = ["private/protocol/rest/*.go"], + exclude = ["private/protocol/rest/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/request", + ], +) + + +go_library( + name = "private/protocol/restxml", + srcs = glob( + include = ["private/protocol/restxml/*.go"], + exclude = ["private/protocol/restxml/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/request", + ":private/protocol/query", + ":private/protocol/rest", + ":private/protocol/xml/xmlutil", + ], +) + + +go_library( + name = "private/protocol/xml/xmlutil", + srcs = glob( + include = ["private/protocol/xml/xmlutil/*.go"], + exclude = ["private/protocol/xml/xmlutil/*_test.go"], + ), + deps = [ + ":aws/awserr", + ], +) + + +go_library( + name = "private/signer/v4", + srcs = glob( + include = ["private/signer/v4/*.go"], + exclude = ["private/signer/v4/*_test.go"], + ), + deps = [ + ":aws", + ":aws/credentials", + ":aws/request", + ":private/protocol/rest", + ], +) + + +go_library( + name = "private/waiter", + srcs = glob( + include = ["private/waiter/*.go"], + exclude = ["private/waiter/*_test.go"], + ), + deps = [ + ":aws", + ":aws/awserr", + ":aws/awsutil", + ":aws/request", + ], +) + + +go_library( + name = "service/ec2", + srcs = glob( + include = ["service/ec2/*.go"], + exclude = ["service/ec2/*_test.go"], + ), + deps = [ + ":aws", + ":aws/client", + ":aws/client/metadata", + ":aws/awsutil", + ":aws/request", + ":private/endpoints", + ":private/signer/v4", + ":private/protocol/ec2query", + ":private/waiter", + ], +) + + +go_library( + name = "service/route53", + srcs = glob( + include = ["service/route53/*.go"], + exclude = ["service/route53/*_test.go"], + ), + deps = [ + ":aws", + ":aws/client", + ":aws/client/metadata", + ":aws/awsutil", + ":aws/request", + ":private/endpoints", + ":private/signer/v4", + ":private/protocol/restxml", + ":private/waiter", + ], +) + diff --git a/vendor/github.com/go-ini/ini/BUILD b/vendor/github.com/go-ini/ini/BUILD new file mode 100644 index 0000000..a4fa955 --- /dev/null +++ b/vendor/github.com/go-ini/ini/BUILD @@ -0,0 +1,13 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("github.com/go-ini/ini") + +go_library( + name = "go_default_library", + srcs = glob( + include = ["*.go"], + exclude = ["*_test.go"], + ), +) \ No newline at end of file diff --git a/vendor/github.com/golang/glog/BUILD b/vendor/github.com/golang/glog/BUILD new file mode 100644 index 0000000..8f23f85 --- /dev/null +++ b/vendor/github.com/golang/glog/BUILD @@ -0,0 +1,13 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("github.com/golang/glog") + +go_library( + name = "go_default_library", + srcs = [ + "glog.go", + "glog_file.go", + ], +) \ No newline at end of file diff --git a/vendor/github.com/jmespath/go-jmespath/BUILD b/vendor/github.com/jmespath/go-jmespath/BUILD new file mode 100644 index 0000000..1029dcb --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/BUILD @@ -0,0 +1,13 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("github.com/jmespath/go-jmespath") + +go_library( + name = "go_default_library", + srcs = glob( + include = ["*.go"], + exclude = ["*_test.go"], + ), +) \ No newline at end of file diff --git a/vendor/github.com/spf13/pflag/BUILD b/vendor/github.com/spf13/pflag/BUILD new file mode 100644 index 0000000..55c31eb --- /dev/null +++ b/vendor/github.com/spf13/pflag/BUILD @@ -0,0 +1,13 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("github.com/spf13/pflag") + +go_library( + name = "go_default_library", + srcs = glob( + include = ["*.go"], + exclude = ["*_test.go"], + ), +) \ No newline at end of file diff --git a/vendor/k8s.io/kubernetes/BUILD b/vendor/k8s.io/kubernetes/BUILD new file mode 100644 index 0000000..c46f9c9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/BUILD @@ -0,0 +1,28 @@ +package(default_visibility = ["//visibility:public"]) + +load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library") + +go_prefix("k8s.io/kubernetes") + +go_library( + name = "pkg/util/runtime", + srcs = glob( + include = ["pkg/util/runtime/*.go"], + exclude = ["pkg/util/runtime/*_test.go"], + ), + deps = [ + "//vendor/github.com/golang/glog:go_default_library", + ], +) + +go_library( + name = "pkg/util/wait", + srcs = glob( + include = ["pkg/util/wait/*.go"], + exclude = ["pkg/util/wait/*_test.go"], + ), + deps = [ + ":pkg/util/runtime", + "//vendor/github.com/golang/glog:go_default_library", + ], +)