Add root Bazel build files
Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
parent
7924346bd8
commit
77c63bdc2d
2
.bazelrc
Normal file
2
.bazelrc
Normal file
@ -0,0 +1,2 @@
|
||||
# Include git version info
|
||||
build --workspace_status_command hack/print-workspace-status.sh
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@
|
||||
/controller
|
||||
/ingress-shim
|
||||
/hack/build/dockerfiles/cert-manager-*_*_*
|
||||
.vscode
|
||||
bazel-*
|
||||
|
||||
21
BUILD.bazel
Normal file
21
BUILD.bazel
Normal file
@ -0,0 +1,21 @@
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(
|
||||
["**"],
|
||||
exclude = [
|
||||
"bazel-*/**",
|
||||
".git/**",
|
||||
],
|
||||
),
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//hack:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
124
WORKSPACE
Normal file
124
WORKSPACE
Normal file
@ -0,0 +1,124 @@
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
|
||||
|
||||
## Load rules_go and dependencies
|
||||
http_archive(
|
||||
name = "io_bazel_rules_go",
|
||||
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.15.3/rules_go-0.15.3.tar.gz"],
|
||||
sha256 = "97cf62bdef33519412167fd1e4b0810a318a7c234f5f8dc4f53e2da86241c492",
|
||||
)
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_rules_dependencies",
|
||||
"go_register_toolchains",
|
||||
)
|
||||
go_rules_dependencies()
|
||||
|
||||
go_register_toolchains(
|
||||
go_version = "1.10.4",
|
||||
)
|
||||
|
||||
## Load gazelle and dependencies
|
||||
http_archive(
|
||||
name = "bazel_gazelle",
|
||||
url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.14.0/bazel-gazelle-0.14.0.tar.gz",
|
||||
sha256 = "c0a5739d12c6d05b6c1ad56f2200cb0b57c5a70e03ebd2f7b87ce88cabf09c7b",
|
||||
)
|
||||
load(
|
||||
"@bazel_gazelle//:deps.bzl",
|
||||
"gazelle_dependencies",
|
||||
)
|
||||
gazelle_dependencies()
|
||||
|
||||
## Load kubernetes repo-infra for tools like kazel
|
||||
git_repository(
|
||||
name = "io_kubernetes_build",
|
||||
commit = "84d52408a061e87d45aebf5a0867246bdf66d180",
|
||||
remote = "https://github.com/kubernetes/repo-infra.git",
|
||||
)
|
||||
|
||||
## Load rules_docker and depdencies, for working with docker images
|
||||
git_repository(
|
||||
name = "io_bazel_rules_docker",
|
||||
remote = "https://github.com/bazelbuild/rules_docker.git",
|
||||
tag = "v0.5.1",
|
||||
)
|
||||
load(
|
||||
"@io_bazel_rules_docker//container:container.bzl",
|
||||
"container_pull",
|
||||
container_repositories = "repositories",
|
||||
)
|
||||
container_repositories()
|
||||
load(
|
||||
"@io_bazel_rules_docker//go:image.bzl",
|
||||
_go_image_repos = "repositories",
|
||||
)
|
||||
_go_image_repos()
|
||||
|
||||
## Pull some standard base images
|
||||
container_pull(
|
||||
name = "alpine",
|
||||
registry = "gcr.io",
|
||||
repository = "jetstack-build-infra/alpine",
|
||||
tag = "3.7-v20180822-0201cfb11",
|
||||
)
|
||||
|
||||
## Fetch helm for use in template generation and testing
|
||||
new_http_archive(
|
||||
name = "helm_darwin",
|
||||
sha256 = "7c4e6bfbc211d6b984ffb4fa490ce9ac112cc4b9b8d859ece27045b8514c1ed1",
|
||||
urls = ["https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-darwin-amd64.tar.gz"],
|
||||
build_file_content =
|
||||
"""
|
||||
filegroup(
|
||||
name = "file",
|
||||
srcs = [
|
||||
"darwin-amd64/helm",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
)
|
||||
new_http_archive(
|
||||
name = "helm_linux",
|
||||
sha256 = "0fa2ed4983b1e4a3f90f776d08b88b0c73fd83f305b5b634175cb15e61342ffe",
|
||||
urls = ["https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-linux-amd64.tar.gz"],
|
||||
build_file_content =
|
||||
"""
|
||||
filegroup(
|
||||
name = "file",
|
||||
srcs = [
|
||||
"linux-amd64/helm",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
## Install buildozer, for mass-editing BUILD files
|
||||
http_file(
|
||||
name = "buildozer_darwin",
|
||||
executable = 1,
|
||||
sha256 = "294357ff92e7bb36c62f964ecb90e935312671f5a41a7a9f2d77d8d0d4bd217d",
|
||||
urls = ["https://github.com/bazelbuild/buildtools/releases/download/0.15.0/buildozer.osx"],
|
||||
)
|
||||
http_file(
|
||||
name = "buildozer_linux",
|
||||
executable = 1,
|
||||
sha256 = "be07a37307759c68696c989058b3446390dd6e8aa6fdca6f44f04ae3c37212c5",
|
||||
urls = ["https://github.com/bazelbuild/buildtools/releases/download/0.15.0/buildozer"],
|
||||
)
|
||||
|
||||
## Install dep for dependency management
|
||||
http_file(
|
||||
name = "dep_darwin",
|
||||
executable = 1,
|
||||
sha256 = "1a7bdb0d6c31ecba8b3fd213a1170adf707657123e89dff234871af9e0498be2",
|
||||
urls = ["https://github.com/golang/dep/releases/download/v0.5.0/dep-darwin-amd64"],
|
||||
)
|
||||
http_file(
|
||||
name = "dep_linux",
|
||||
executable = 1,
|
||||
sha256 = "287b08291e14f1fae8ba44374b26a2b12eb941af3497ed0ca649253e21ba2f83",
|
||||
urls = ["https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64"],
|
||||
)
|
||||
44
hack/BUILD.bazel
Normal file
44
hack/BUILD.bazel
Normal file
@ -0,0 +1,44 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
py_test(
|
||||
name = "verify-boilerplate",
|
||||
main = "verify_boilerplate.py",
|
||||
srcs = ["verify_boilerplate.py"],
|
||||
data = ["//:all-srcs"],
|
||||
tags = ["lint"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "verify-errexit",
|
||||
srcs = ["verify-errexit.sh"],
|
||||
data = [
|
||||
"//:all-srcs",
|
||||
],
|
||||
tags = ["lint"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "verify-links",
|
||||
srcs = ["verify-links.sh"],
|
||||
data = [
|
||||
"//:all-srcs",
|
||||
],
|
||||
tags = ["lint"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//hack/boilerplate:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
52
hack/bin/BUILD.bazel
Normal file
52
hack/bin/BUILD.bazel
Normal file
@ -0,0 +1,52 @@
|
||||
genrule(
|
||||
name = "fetch_helm",
|
||||
srcs = select({
|
||||
":darwin": ["@helm_darwin//:file"],
|
||||
":k8": ["@helm_linux//:file"],
|
||||
}),
|
||||
outs = ["helm"],
|
||||
cmd = "cp $(SRCS) $@",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "fetch_buildozer",
|
||||
srcs = select({
|
||||
":darwin": ["@buildozer_darwin//file"],
|
||||
":k8": ["@buildozer_linux//file"],
|
||||
}),
|
||||
outs = ["buildozer"],
|
||||
cmd = "cp $(SRCS) $@",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "fetch_kazel",
|
||||
srcs = ["@io_kubernetes_build//kazel"],
|
||||
outs = ["kazel"],
|
||||
cmd = "cp $(SRCS) $@",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "fetch_dep",
|
||||
srcs = select({
|
||||
":darwin": ["@dep_darwin//file"],
|
||||
":k8": ["@dep_linux//file"],
|
||||
}),
|
||||
outs = ["dep"],
|
||||
cmd = "cp $(SRCS) $@",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "k8",
|
||||
values = {"host_cpu": "k8"},
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "darwin",
|
||||
values = {"host_cpu": "darwin"},
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
15
hack/boilerplate/BUILD.bazel
Normal file
15
hack/boilerplate/BUILD.bazel
Normal file
@ -0,0 +1,15 @@
|
||||
exports_files(["boilerplate.go.txt"])
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
28
hack/print-workspace-status.sh
Executable file
28
hack/print-workspace-status.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Jetstack cert-manager contributors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The only argument this script should ever be called with is '--verify-only'
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../..
|
||||
|
||||
# TODO: properly configure this file
|
||||
cat <<EOF
|
||||
STABLE_DOCKER_TAG build
|
||||
EOF
|
||||
Loading…
Reference in New Issue
Block a user