BUILD.root 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # gazelle:build_file_name BUILD,BUILD.bazel
  2. # gazelle:exclude _artifacts
  3. # gazelle:exclude _gopath
  4. # gazelle:exclude _output
  5. # gazelle:exclude _tmp
  6. # gazelle:prefix k8s.io/kubernetes
  7. # Disable proto rules, since the Go sources are currently generated by
  8. # hack/update-generated-protobuf.sh and checked into the repo.
  9. # gazelle:proto disable_global
  10. package(default_visibility = ["//visibility:public"])
  11. load("@io_k8s_repo_infra//defs:build.bzl", "gcs_upload")
  12. load("//build:platforms.bzl", "for_platforms")
  13. filegroup(
  14. name = "_binary-artifacts-and-hashes",
  15. srcs = select(for_platforms(
  16. for_client = ["//build:client-targets-and-hashes"],
  17. for_node = [
  18. "//build:node-targets-and-hashes",
  19. "//build/debs:debs-and-hashes",
  20. ],
  21. for_server = [
  22. "//build:docker-artifacts-and-hashes",
  23. "//build:server-targets-and-hashes",
  24. ],
  25. )),
  26. visibility = ["//visibility:private"],
  27. )
  28. # TODO: collect all relevant docker_push targets into one target that can be run:
  29. # //build:push-server-images
  30. # //cluster/images/conformance:push-conformance
  31. # //cluster/images/hyperkube:push-hyperkube
  32. gcs_upload(
  33. name = "push-build",
  34. data = [
  35. ":_binary-artifacts-and-hashes",
  36. "//build/release-tars:release-tars-and-hashes",
  37. "//cluster/gce/gci:gcs-release-artifacts-and-hashes",
  38. "//cluster/gce/windows:gcs-release-artifacts-and-hashes",
  39. ],
  40. tags = ["manual"],
  41. # Use for_platforms to format the upload path based on the configured
  42. # platform (os/arch).
  43. # For example, this will turn into something like
  44. # upload_paths = select({
  45. # "@io_bazel_rules_go//go/platform:windows_386": {
  46. # ...,"//:binary-artifacts-and-hashes": "bin/windows/386"},
  47. # "@io_bazel_rules_go//go/platform:linux_ppc64le": {
  48. # ...,"//:binary-artifacts-and-hashes": "bin/linux/ppc64le"},
  49. #})
  50. # and bazel will select the correct entry.
  51. upload_paths = select(for_platforms(for_all = {
  52. "//build/release-tars:release-tars-and-hashes": "",
  53. "//cluster/gce/gci:gcs-release-artifacts-and-hashes": "extra/gce",
  54. "//cluster/gce/windows:gcs-release-artifacts-and-hashes": "extra/gce/windows",
  55. "//:_binary-artifacts-and-hashes": "bin/{OS}/{ARCH}",
  56. })),
  57. )
  58. filegroup(
  59. name = "package-srcs",
  60. srcs = glob(
  61. ["**"],
  62. exclude = [
  63. "bazel-*/**",
  64. "_*/**",
  65. ".config/**",
  66. ".git/**",
  67. ".gsutil/**",
  68. ".make/**",
  69. ],
  70. ),
  71. visibility = ["//visibility:private"],
  72. )
  73. filegroup(
  74. name = "all-srcs",
  75. srcs = [
  76. ":package-srcs",
  77. "//api/openapi-spec:all-srcs",
  78. "//build:all-srcs",
  79. "//cluster:all-srcs",
  80. "//cmd:all-srcs",
  81. "//docs:all-srcs",
  82. "//hack:all-srcs",
  83. "//pkg:all-srcs",
  84. "//plugin:all-srcs",
  85. "//staging:all-srcs",
  86. "//test:all-srcs",
  87. "//third_party:all-srcs",
  88. "//translations:all-srcs",
  89. "//vendor:all-srcs",
  90. ],
  91. tags = ["automanaged"],
  92. )
  93. genrule(
  94. name = "save_git_version",
  95. outs = ["version"],
  96. cmd = "grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt | awk '{print $$2}' >$@",
  97. stamp = 1,
  98. )
  99. platform(
  100. name = "rbe_with_network",
  101. parents = ["@rbe_default//config:platform"],
  102. # https://cloud.google.com/remote-build-execution/docs/remote-execution-environment#remote_execution_properties
  103. remote_execution_properties = """
  104. properties: {
  105. name: "dockerNetwork"
  106. value: "standard"
  107. }
  108. properties: {
  109. name: "dockerPrivileged"
  110. value: "true"
  111. }
  112. {PARENT_REMOTE_EXECUTION_PROPERTIES}
  113. """,
  114. )