Merge pull request #74467 from ixdy/bazel-cgo-crossbuild

bazel: create genrules to produce debs and RPMs without arch-specific names
pull/564/head
Kubernetes Prow Robot 2019-02-23 17:04:30 -08:00 committed by GitHub
commit ba8fcafaf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 24 deletions

View File

@ -21,32 +21,38 @@ release_filegroup(
name = "debs",
conditioned_srcs = for_platforms(
default = [],
for_client = [":kubectl-{ARCH}.deb"],
for_client = [":kubectl.deb"],
for_node = [
":cri-tools-{ARCH}.deb",
":kubeadm-{ARCH}.deb",
":kubelet-{ARCH}.deb",
":kubernetes-cni-{ARCH}.deb",
":cri-tools.deb",
":kubeadm.deb",
":kubelet.deb",
":kubernetes-cni.deb",
],
only_os = "linux",
),
)
# Create aliases from the non-arch names to the arch-specific names for backwards compatibility
alias(
# Create genrules to copy the arch-specific debs to debs without the arch in their filename.
genrule(
name = "kubectl",
actual = select(for_platforms(
for_client = ":kubectl-{ARCH}",
srcs = select(for_platforms(
for_client = [":kubectl-{ARCH}.deb"],
only_os = "linux",
)),
outs = ["kubectl.deb"],
cmd = "cp $< $@",
output_to_bindir = True,
)
[alias(
[genrule(
name = pkg,
actual = select(for_platforms(
for_node = ":%s-{ARCH}" % pkg,
srcs = select(for_platforms(
for_node = [":%s-{ARCH}.deb" % pkg],
only_os = "linux",
)),
outs = ["%s.deb" % pkg],
cmd = "cp $< $@",
output_to_bindir = True,
) for pkg in [
"cri-tools",
"kubeadm",

View File

@ -9,12 +9,12 @@ release_filegroup(
name = "rpms",
conditioned_srcs = for_platforms(
default = [],
for_client = [":kubectl-{ARCH}"],
for_client = [":kubectl.rpm"],
for_node = [
":cri-tools-{ARCH}",
":kubeadm-{ARCH}",
":kubelet-{ARCH}",
":kubernetes-cni-{ARCH}",
":cri-tools.rpm",
":kubeadm.rpm",
":kubelet.rpm",
":kubernetes-cni.rpm",
],
only_os = "linux",
),
@ -22,21 +22,27 @@ release_filegroup(
visibility = ["//visibility:public"],
)
# Create aliases from the non-arch names to the arch-specific names for backwards compatibility
alias(
# Create genrules to copy the arch-specific RPMs to RPMs without the arch in their filename.
genrule(
name = "kubectl",
actual = select(for_platforms(
for_client = ":kubectl-{ARCH}",
srcs = select(for_platforms(
for_client = [":kubectl-{ARCH}.rpm"],
only_os = "linux",
)),
outs = ["kubectl.rpm"],
cmd = "cp $< $@",
output_to_bindir = True,
)
[alias(
[genrule(
name = pkg,
actual = select(for_platforms(
for_client = ":%s-{ARCH}" % pkg,
srcs = select(for_platforms(
for_client = [":%s-{ARCH}.rpm" % pkg],
only_os = "linux",
)),
outs = ["%s.rpm" % pkg],
cmd = "cp $< $@",
output_to_bindir = True,
) for pkg in [
"cri-tools",
"kubeadm",