bazel: create genrules to produce debs and RPMs without arch-specific names

pull/564/head
Jeff Grafton 2019-02-23 15:44:34 -08:00
parent 5312ade3d1
commit a92c26d843
2 changed files with 36 additions and 24 deletions

View File

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

View File

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