rules_k8s icon indicating copy to clipboard operation
rules_k8s copied to clipboard

Fix Bazel incompatible changes

Open laurentlb opened this issue 6 years ago • 16 comments

I'd like to be able to build rules_k8s with --all_incompatible_changes: bazel test --all_incompatible_changes //...

It may not be possible to fix every issue now due to transitive dependencies, but we should try to fix the issues from this repository.

laurentlb avatar Dec 18 '18 16:12 laurentlb

Hi @laurentlb , same as for rules_docker, happy to help you review any PRs you send to fix as many issues as possible in this repo.

nlopezgi avatar Dec 18 '18 16:12 nlopezgi

After fetching the fix from a0bbf543ac0eedec1ec699ca3d9b4e7bf1749aaf, I'm still running into an error when --all_imcompatible_changes is passed:

        File "/home/terin/.cache/bazel/_bazel_terin/2f6659f6d922032bbf4cf20ebfd5ecd5/external/io_bazel_rules_k8s/k8s/object.bzl", line 118, in ctx.runfiles
                list(ctx.attr.resolver.default_runfil...)
type 'depset' is not iterable. Use the `to_list()` method to get a list. Use --incompatible_depset_is_not_iterable=false to temporarily disable this check.

Looks like changing a handful of list(.files) to .files.to_list() resolved this error for me.

terinjokes avatar Dec 18 '18 23:12 terinjokes

There are still issues with these flags:

  • --incompatible_new_actions_api
  • --incompatible_no_support_tools_in_action_inputs
  • --incompatible_disable_deprecated_attr_params
  • --incompatible_disallow_load_labels_to_cross_package_boundaries
  • --incompatible_disallow_dict_plus

laurentlb avatar Feb 07 '19 14:02 laurentlb

We plan to fix some of these flags soon in Bazel.

laurentlb avatar Feb 12 '19 17:02 laurentlb

Thanks for the reminder, we'll schedule to make changes to fix next week.

nlopezgi avatar Feb 12 '19 18:02 nlopezgi

--incompatible_disallow_dict_plus is now enabled in Bazel at head.

laurentlb avatar Feb 20 '19 19:02 laurentlb

Going to work on --incompatible_disallow_dict_plus

smukherj1 avatar Feb 20 '19 19:02 smukherj1

I tried to fix as many other issues I could find by trying to update external repositories for incompatible flags other than disallow_dict_plus. It seems some work is going to be needed in rules_grpc to fix some of the other errors. I wasn't able to update com_goole_protobuf because I get

ERROR: /usr/local/google/home/suvanjan/.cache/bazel/_bazel_suvanjan/a1bcb3b63a242c66f0c6010821551247/external/com_google_protobuf/BUILD:632:1: Compiling Java headers external/com_google_protobuf/libprotobuf_java_util-hjar.jar (6 files) failed (Exit 1) turbine_direct.linux failed: error executing command external/bazel_tools/tools/jdk/turbine_direct.linux --output bazel-out/k8-fastbuild/bin/external/com_google_protobuf/libprotobuf_java_util-hjar.jar --output_deps ... (remaining 32 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
external/com_google_protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java:45: error: symbol not found com.google.errorprone.annotations.CanIgnoreReturnValue
import com.google.errorprone.annotations.CanIgnoreReturnValue;

I was able to fix --incompatible_disallow_dict_plus so I'm going to submit a PR to fix rules_k8s at bazel head

smukherj1 avatar Feb 22 '19 14:02 smukherj1

From the latest CI run: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/28#866e8cd5-7e69-46bf-a8d0-4ec6e9188937

Migration is needed for the following flags:

  • --incompatible_allow_python_version_transitions
  • --incompatible_bzl_disallow_load_after_statement
  • --incompatible_depset_is_not_iterable
  • --incompatible_depset_union
  • --incompatible_disable_deprecated_attr_params
  • --incompatible_disable_legacy_cc_provider
  • --incompatible_disable_legacy_proto_provider
  • --incompatible_disallow_load_labels_to_cross_package_boundaries
  • --incompatible_new_actions_api
  • --incompatible_no_support_tools_in_action_inputs
  • --incompatible_remove_old_python_version_api

Updating the dependencies should help.

laurentlb avatar Mar 06 '19 16:03 laurentlb

For --incompatible_remove_old_python_version_api, it looks like despite your recent change to update the declared version of rules_python to bazelbuild/rules_python@965d4b4a63e6462204ae671d7c3f02b25da37941, the actual version that ends up being used is bazelbuild/rules_python@e6399b601e2f72f74e5aa635993d69166784dde1, according to the resolved workspace dump (--experimental_repository_resolved_file=...). There must be another dependency on a project using an older version of rules_python that takes precedence...

(BTW, that change didn't update the date comment on the line.)

brandjon avatar Mar 12 '19 15:03 brandjon

I filed the following issues for fixing some transitive deps to update their dep on rules_python and subpar:

  • stackb/rules_proto#60
  • bazelbuild/rules_docker#729
  • google/containerregistry#146

I also sent #289 to workaround these issues for rules_k8s in the meantime.

brandjon avatar Mar 12 '19 20:03 brandjon

Can you provide an update for --incompatible_depset_is_not_iterable, ---incompatible_depset_union and --incompatible_disable_deprecated_attr_params?

For incompatible_disable_deprecated_attr_params, try to update protobuf to 3.7.1 (like here: https://github.com/bazelbuild/rules_closure/pull/344).

laurentlb avatar Mar 27 '19 20:03 laurentlb

@laurentlb Planning to take a look at this the coming week

smukherj1 avatar Mar 28 '19 13:03 smukherj1

incompatible_depset_is_not_iterable fixed in https://github.com/bazelbuild/rules_k8s/pull/301 incompatible_disable_deprecated_attr_params fixed in https://github.com/bazelbuild/rules_k8s/pull/302 incompatible_depset_union @alex1545 double checked and we dont have any longer any code that needs depset union.

nlopezgi avatar Apr 02 '19 14:04 nlopezgi

According to: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/76#a4fadda7-58b8-4ac7-ab07-7629354f95c2

The command: bazel build --incompatible_depset_union -- ... -//images/gcloud-bazel:gcloud_push -//images/gcloud-bazel:gcloud_installer -//images/gcloud-bazel:gcloud_install -//images/gcloud-bazel:gcloud-layer fails.

The error in jsonnet should disappear by updating the dependencies.

laurentlb avatar Apr 14 '19 21:04 laurentlb

It's still failing with --incompatible_depset_union: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/88#632fb0e6-5a09-4494-b8de-ef76f08a3b1d

ERROR: /var/lib/buildkite-agent/builds/bk-docker-dv7p/bazel-downstream-projects/rules_k8s/examples/hellogrpc/BUILD:77:1: in jsonnet_to_json rule //examples/hellogrpc:deployment:
--
  | Traceback (most recent call last):
  | File "/var/lib/buildkite-agent/builds/bk-docker-dv7p/bazel-downstream-projects/rules_k8s/examples/hellogrpc/BUILD", line 77
  | jsonnet_to_json(name = 'deployment')
  | File "/home/bazel/.cache/bazel/_bazel_bazel/8ca20fbca05d9076804e38817b0a59ca/external/io_bazel_rules_jsonnet/jsonnet/jsonnet.bzl", line 228, in _jsonnet_to_json_impl
  | transitive_data += dep.data_runfiles.files

laurentlb avatar Apr 25 '19 15:04 laurentlb