Skip to content

Commit

Permalink
Make release-tars multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
ixdy committed Feb 23, 2019
1 parent bc316e3 commit 4b50d93
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 60 deletions.
40 changes: 22 additions & 18 deletions build/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -119,51 +119,55 @@ release_filegroup(
# KUBE_CLIENT_TARGETS
release_filegroup(
name = "client-targets",
srcs = [
conditioned_srcs = for_platforms(for_client = [
"//cmd/kubectl",
],
]),
)

# KUBE_NODE_TARGETS
release_filegroup(
name = "node-targets",
srcs = [
conditioned_srcs = for_platforms(for_node = [
"//cmd/kube-proxy",
"//cmd/kubeadm",
"//cmd/kubelet",
],
]),
)

# KUBE_SERVER_TARGETS
# No need to duplicate CLIENT_TARGETS or NODE_TARGETS here,
# since we include them in the actual build rule.
release_filegroup(
name = "server-targets",
srcs = [
conditioned_srcs = for_platforms(for_server = [
"//cluster/gce/gci/mounter",
"//cmd/cloud-controller-manager",
"//cmd/hyperkube",
"//cmd/kube-apiserver",
"//cmd/kube-controller-manager",
"//cmd/kube-scheduler",
],
]),
)

# kube::golang::test_targets
filegroup(
name = "test-targets",
srcs = [
"//cmd/gendocs",
"//cmd/genkubedocs",
"//cmd/genman",
"//cmd/genswaggertypedocs",
"//cmd/genyaml",
"//cmd/kubemark", # TODO: server platforms only
"//cmd/linkcheck",
"//test/e2e:e2e.test_binary",
"//test/e2e_node:e2e_node.test_binary", # TODO: server platforms only
"//vendor/github.com/onsi/ginkgo/ginkgo",
],
srcs = select(for_platforms(
for_server = [
"//cmd/kubemark",
"//test/e2e_node:e2e_node.test_binary",
],
for_test = [
"//cmd/gendocs",
"//cmd/genkubedocs",
"//cmd/genman",
"//cmd/genswaggertypedocs",
"//cmd/genyaml",
"//cmd/linkcheck",
"//test/e2e:e2e.test_binary",
"//vendor/github.com/onsi/ginkgo/ginkgo",
],
)),
)

# KUBE_TEST_PORTABLE
Expand Down
93 changes: 51 additions & 42 deletions build/release-tars/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package(default_visibility = ["//visibility:public"])

load(
"//build:platforms.bzl",
"CLIENT_PLATFORMS",
"NODE_PLATFORMS",
"SERVER_PLATFORMS",
"TEST_PLATFORMS",
"for_platforms",
"go_platform_constraint",
)
load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar")

Expand Down Expand Up @@ -51,9 +60,6 @@ pkg_tar(
tags = ["no-cache"],
)

# FIXME: this should be configurable/auto-detected
PLATFORM_ARCH_STRING = "linux-amd64"

# Included in node and server tarballs.
filegroup(
name = "license-targets",
Expand All @@ -73,15 +79,13 @@ pkg_tar(
visibility = ["//visibility:private"],
)

pkg_tar(
name = "kubernetes-client-%s" % PLATFORM_ARCH_STRING,
[[pkg_tar(
name = "kubernetes-client-%s-%s" % (os, arch),
extension = "tar.gz",
package_dir = "kubernetes",
tags = ["no-cache"],
deps = [
":_client-bin",
],
)
deps = select({go_platform_constraint(os, arch): [":_client-bin"]}),
) for arch in archs] for os, archs in CLIENT_PLATFORMS.items()]

pkg_tar(
name = "_node-bin",
Expand All @@ -95,17 +99,15 @@ pkg_tar(
visibility = ["//visibility:private"],
)

pkg_tar(
name = "kubernetes-node-%s" % PLATFORM_ARCH_STRING,
[[pkg_tar(
name = "kubernetes-node-%s-%s" % (os, arch),
srcs = [":license-targets"],
extension = "tar.gz",
mode = "0644",
package_dir = "kubernetes",
tags = ["no-cache"],
deps = [
":_node-bin",
],
)
deps = select({go_platform_constraint(os, arch): [":_node-bin"]}),
) for arch in archs] for os, archs in NODE_PLATFORMS.items()]

pkg_tar(
name = "_server-bin",
Expand Down Expand Up @@ -139,27 +141,30 @@ pkg_tar(
visibility = ["//visibility:private"],
)

pkg_tar(
name = "kubernetes-server-%s" % PLATFORM_ARCH_STRING,
[[pkg_tar(
name = "kubernetes-server-%s-%s" % (os, arch),
srcs = [":license-targets"],
extension = "tar.gz",
mode = "0644",
package_dir = "kubernetes",
tags = ["no-cache"],
deps = [
":_server-addons",
":_server-bin",
],
)
deps = select({
go_platform_constraint(os, arch): [
":_server-addons",
":_server-bin",
],
}),
) for arch in archs] for os, archs in SERVER_PLATFORMS.items()]

# The mondo test tarball is deprecated.
pkg_tar(
name = "_test-mondo-bin",
srcs = ["//build:test-targets"],
mode = "0755",
package_dir = "platforms/" + PLATFORM_ARCH_STRING.replace("-", "/"),
package_dir = select(for_platforms(
for_test = "platforms/{OS}/{ARCH}",
)),
tags = ["no-cache"],
# TODO: how to make this multiplatform?
visibility = ["//visibility:private"],
)

Expand Down Expand Up @@ -197,10 +202,9 @@ pkg_tar(
},
strip_prefix = "//",
tags = ["no-cache"],
deps = [
# TODO: how to make this multiplatform?
":_test-mondo-bin",
],
deps = select(for_platforms(
for_test = [":_test-mondo-bin"],
)),
)

pkg_tar(
Expand All @@ -221,17 +225,14 @@ pkg_tar(
visibility = ["//visibility:private"],
)

pkg_tar(
name = "kubernetes-test-%s" % PLATFORM_ARCH_STRING,
[[pkg_tar(
name = "kubernetes-test-%s-%s" % (os, arch),
extension = "tar.gz",
package_dir = "kubernetes",
strip_prefix = "//",
tags = ["no-cache"],
deps = [
# TODO: how to make this multiplatform?
":_test-bin",
],
)
deps = select({go_platform_constraint(os, arch): [":_test-bin"]}),
) for arch in archs] for os, archs in TEST_PLATFORMS.items()]

pkg_tar(
name = "_full_server",
Expand Down Expand Up @@ -275,13 +276,21 @@ release_filegroup(
name = "release-tars",
srcs = [
":kubernetes.tar.gz",
":kubernetes-client-%s.tar.gz" % PLATFORM_ARCH_STRING,
":kubernetes-node-%s.tar.gz" % PLATFORM_ARCH_STRING,
":kubernetes-server-%s.tar.gz" % PLATFORM_ARCH_STRING,
":kubernetes-manifests.tar.gz",
":kubernetes-src.tar.gz",
":kubernetes-test-%s.tar.gz" % PLATFORM_ARCH_STRING,
":kubernetes-test.tar.gz",
":kubernetes-test-portable.tar.gz",
],
conditioned_srcs = for_platforms(
for_all = [
],
for_client = [":kubernetes-client-{OS}-{ARCH}.tar.gz"],
for_node = [":kubernetes-node-{OS}-{ARCH}.tar.gz"],
for_server = [
":kubernetes-server-{OS}-{ARCH}.tar.gz",
":kubernetes-manifests.tar.gz",
],
for_test = [
":kubernetes-test-portable.tar.gz",
":kubernetes-test-{OS}-{ARCH}.tar.gz",
":kubernetes-test.tar.gz", # FIXME
],
),
)

0 comments on commit 4b50d93

Please sign in to comment.