keith / rules_multirun

Bazel rules for running multiple commands in parallel in a single bazel invocation
Apache License 2.0
79 stars 16 forks source link

multirun.bzl: "Error in getattr: No attribute 'data' in attr" #46

Closed harshalparekh6 closed 8 months ago

harshalparekh6 commented 8 months ago

When having container_image as commands of multirun, it fails with:

Traceback (most recent call last):
    File "/var/lib/****/.cache/bazel/_bazel_****/caa5c17abe575e92bb839616b98ef391/external/rules_multirun/multirun.bzl", line 30, column 36, in _binary_args_env_aspect_impl
        expansion_targets = getattr(ctx.rule.attr, "data")
Error in getattr: No attribute 'data' in attr. Make sure you declared a rule attribute with this name.
Available attributes: _action_listener, _config_dependencies, _digester, _is_executable, _join_layers, _zipper, applicable_licenses, architecture, args, base, build_layer, cmd, compatible_with, compression, compression_options, create_image_config, creation_time, data_path, debs, deprecation, directory, docker_run_flags, empty_dirs, empty_files, enable_mtime_preservation, entrypoint, env, exec_compatible_with, exec_properties, expect_failure, experimental_tarball_format, extract_config, features, files, generator_function, generator_location, generator_name, incremental_load_template, label_file_strings, label_files, labels, launcher, launcher_args, layers, legacy_repository_naming, legacy_run_behavior, mode, mtime, name, null_cmd, null_entrypoint, operating_system, os_version, output_licenses, portable_mtime, ports, repository, restricted_to, sha256, stamp, symlinks, tags, target_compatible_with, tars, testonly, toolchains, transitive_configs, user, visibility, volumes, workdir

Seems like there is no default value provided here:

expansion_targets = getattr(ctx.rule.attr, "data")

Should be an easy fix?

expansion_targets = getattr(ctx.rule.attr, "data", [])

Happy to open a PR.

keith commented 8 months ago

yea looks like it, want to submit a PR? should be an easy test case too