BUILD 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. package(default_visibility = ["//visibility:public"])
  2. load(
  3. "//build:platforms.bzl",
  4. "CLIENT_PLATFORMS",
  5. "NODE_PLATFORMS",
  6. "SERVER_PLATFORMS",
  7. "TEST_PLATFORMS",
  8. "for_platforms",
  9. "go_platform_constraint",
  10. )
  11. load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
  12. load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar")
  13. load("//staging:repos_generated.bzl", "staging_repos")
  14. # Bazel doesn't make the output filename
  15. # (such as kubernetes-server-{OS}-{ARCH}.tar.gz) configurable, so we instead
  16. # create rules for all platforms and tag them manual.
  17. # We then select the correct set of platform-specific tarballs in this filegroup
  18. # using a select() statement.
  19. # Thus the release-tars target always selects the correct set of tarballs
  20. # for the configured platform being built.
  21. release_filegroup(
  22. name = "release-tars",
  23. conditioned_srcs = for_platforms(
  24. for_all = [
  25. ":kubernetes.tar.gz",
  26. ":kubernetes-src.tar.gz",
  27. ],
  28. for_client = [":kubernetes-client-{OS}-{ARCH}.tar.gz"],
  29. for_node = [":kubernetes-node-{OS}-{ARCH}.tar.gz"],
  30. for_server = [
  31. ":kubernetes-server-{OS}-{ARCH}.tar.gz",
  32. ":kubernetes-manifests.tar.gz",
  33. ],
  34. for_test = [
  35. ":kubernetes-test-portable.tar.gz",
  36. ":kubernetes-test-{OS}-{ARCH}.tar.gz",
  37. ],
  38. ),
  39. )
  40. filegroup(
  41. name = "package-srcs",
  42. srcs = glob(["**"]),
  43. tags = ["automanaged"],
  44. visibility = ["//visibility:private"],
  45. )
  46. filegroup(
  47. name = "all-srcs",
  48. srcs = [":package-srcs"],
  49. tags = ["automanaged"],
  50. )
  51. pkg_tar(
  52. name = "kubernetes-src",
  53. srcs = ["//:all-srcs"],
  54. extension = "tar.gz",
  55. package_dir = "kubernetes",
  56. strip_prefix = "//",
  57. symlinks = {
  58. "kubernetes/vendor/%s" % repo: "../../staging/src/%s" % repo
  59. for repo in staging_repos
  60. },
  61. tags = [
  62. "manual",
  63. "no-cache",
  64. ],
  65. )
  66. # Included in node and server tarballs.
  67. filegroup(
  68. name = "license-targets",
  69. srcs = [
  70. ":kubernetes-src.tar.gz",
  71. "//:Godeps/LICENSES",
  72. ],
  73. visibility = ["//visibility:private"],
  74. )
  75. pkg_tar(
  76. name = "_client-bin",
  77. srcs = ["//build:client-targets"],
  78. mode = "0755",
  79. package_dir = "client/bin",
  80. tags = [
  81. "manual",
  82. "no-cache",
  83. ],
  84. visibility = ["//visibility:private"],
  85. )
  86. [[pkg_tar(
  87. name = "kubernetes-client-%s-%s" % (os, arch),
  88. extension = "tar.gz",
  89. package_dir = "kubernetes",
  90. tags = [
  91. "manual",
  92. "no-cache",
  93. ],
  94. deps = select({go_platform_constraint(os, arch): [":_client-bin"]}),
  95. ) for arch in archs] for os, archs in CLIENT_PLATFORMS.items()]
  96. pkg_tar(
  97. name = "_node-bin",
  98. srcs = [
  99. "//build:client-targets",
  100. "//build:node-targets",
  101. ],
  102. mode = "0755",
  103. package_dir = "node/bin",
  104. tags = [
  105. "manual",
  106. "no-cache",
  107. ],
  108. visibility = ["//visibility:private"],
  109. )
  110. [[pkg_tar(
  111. name = "kubernetes-node-%s-%s" % (os, arch),
  112. srcs = [":license-targets"],
  113. extension = "tar.gz",
  114. mode = "0644",
  115. package_dir = "kubernetes",
  116. tags = [
  117. "manual",
  118. "no-cache",
  119. ],
  120. deps = select({go_platform_constraint(os, arch): [":_node-bin"]}),
  121. ) for arch in archs] for os, archs in NODE_PLATFORMS.items()]
  122. pkg_tar(
  123. name = "_server-bin",
  124. srcs = [
  125. "//build:client-targets",
  126. "//build:docker-artifacts",
  127. "//build:node-targets",
  128. "//build:server-targets",
  129. ],
  130. mode = "0755",
  131. package_dir = "server/bin",
  132. tags = [
  133. "manual",
  134. "no-cache",
  135. ],
  136. visibility = ["//visibility:private"],
  137. )
  138. genrule(
  139. name = "dummy",
  140. outs = [".dummy"],
  141. cmd = "touch $@",
  142. visibility = ["//visibility:private"],
  143. )
  144. # Some of the startup scripts fail if there isn't an addons/ directory in the server tarball.
  145. pkg_tar(
  146. name = "_server-addons",
  147. srcs = [
  148. ":.dummy",
  149. ],
  150. package_dir = "addons",
  151. tags = [
  152. "manual",
  153. "no-cache",
  154. ],
  155. visibility = ["//visibility:private"],
  156. )
  157. [[pkg_tar(
  158. name = "kubernetes-server-%s-%s" % (os, arch),
  159. srcs = [":license-targets"],
  160. extension = "tar.gz",
  161. mode = "0644",
  162. package_dir = "kubernetes",
  163. tags = [
  164. "manual",
  165. "no-cache",
  166. ],
  167. deps = select({
  168. go_platform_constraint(os, arch): [
  169. ":_server-addons",
  170. ":_server-bin",
  171. ],
  172. }),
  173. ) for arch in archs] for os, archs in SERVER_PLATFORMS.items()]
  174. pkg_tar(
  175. name = "kubernetes-test-portable",
  176. srcs = ["//build:test-portable-targets"],
  177. extension = "tar.gz",
  178. package_dir = "kubernetes",
  179. strip_prefix = "//",
  180. tags = ["no-cache"],
  181. )
  182. pkg_tar(
  183. name = "_test-bin",
  184. srcs = ["//build:test-targets"],
  185. mode = "0755",
  186. package_dir = "test/bin",
  187. tags = [
  188. "manual",
  189. "no-cache",
  190. ],
  191. visibility = ["//visibility:private"],
  192. )
  193. [[pkg_tar(
  194. name = "kubernetes-test-%s-%s" % (os, arch),
  195. extension = "tar.gz",
  196. package_dir = "kubernetes",
  197. strip_prefix = "//",
  198. tags = [
  199. "manual",
  200. "no-cache",
  201. ],
  202. deps = select({go_platform_constraint(os, arch): [":_test-bin"]}),
  203. ) for arch in archs] for os, archs in TEST_PLATFORMS.items()]
  204. pkg_tar(
  205. name = "_full_server",
  206. srcs = [
  207. ":kubernetes-manifests.tar.gz",
  208. ],
  209. package_dir = "server",
  210. tags = [
  211. "manual",
  212. "no-cache",
  213. ],
  214. visibility = ["//visibility:private"],
  215. )
  216. pkg_tar(
  217. name = "kubernetes",
  218. srcs = [
  219. "//:Godeps/LICENSES",
  220. "//:README.md",
  221. "//:version",
  222. "//cluster:all-srcs",
  223. "//docs:all-srcs",
  224. "//hack/lib:all-srcs",
  225. ],
  226. extension = "tar.gz",
  227. package_dir = "kubernetes",
  228. strip_prefix = "//",
  229. symlinks = {
  230. "kubernetes/cluster/gce/cos/": "gci",
  231. "kubernetes/cluster/gce/custom/": "gci",
  232. "kubernetes/cluster/gce/ubuntu/": "gci",
  233. },
  234. tags = ["no-cache"],
  235. deps = [
  236. ":_full_server",
  237. ],
  238. )
  239. pkg_tar(
  240. name = "kubernetes-manifests",
  241. extension = "tar.gz",
  242. tags = ["no-cache"],
  243. deps = [
  244. "//cluster:manifests",
  245. ],
  246. )