bazel-examples icon indicating copy to clipboard operation
bazel-examples copied to clipboard

protobufjs example: incompatibility with rules_docker

Open mvukov opened this issue 3 years ago • 0 comments

In the workspace file of the protobufjs example I just added at the bottom:

http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
    urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)

load(
    "@io_bazel_rules_docker//repositories:repositories.bzl",
    container_repositories = "repositories",
)
container_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

load(
    "@io_bazel_rules_docker//container:container.bzl",
    "container_pull",
)

container_pull(
    name = "ubuntu_focal",
    tag = "ubuntu:20.04",
    digest = "sha256:b2339eee806d44d6a8adc0a790f824fb71f03366dd754d400316ae5a7e3ece3e",
    registry = "index.docker.io",
    repository = "library/ubuntu",
)

when I run bazel build @ubuntu_focal//image I get the following love letter:

INFO: Repository bazel_gazelle_go_repository_config instantiated at:
  /home/milan/dev/aspect_bazel_examples/protobufjs/WORKSPACE.bazel:81:15: in <toplevel>
  /home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/io_bazel_rules_docker/repositories/deps.bzl:38:12: in deps
  /home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/io_bazel_rules_docker/repositories/go_repositories.bzl:41:25: in go_deps
  /home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/bazel_gazelle/deps.bzl:77:25: in gazelle_dependencies
Repository rule go_repository_config defined at:
  /home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/bazel_gazelle/internal/go_repository_config.bzl:57:39: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bazel_gazelle_go_repository_config':
   Traceback (most recent call last):
	File "/home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/bazel_gazelle/internal/go_repository_config.bzl", line 25, column 31, in _go_repository_config_impl
		config_path = ctx.path(ctx.attr.config)
Error in path: Not a regular file: /home/milan/dev/aspect_bazel_examples/protobufjs/WORKSPACE
ERROR: /home/milan/dev/aspect_bazel_examples/protobufjs/WORKSPACE.bazel:81:15: fetching go_repository_config rule //external:bazel_gazelle_go_repository_config: Traceback (most recent call last):
	File "/home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/bazel_gazelle/internal/go_repository_config.bzl", line 25, column 31, in _go_repository_config_impl
		config_path = ctx.path(ctx.attr.config)
Error in path: Not a regular file: /home/milan/dev/aspect_bazel_examples/protobufjs/WORKSPACE
ERROR: /home/milan/.cache/bazel/_bazel_milan/b93d749a5afa9d6a20cfa8ddf92dbbb1/external/io_bazel_rules_docker/container/go/cmd/extract_config/BUILD:19:11: no such package '@com_github_google_go_containerregistry//pkg/v1/tarball': no such package '@bazel_gazelle_go_repository_config//': Not a regular file: /home/milan/dev/aspect_bazel_examples/protobufjs/WORKSPACE and referenced by '@io_bazel_rules_docker//container/go/cmd/extract_config:go_default_library'
ERROR: Analysis of target '@ubuntu_focal//image:image' failed; build aborted: 
INFO: Elapsed time: 11.866s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (49 packages loaded, 471 targets configured)
    Fetching @com_github_google_go_containerregistry; Restarting.
    Fetching @com_github_pkg_errors; Restarting.

It may be that gazelle defs inside rules_nodejs and rules_docker clash.

bazel-examples: daf995df591da56a99322b1ca5f5bbcd5a82b6ca bazel: 5.2.0 os: Ubuntu 20.04

mvukov avatar Jul 29 '22 14:07 mvukov