Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bzlmod doesn't detect repo usage correctly #727

Open
mering opened this issue Oct 22, 2024 · 3 comments · May be fixed by #763
Open

Bzlmod doesn't detect repo usage correctly #727

mering opened this issue Oct 22, 2024 · 3 comments · May be fixed by #763
Labels
bug Something isn't working

Comments

@mering
Copy link
Contributor

mering commented Oct 22, 2024

When following the instructions from the release:

bazel_dep(name = "rules_oci", version = "2.0.1")
# For testing, we also recommend https://registry.bazel.build/modules/container_structure_test

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")

# Declare external images you need to pull, for example: 
oci.pull(
    name = "distroless_base",
    # 'latest' is not reproducible, but it's convenient.
    # During the build we print a WARNING message that includes recommended 'digest' and 'platforms'
    # values which you can use here in place of 'tag' to pin for reproducibility.
    tag = "latest",
    image = "gcr.io/distroless/base",
    platforms = ["linux/amd64"],
)

# For each oci.pull call, repeat the "name" here to expose them as dependencies.
use_repo(oci, "distroless_base")

I get the following warning:

WARNING: REPO/MODULE.bazel:320:20: The module extension oci defined in @rules_oci//oci:extensions.bzl reported incorrect imports of repositories via use_repo():

Imported, but reported as indirect dependencies by the extension:
    distroless_base

 ** You can use the following buildozer command to fix these issues:

buildozer 'use_repo_remove @rules_oci//oci:extensions.bzl oci distroless_base' //MODULE.bazel:all

When running bazel mod tidy, it adds distroless_base_linux_amd64 which should not be necessary as distroless_base should be used instead (and this is also what I use in my BUILD.bazel files.

@thesayyn thesayyn added the bug Something isn't working label Oct 28, 2024
@flolu
Copy link

flolu commented Dec 22, 2024

Same issue for me

@thesayyn
Copy link
Collaborator

See #763 (comment)

@thesayyn
Copy link
Collaborator

Upstream issue for the feature request in Bazel: bazelbuild/bazel#25046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants