rules_k8s icon indicating copy to clipboard operation
rules_k8s copied to clipboard

Platforms / platform_mappings breaks k8s toolchain

Open sgammon opened this issue 3 years ago • 0 comments

Hey there rules_k8s authors,

I had begun implementing support for Bazel platforms this week, and added the following declarations:

platforms/BUILD:

platform(
  name = "ios",
  constraint_values = [
   "@platforms//os:ios",
   "@platforms//cpu:x86_64",
  ],
)

platform(
  name = "ios_arm",
  constraint_values = [
    "@platforms//os:ios",
    "@platforms//cpu:arm",
  ],
)

platform_mappings:

platforms:
  //platforms:ios
    --cpu=ios_x86_64
    --apple_platform_type=ios
  //platforms:ios_arm
    --ios_multi_cpus=armv7,arm64
    --apple_platform_type=ios

flags:
  --cpu=x86_64
  --apple_platform_type=ios

  //platforms:ios
  --cpu=darwin
  --apple_platform_type=ios
  //platforms:ios

I don't understand enough about platforms yet to know why I need these files or what they do, but they seem to break the K8S toolchain with the following error:

/Users/.../bin/bazelisk  run --define=release_tag=v1h --config=dev --config=cache --config=devkey -s --verbose_failures  --compilation_mode=dbg  -- //config/k8s:services.create
INFO: Invocation ID: 89038f9c-c284-40ce-9d8b-218a87f458d8
INFO: Build option --platforms has changed, discarding analysis cache.
ERROR: While resolving toolchains for target //config/k8s:services.create: no matching toolchains found for types @io_bazel_rules_k8s//toolchains/kubectl:toolchain_type
ERROR: Analysis of target '//config/k8s:services.create' failed; build aborted: no matching toolchains found for types @io_bazel_rules_k8s//toolchains/kubectl:toolchain_type
INFO: Elapsed time: 0.331s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 120 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 120 targets configured)

Removing the files unbreaks the build. Is there something I should be placing in platform_mappings or platforms/BUILD for the K8S toolchain to work?

sgammon avatar Jul 29 '20 22:07 sgammon