Merge pull request #74799 from lubinsz/pr_bazel

Add bazel-test-integration support for Arm64
pull/564/head
Kubernetes Prow Robot 2019-03-12 23:53:31 -07:00 committed by GitHub
commit 8fd6342684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 15 deletions

View File

@ -19,16 +19,6 @@ http_archive(
urls = mirror("https://github.com/kubernetes/repo-infra/archive/b461270ab6ccfb94ff2d78df96d26f669376d660.tar.gz"),
)
ETCD_VERSION = "3.3.10"
http_archive(
name = "com_coreos_etcd",
build_file = "@//third_party:etcd.BUILD",
sha256 = "1620a59150ec0a0124a65540e23891243feb2d9a628092fb1edcc23974724a45",
strip_prefix = "etcd-v%s-linux-amd64" % ETCD_VERSION,
urls = mirror("https://github.com/coreos/etcd/releases/download/v%s/etcd-v%s-linux-amd64.tar.gz" % (ETCD_VERSION, ETCD_VERSION)),
)
http_archive(
name = "io_bazel_rules_go",
sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19",

View File

@ -14,7 +14,7 @@
load("//build:platforms.bzl", "SERVER_PLATFORMS")
load("//build:workspace_mirror.bzl", "mirror")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
CNI_VERSION = "0.6.0"
@ -35,6 +35,13 @@ _CRI_TARBALL_ARCH_SHA256 = {
"s390x": "814aa9cd496be416612c2653097a1c9eb5784e38aa4889034b44ebf888709057",
}
ETCD_VERSION = "3.3.10"
_ETCD_TARBALL_ARCH_SHA256 = {
"amd64": "1620a59150ec0a0124a65540e23891243feb2d9a628092fb1edcc23974724a45",
"arm64": "5ec97b0b872adce275b8130d19db314f7f2b803aeb24c4aae17a19e2d66853c4",
"ppc64le": "148fe96f0ec1813c5db9916199e96a913174304546bc8447a2d2f9fee4b8f6c2",
}
# Note that these are digests for the manifest list. We resolve the manifest
# list to each of its platform-specific images in
# debian_image_dependencies().
@ -48,6 +55,7 @@ def release_dependencies():
cni_tarballs()
cri_tarballs()
debian_image_dependencies()
etcd_tarballs()
def cni_tarballs():
for arch, sha in _CNI_TARBALL_ARCH_SHA256.items():
@ -92,3 +100,13 @@ def debian_image_dependencies():
registry = "k8s.gcr.io",
repository = "debian-hyperkube-base",
)
def etcd_tarballs():
for arch, sha in _ETCD_TARBALL_ARCH_SHA256.items():
http_archive(
name = "com_coreos_etcd_%s" % arch,
build_file = "@//third_party:etcd.BUILD",
sha256 = sha,
strip_prefix = "etcd-v%s-linux-%s" % (ETCD_VERSION, arch),
urls = mirror("https://github.com/coreos/etcd/releases/download/v%s/etcd-v%s-linux-%s.tar.gz" % (ETCD_VERSION, ETCD_VERSION, arch)),
)

View File

@ -4,6 +4,7 @@ load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
load("//build:platforms.bzl", "go_platform_constraint")
go_library(
name = "go_default_library",
@ -15,9 +16,23 @@ go_library(
"test_server.go",
"util.go",
],
data = [
"@com_coreos_etcd//:etcd",
],
data = select({
go_platform_constraint(
arch = "arm64",
os = "linux",
): [
"@com_coreos_etcd_arm64//:etcd",
],
go_platform_constraint(
arch = "ppc64le",
os = "linux",
): [
"@com_coreos_etcd_ppc64le//:etcd",
],
"//conditions:default": [
"@com_coreos_etcd_amd64//:etcd",
],
}),
importpath = "k8s.io/kubernetes/test/integration/framework",
deps = [
"//cmd/kube-apiserver/app:go_default_library",

View File

@ -24,6 +24,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"k8s.io/klog"
@ -43,7 +44,8 @@ You can use 'hack/install-etcd.sh' to install a copy in third_party/.
// getEtcdPath returns a path to an etcd executable.
func getEtcdPath() (string, error) {
bazelPath := filepath.Join(os.Getenv("RUNFILES_DIR"), "com_coreos_etcd/etcd")
bazelPath := filepath.Join(os.Getenv("RUNFILES_DIR"), fmt.Sprintf("com_coreos_etcd_%s", runtime.GOARCH), "etcd")
p, err := exec.LookPath(bazelPath)
if err == nil {
return p, nil