Skip to content

Commit 8fd6342

Browse files
authored
Merge pull request kubernetes#74799 from lubinsz/pr_bazel
Add bazel-test-integration support for Arm64
2 parents 93402fc + 973a3c7 commit 8fd6342

File tree

4 files changed

+40
-15
lines changed

4 files changed

+40
-15
lines changed

build/root/WORKSPACE

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ http_archive(
1919
urls = mirror("https://github.com/kubernetes/repo-infra/archive/b461270ab6ccfb94ff2d78df96d26f669376d660.tar.gz"),
2020
)
2121

22-
ETCD_VERSION = "3.3.10"
23-
24-
http_archive(
25-
name = "com_coreos_etcd",
26-
build_file = "@//third_party:etcd.BUILD",
27-
sha256 = "1620a59150ec0a0124a65540e23891243feb2d9a628092fb1edcc23974724a45",
28-
strip_prefix = "etcd-v%s-linux-amd64" % ETCD_VERSION,
29-
urls = mirror("https://github.com/coreos/etcd/releases/download/v%s/etcd-v%s-linux-amd64.tar.gz" % (ETCD_VERSION, ETCD_VERSION)),
30-
)
31-
3222
http_archive(
3323
name = "io_bazel_rules_go",
3424
sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19",

build/workspace.bzl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
load("//build:platforms.bzl", "SERVER_PLATFORMS")
1616
load("//build:workspace_mirror.bzl", "mirror")
17-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
17+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
1818
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
1919

2020
CNI_VERSION = "0.6.0"
@@ -35,6 +35,13 @@ _CRI_TARBALL_ARCH_SHA256 = {
3535
"s390x": "814aa9cd496be416612c2653097a1c9eb5784e38aa4889034b44ebf888709057",
3636
}
3737

38+
ETCD_VERSION = "3.3.10"
39+
_ETCD_TARBALL_ARCH_SHA256 = {
40+
"amd64": "1620a59150ec0a0124a65540e23891243feb2d9a628092fb1edcc23974724a45",
41+
"arm64": "5ec97b0b872adce275b8130d19db314f7f2b803aeb24c4aae17a19e2d66853c4",
42+
"ppc64le": "148fe96f0ec1813c5db9916199e96a913174304546bc8447a2d2f9fee4b8f6c2",
43+
}
44+
3845
# Note that these are digests for the manifest list. We resolve the manifest
3946
# list to each of its platform-specific images in
4047
# debian_image_dependencies().
@@ -48,6 +55,7 @@ def release_dependencies():
4855
cni_tarballs()
4956
cri_tarballs()
5057
debian_image_dependencies()
58+
etcd_tarballs()
5159

5260
def cni_tarballs():
5361
for arch, sha in _CNI_TARBALL_ARCH_SHA256.items():
@@ -92,3 +100,13 @@ def debian_image_dependencies():
92100
registry = "k8s.gcr.io",
93101
repository = "debian-hyperkube-base",
94102
)
103+
104+
def etcd_tarballs():
105+
for arch, sha in _ETCD_TARBALL_ARCH_SHA256.items():
106+
http_archive(
107+
name = "com_coreos_etcd_%s" % arch,
108+
build_file = "@//third_party:etcd.BUILD",
109+
sha256 = sha,
110+
strip_prefix = "etcd-v%s-linux-%s" % (ETCD_VERSION, arch),
111+
urls = mirror("https://github.com/coreos/etcd/releases/download/v%s/etcd-v%s-linux-%s.tar.gz" % (ETCD_VERSION, ETCD_VERSION, arch)),
112+
)

test/integration/framework/BUILD

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load(
44
"@io_bazel_rules_go//go:def.bzl",
55
"go_library",
66
)
7+
load("//build:platforms.bzl", "go_platform_constraint")
78

89
go_library(
910
name = "go_default_library",
@@ -15,9 +16,23 @@ go_library(
1516
"test_server.go",
1617
"util.go",
1718
],
18-
data = [
19-
"@com_coreos_etcd//:etcd",
20-
],
19+
data = select({
20+
go_platform_constraint(
21+
arch = "arm64",
22+
os = "linux",
23+
): [
24+
"@com_coreos_etcd_arm64//:etcd",
25+
],
26+
go_platform_constraint(
27+
arch = "ppc64le",
28+
os = "linux",
29+
): [
30+
"@com_coreos_etcd_ppc64le//:etcd",
31+
],
32+
"//conditions:default": [
33+
"@com_coreos_etcd_amd64//:etcd",
34+
],
35+
}),
2136
importpath = "k8s.io/kubernetes/test/integration/framework",
2237
deps = [
2338
"//cmd/kube-apiserver/app:go_default_library",

test/integration/framework/etcd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"os"
2525
"os/exec"
2626
"path/filepath"
27+
"runtime"
2728
"strings"
2829

2930
"k8s.io/klog"
@@ -43,7 +44,8 @@ You can use 'hack/install-etcd.sh' to install a copy in third_party/.
4344

4445
// getEtcdPath returns a path to an etcd executable.
4546
func getEtcdPath() (string, error) {
46-
bazelPath := filepath.Join(os.Getenv("RUNFILES_DIR"), "com_coreos_etcd/etcd")
47+
bazelPath := filepath.Join(os.Getenv("RUNFILES_DIR"), fmt.Sprintf("com_coreos_etcd_%s", runtime.GOARCH), "etcd")
48+
4749
p, err := exec.LookPath(bazelPath)
4850
if err == nil {
4951
return p, nil

0 commit comments

Comments
 (0)